@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
	color-scheme: light;
	--bg: #f2f4f5;
	--surface: #ffffff;
	--fg: #393b3d;
	--muted: #6b6e70;
	--accent: #c0392b;
	--accent-dark: #962d22;
	--border: #d8dadb;
	--bar: #232527;
	--green: #02b757;
	--danger: #b42318;
	--radius: 3px;
	--space: 1rem;
	--font: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.45;
	overflow-x: hidden;
}

h1 { font-size: 1.75rem; margin: 0 0 0.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 0 0 0.4rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 20; background: var(--bar); color: #fff; }
.topbar-inner {
	max-width: 70rem; margin: 0 auto; height: 48px; padding: 0 12px;
	display: flex; align-items: center; gap: 16px;
}
.logo img { height: 32px; width: auto; display: block; }
.topnav { display: none; gap: 4px; flex: 1; }
.topnav button {
	background: none; border: 0; color: #fff; font: inherit; font-weight: 600;
	padding: 0 14px; height: 48px; cursor: pointer; opacity: 0.85;
}
.topnav button:hover, .topnav button.on { opacity: 1; background: rgba(255,255,255,0.08); }
.balance {
	margin-left: auto; background: none; border: 0; color: #fff; font: inherit;
	font-weight: 600; min-height: 44px; cursor: pointer;
}
@media (min-width: 700px) {
	.topnav { display: flex; }
	.balance { margin-left: 0; }
	.tabbar { display: none !important; }
	.page { padding-bottom: 40px !important; }
}

.page { max-width: 70rem; margin: 0 auto; padding: 16px 12px 110px; }

.robux { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--green); }
.topbar .robux { color: #fff; }

.input {
	width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 16px;
	border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg);
}
.btn {
	min-height: 44px; padding: 0 18px; border: 1px solid var(--accent-dark); border-radius: var(--radius);
	background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { background: #b8b8b8; border-color: #a3a3a3; cursor: not-allowed; }
.btn-buy { background: var(--green); border-color: #019247; width: 100%; font-size: 1.1rem; }
.btn-buy:hover { background: #019247; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }

.filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 10px; }
@media (min-width: 600px) { .filters { grid-template-columns: 1fr 14rem; } }

.cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cats button {
	min-height: 40px; padding: 0 14px; font: inherit; font-weight: 600; cursor: pointer;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg);
}
.cats button.on { background: var(--fg); border-color: var(--fg); color: #fff; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr)); gap: 10px; }
.item-card {
	display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	padding: 8px; font: inherit; color: var(--fg); cursor: pointer; min-width: 0;
}
.item-card:not(.static):hover { box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.item-name { font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.item-by { font-size: 0.85rem; color: var(--muted); }
.left { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.qty { font-weight: 700; }
.offsale { color: var(--muted); font-weight: 600; }
.owned { color: var(--green); font-weight: 600; }

.thumb { position: relative; width: 100%; aspect-ratio: 1; background: #e3e5e6; border-radius: var(--radius); margin-bottom: 6px; }
.thumb svg { width: 100%; height: 100%; display: block; }
.tag-limited {
	position: absolute; left: 4px; bottom: 4px; background: #1d7a3a; color: #fff;
	font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 2px;
}

.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
	background: var(--surface); width: 100%; max-width: 34rem; max-height: 90vh; overflow-y: auto;
	border-radius: var(--radius) var(--radius) 0 0; animation: rise 0.2s ease-out;
}
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: var(--radius); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; }
.x { width: 44px; height: 44px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.sheet-body .thumb { max-width: 220px; margin: 0 auto; }
@media (min-width: 520px) { .sheet-body { grid-template-columns: 200px minmax(0, 1fr); } }
.stack-sm { display: grid; gap: 8px; }
.price-row { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; font-size: 1.1rem; }

.profile-head { display: flex; gap: 14px; align-items: center; }
.avatar { width: 84px; height: 84px; flex: none; background: #e3e5e6; border-radius: 50%; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; }
.uname { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.uname h1 { margin: 0; font-size: 1.5rem; }
.vbadge { width: 22px; height: 22px; object-fit: contain; }
.tier { background: var(--fg); color: #fff; font-weight: 700; font-size: 0.8rem; padding: 2px 8px; border-radius: 2px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.daily { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.tiers tr.cur td { background: #fbeceb; font-weight: 700; }

.tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
	background: var(--surface); border-top: 1px solid var(--border);
	padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.tabbar button {
	flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 2px; border: 0; background: none; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabbar button.on { color: var(--accent); }

.staff { position: fixed; left: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 35; }
@media (min-width: 700px) { .staff { bottom: 16px; } }
.staff-toggle {
	width: 44px; height: 44px; border-radius: 50%; border: 1px solid #000; background: rgba(35,37,39,0.92);
	color: #fff; cursor: pointer; display: grid; place-items: center; touch-action: manipulation;
}
.staff-toggle svg { transition: transform 0.25s ease; }
.staff.open .staff-toggle svg { transform: rotate(180deg); }
.staff-panel {
	position: absolute; left: 0; bottom: 52px; width: min(240px, calc(100vw - 20px));
	background: #232527; color: #fff; border-radius: 6px; padding: 12px;
	opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease;
}
.staff.open .staff-panel { opacity: 1; transform: none; pointer-events: auto; }
.staff-title { font-size: 0.75rem; font-weight: 700; color: #bdbebe; margin-bottom: 8px; }
.staff-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.staff-stats div { background: #393b3d; border-radius: 4px; padding: 8px; }
.staff-stats b { display: block; font-size: 1.3rem; }
.staff-stats span { font-size: 0.8rem; color: #bdbebe; }
.staff-note { font-size: 0.8rem; color: #bdbebe; margin-top: 8px; }

.toast {
	position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 50;
	background: var(--bar); color: #fff; padding: 10px 16px; border-radius: var(--radius); max-width: calc(100vw - 24px);
}

@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { padding: 24px; text-align: center; color: var(--muted); }
.empty-title { margin: 0 0 4px; color: var(--fg); font-weight: 600; }
.loading { display: flex; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--danger); color: var(--danger); background: var(--surface); }
.badge { display: inline-block; padding: 1px 8px; border: 1px solid var(--border); font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
	.sheet, .staff-panel, .staff-toggle svg, .spinner { animation: none; transition: none; }
}

:where(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
