:root {
	--bg: #15140f;
	--surface: #1e1c15;
	--surface-2: #262318;
	--line: #36321f;
	--gold: #ffd800;
	--green: #16bc0e;
	--green-press: #129b0b;
	--text: #ece7d9;
	--muted: #9a9486;
	--err: #ff7a59;
	--radius: 10px;
	--maxw: 620px;
}

* { box-sizing: border-box; }
/* Make the hidden attribute always win, even over display rules below.
   Without this, .screen/.topbar/.field display rules override [hidden]
   and every screen renders stacked on top of the others. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
	min-height: 100dvh;
}

#app { max-width: var(--maxw); margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }

/* Wordmark — stamped, condensed, two-tone */
.wordmark {
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
}
.wm-grey { color: var(--text); }
.wm-beard { color: var(--gold); }
.wordmark.big { font-size: 3.2rem; }
.wordmark.mid { font-size: 1.9rem; }
.center-x { text-align: center; display: block; margin-bottom: 1.1rem; }

.tagline {
	font-family: "Oswald", sans-serif;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.22em;
	font-size: 0.72rem;
	color: var(--muted);
	margin-top: 0.85rem;
}

.seed-stamp {
	text-align: center;
	padding: 2rem 1.5rem;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	background:
		repeating-linear-gradient(45deg, rgba(255,216,0,0.02) 0 10px, transparent 10px 20px),
		var(--surface);
}

/* Topbar */
.topbar {
	position: sticky; top: 0; z-index: 10;
	display: flex; align-items: center; justify-content: space-between;
	padding: 0.7rem 1rem;
	padding-top: calc(0.7rem + env(safe-area-inset-top));
	background: rgba(21,20,15,0.92);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
}
.topbar .wordmark { font-size: 1.3rem; }
.icon-btn {
	background: none; border: none; color: var(--muted);
	font-size: 1.3rem; cursor: pointer; padding: 0.2rem 0.4rem; line-height: 1;
}
.icon-btn:hover { color: var(--gold); }

/* Screens */
.screen { padding: 1rem; }
.screen.center { min-height: 80vh; min-height: 80dvh; display: flex; align-items: center; justify-content: center; }

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.4rem;
	width: 100%;
}
.card.narrow { max-width: 380px; }

.stamp {
	font-family: "Oswald", sans-serif;
	font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
	margin: 0 0 0.4rem;
}
h1.stamp { font-size: 1.5rem; }
.muted { color: var(--muted); }
.err { color: var(--err); font-size: 0.9rem; margin: 0.5rem 0 0; }

/* Fields */
.field { display: block; margin: 0.9rem 0; }
.field > span {
	display: block; font-size: 0.78rem; text-transform: uppercase;
	letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.35rem;
}
.field input {
	width: 100%; padding: 0.7rem 0.8rem;
	background: var(--bg); color: var(--text);
	border: 1px solid var(--line); border-radius: 8px;
	font-size: 1rem; font-family: inherit;
}
.field input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }

/* Tabs */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.tab {
	flex: 1; padding: 0.55rem; cursor: pointer;
	background: var(--bg); color: var(--muted);
	border: 1px solid var(--line); border-radius: 8px;
	font-family: "Oswald", sans-serif; text-transform: uppercase;
	letter-spacing: 0.05em; font-size: 0.85rem;
}
.tab.is-active { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 600; }

/* Buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center;
	font-family: "Oswald", sans-serif; font-weight: 600;
	text-transform: uppercase; letter-spacing: 0.05em; font-size: 1rem;
	padding: 0.8rem 1.2rem; border: none; border-radius: 8px;
	cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.block { display: flex; width: 100%; margin-top: 0.4rem; }
.btn-gold { background: var(--gold); color: #1a1700; }
.btn-green { background: var(--green); color: #06210a; }
.btn-green:active { background: var(--green-press); }
.btn-ghost { background: transparent; color: var(--gold); border: 1px solid var(--line); }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* Banners */
.banner {
	background: var(--surface-2); border: 1px solid var(--line);
	border-left: 4px solid var(--gold); border-radius: 8px;
	padding: 0.85rem 1rem; margin-bottom: 0.9rem;
	font-size: 0.93rem;
}
.banner .stamp { font-size: 0.95rem; }
.banner .row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }
.banner .btn { padding: 0.55rem 0.9rem; font-size: 0.9rem; }
.banner ol { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.banner .dismiss { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; text-decoration: underline; }

/* Drop cards */
.drop {
	position: relative;
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); overflow: hidden; margin-bottom: 1.1rem;
}
.drop-hide { position: absolute; top: 10px; right: 10px; z-index: 2;
	width: 2rem; height: 2rem; border-radius: 50%; border: 0;
	background: rgba(0,0,0,0.55); color: #fff; font-size: 1.3rem; line-height: 1;
	display: flex; align-items: center; justify-content: center; cursor: pointer; transition: opacity 0.2s; }
.drop-hide:hover { background: rgba(0,0,0,0.8); }
.drop img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; background: var(--surface-2); }
.drop .body { padding: 1rem 1.1rem 1.2rem; }
.drop .title { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 1.25rem; text-transform: uppercase; letter-spacing: 0.02em; margin: 0; }
.drop .price { color: var(--gold); font-family: "Oswald", sans-serif; font-weight: 600; font-size: 1.05rem; margin: 0.15rem 0 0; }
.drop .msg { margin: 0.6rem 0 0; color: var(--text); }
.drop .when { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }
.drop .dibs-row { display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; }
.drop .dibs-row .btn { flex: 1; }
.dibs-count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.you-in {
	flex: 1; text-align: center; padding: 0.8rem; border-radius: 8px;
	border: 1px solid var(--green); color: var(--green);
	font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

.empty { text-align: center; padding: 3rem 1rem; }
.empty .stamp { font-size: 1.4rem; color: var(--muted); }

/* Onboarding step list */
.steps { margin: 0.9rem 0 1.3rem; padding-left: 1.2rem; color: var(--text); }
.steps li { margin: 0.45rem 0; }

/* Topbar actions + refresh spin */
.topbar-actions { display: flex; gap: 0.25rem; align-items: center; }
.icon-btn.spin { animation: gbd-spin 0.6s linear; }
@keyframes gbd-spin { to { transform: rotate(360deg); } }

/* Password show/hide toggle */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
	background: none; border: 0; cursor: pointer; color: var(--muted);
	display: inline-flex; align-items: center; padding: 0.3rem; }
.pw-toggle svg { width: 22px; height: 22px; display: block; }
.pw-toggle:hover { color: var(--gold); }

/* Dibs quantity stepper */
.qty { display: inline-flex; align-items: center; gap: 0.5rem; }
.qty-btn { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid var(--leaf, #16bc0e);
	background: transparent; color: var(--leaf, #16bc0e); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.qty-btn:hover { background: rgba(22,188,14,0.12); }
.qty-n { color: var(--leaf, #16bc0e); font-weight: 600; white-space: nowrap; }

/* Remove-my-dibs button */
.dibs-remove { display: block; width: 100%; margin-top: 0.6rem; padding: 0.5rem;
	background: transparent; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
	color: var(--muted, #9a948a); font-size: 0.85rem; cursor: pointer; }
.dibs-remove:hover { border-color: #c0392b; color: #e07a6b; }

/* Toast */
.toast {
	position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	background: var(--gold); color: #1a1700;
	font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.04em; padding: 0.7rem 1.2rem; border-radius: 999px;
	box-shadow: 0 6px 24px rgba(0,0,0,0.4); z-index: 50; max-width: 90vw;
}

@media (prefers-reduced-motion: no-preference) {
	.toast { animation: pop 0.18s ease-out; }
	@keyframes pop { from { transform: translateX(-50%) translateY(8px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
}

/* ---- Messages (Stage 2 DMs) ---- */
.icon-btn.has-badge { position: relative; }
.icon-btn .badge { position: absolute; top: -3px; right: -3px;
	background: #d63638; color: #fff; border-radius: 9px; min-width: 16px; height: 16px;
	font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px; font-weight: 700; }

#screen-messages { display: flex; flex-direction: column; height: 100dvh; }
.msg-thread { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.from-me { align-self: flex-end; align-items: flex-end; }
.msg.from-them { align-self: flex-start; align-items: flex-start; }
.msg .bubble { padding: 0.55rem 0.8rem; border-radius: 14px; word-break: break-word; }
.msg.from-me .bubble { background: var(--leaf, #16bc0e); color: #0c0c0c; border-bottom-right-radius: 4px; }
.msg.from-them .bubble { background: var(--surface-2, #232017); color: var(--text, #f4efe6); border-bottom-left-radius: 4px; }
.msg-when { font-size: 0.7rem; color: var(--muted, #9a948a); margin-top: 2px; }
.msg-empty { color: var(--muted, #9a948a); text-align: center; margin-top: 2.5rem; }
.msg-compose { display: flex; gap: 0.5rem; padding: 0.7rem; border-top: 1px solid var(--line, #2a2820); align-items: flex-end; }
.msg-compose textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; }
.msg-compose .btn { flex: 0 0 auto; padding-left: 1.1rem; padding-right: 1.1rem; }

#screen-community { display: flex; flex-direction: column; height: 100dvh; }
.msg .author { font-size: 0.72rem; font-weight: 600; color: var(--gold, #ffd800); margin-bottom: 2px; }
.msg .author.owner { color: var(--gold, #ffd800); letter-spacing: 0.04em; text-transform: uppercase; }
.msg.from-owner { align-self: flex-start; align-items: flex-start; max-width: 88%; }
.msg.from-owner .bubble { background: var(--gold, #ffd800); color: #15140f; border: 0; border-bottom-left-radius: 4px; font-weight: 500; }
.msg .report { color: var(--muted, #9a948a); text-decoration: none; }
.msg .report:hover { color: #d63638; text-decoration: underline; }
.icon-btn .badge.dot { min-width: 9px; width: 9px; height: 9px; padding: 0; top: -1px; right: -1px; }
.msg-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.msg-row .msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.avatar { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	background: var(--surface-2, #232017); color: var(--text, #f4efe6); font-weight: 700; font-size: 0.82rem; margin-top: 2px; }
.avatar.owner { background: var(--gold, #ffd800); color: #15140f; }
.msg.grouped { margin-top: -0.35rem; }

.ver { text-align: center; color: var(--muted, #9a948a); font-size: 0.7rem; padding: 1.2rem 0 2rem; }
