:root {
	--bg: #0f1117;
	--surface: #191c26;
	--surface-2: #222634;
	--line: #2c3140;
	--text: #e7e9ee;
	--muted: #9aa1b1;
	--accent: #ffb347;
	--accent-2: #ff6b6b;
	--good: #4ade80;
	--radius: 14px;
	--maxw: 960px;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: radial-gradient(1200px 600px at 50% -200px, #1a1f2e, var(--bg));
	color: var(--text);
	font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; margin: 0 0 .6rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .8rem; }
.muted { color: var(--muted); font-weight: 400; }

.topbar {
	display: flex; align-items: center; justify-content: space-between;
	max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.2rem;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; }
.topbar nav { display: flex; align-items: center; gap: 1.2rem; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.current-user { display: inline-flex; align-items: center; gap: .35rem; color: var(--text);
	padding-left: 1.2rem; border-left: 1px solid var(--line); }
.logout-form { margin: 0; }
.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer;
	font: inherit; padding: 0; text-decoration: underline; }
.linkbtn:hover { color: var(--accent-2); }

.login { max-width: 640px; margin: 2rem auto 0; text-align: center; }
.login-mascot { width: 180px; height: 180px; object-fit: contain;
	filter: drop-shadow(0 8px 24px rgba(0,0,0,.45)); }
.login h1 { font-size: 2.2rem; margin-top: .4rem; }
.login-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 1rem; margin-top: 2rem; }
.login-grid form { margin: 0; }
.login-card {
	width: 100%; display: flex; flex-direction: column; align-items: center; gap: .6rem;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--line); border-radius: var(--radius);
	padding: 1.4rem 1rem; cursor: pointer; font-size: 1rem;
}
.login-card:hover { border-color: var(--accent); transform: translateY(-2px); transition: .12s; }

.avatar { font-size: 1.1rem; }
.avatar.big { font-size: 2.4rem; }

main { max-width: var(--maxw); margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }

.hero { padding: 1rem 0 1.4rem; }
.hero .lead { font-size: 1.15rem; color: var(--muted); }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }

.button {
	display: inline-block; background: var(--accent); color: #201400;
	border: none; border-radius: 10px; padding: .7rem 1.1rem;
	font-size: 1rem; font-weight: 600; cursor: pointer;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button.small { padding: .4rem .7rem; font-size: .85rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .8rem; }
.card {
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 1rem;
}
.user-card {
	display: flex; flex-direction: column; align-items: center; gap: .5rem;
	color: var(--text); text-align: center;
}
.user-card:hover { border-color: var(--accent); text-decoration: none; }

.search input[type=search] {
	width: 100%; padding: .8rem 1rem; font-size: 1rem;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--line); border-radius: 10px;
}

.results { display: grid; gap: .7rem; margin-top: 1rem; }
.result { display: flex; gap: .9rem; padding: .8rem; }
.result-body { display: flex; flex-direction: column; gap: .3rem; }
.overview { color: var(--muted); font-size: .88rem; margin: .2rem 0 .5rem;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.poster { width: 92px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.poster.small { width: 54px; height: 80px; }
.poster.large { width: 200px; }
.poster.placeholder { display: grid; place-items: center; font-size: 1.6rem; aspect-ratio: 2/3; }

.my-list { background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 1rem 1.2rem 1.2rem; margin-bottom: 1.6rem; }
.my-list-head { display: flex; align-items: center; justify-content: space-between;
	gap: 1rem; flex-wrap: wrap; }
.my-list-head h2 { margin: .2rem 0; }
.watchlist { list-style: none; padding: 0; display: grid; gap: .6rem; }
.watchlist.compact .watch-item { background: var(--surface-2); }
.watch-item { display: flex; align-items: center; gap: .8rem; background: var(--surface);
	border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.watch-item.watched { opacity: .55; }
.rank { font-size: 1.1rem; font-weight: 700; color: var(--accent); width: 1.6rem; text-align: center; flex: none; }
.watch-meta { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; }
.watch-actions { display: flex; gap: .4rem; }
.watch-actions form { display: flex; gap: .2rem; margin: 0; }
.watch-actions button {
	background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
	border-radius: 8px; padding: .3rem .5rem; cursor: pointer;
}
.watch-actions button:hover:not([disabled]) { border-color: var(--accent); }
.watch-actions button[disabled] { opacity: .35; cursor: default; }
.watch-actions .danger:hover { border-color: var(--accent-2); color: var(--accent-2); }
.badge { background: var(--good); color: #062b12; border-radius: 999px; padding: .1rem .5rem; font-size: .72rem; font-weight: 700; }
.badge.view-only { background: var(--surface-2); color: var(--muted); font-weight: 600; vertical-align: middle; }

.feature { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: flex-start;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.feature-body { flex: 1; min-width: 240px; }
.feature-body h2 { margin-top: 0; }

.notice { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
	border-radius: 8px; padding: .8rem 1rem; color: var(--muted); }
.notice.error { border-left-color: var(--accent-2); }
.vote-now { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
	border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.vote-now h2 { margin: .2rem 0 .4rem; }
.vote-now .lead { color: var(--muted); margin-bottom: .8rem; }
.votes-hidden p { margin: 0 0 .8rem; color: var(--text); }
.votes-hidden .button { margin: 0; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }

.scoreboard .averages { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.big-score { font-size: 2.4rem; font-weight: 800; color: var(--accent); }
.criteria-avgs { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.criteria-avgs li { display: flex; flex-direction: column; }
.criteria-avgs strong { font-size: 1.3rem; }

.score-form { display: grid; gap: 1rem; max-width: 420px; }
.criterion { border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1rem 1rem; margin: 0; }
.criterion legend { color: var(--accent); font-weight: 600; padding: 0 .3rem; }
.rating { display: flex; gap: .5rem; }
.rating label { position: relative; cursor: pointer; }
.rating input { position: absolute; opacity: 0; }
.rating span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem;
	background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.rating input:checked + span { background: var(--accent); color: #201400; border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
.breakdown { width: 100%; border-collapse: collapse; }
.breakdown th, .breakdown td { padding: .55rem .7rem; text-align: center; border-bottom: 1px solid var(--line); }
.breakdown th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.breakdown th:first-child, .breakdown td.who { text-align: left; white-space: nowrap; }
.breakdown td.who { display: flex; align-items: center; gap: .4rem; }
.breakdown tr.not-scored { opacity: .5; }
.breakdown th + th, .breakdown td + td { border-left: 1px solid var(--line); }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-table th, .admin-table td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { color: var(--muted); font-size: .85rem; font-weight: 600; }
.admin-table .name { font-weight: 600; }
.admin-table .inline { display: flex; align-items: center; gap: .4rem; margin: 0; }
.admin-table .order button {
	background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
	border-radius: 8px; padding: .3rem .5rem; cursor: pointer;
}
.admin-table .order button:hover:not([disabled]) { border-color: var(--accent); }
.admin-table .order button[disabled] { opacity: .35; cursor: default; }
.emoji-input { width: 3.4rem; text-align: center; font-size: 1.2rem;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--line); border-radius: 8px; padding: .3rem; }
.badge.next { background: var(--accent); color: #201400; }

.history { display: grid; gap: .7rem; }
.history-top { display: flex; align-items: center; gap: 1rem; }
.history-meta { flex: 1; }
.breakdown-details { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.breakdown-details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.breakdown-details summary:hover { color: var(--text); }
.breakdown-details .table-wrap { margin-top: .6rem; }

/* Compact variant used inside history rows. */
.breakdown.compact { font-size: .82rem; }
.breakdown.compact th, .breakdown.compact td { padding: .35rem .55rem; }
.crit-line { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { border-radius: 999px; padding: .12rem .6rem; font-size: .78rem; font-weight: 600;
	color: #0c0f16; }
/* Per-criterion average, heatmapped 1 = red … 5 = green. */
.pill.score-0 { background: var(--surface-2); color: var(--muted); }
.pill.score-1 { background: #e5534b; }
.pill.score-2 { background: #e08a3c; }
.pill.score-3 { background: #e3c344; }
.pill.score-4 { background: #8fc750; }
.pill.score-5 { background: #46b559; }
.history-score { text-align: right; }
