/* Mobile-first. Desktop just centers the phone layout at ~480 px. Light and dark via prefers-color-scheme. */
:root {
	--bg: #f6f5f1;
	--surface: #ffffff;
	--surface-2: #eeece6;
	--text: #1d1d1b;
	--muted: #6b6a64;
	--border: #dcd9d0;
	--accent: #2d6a4f;
	--accent-text: #ffffff;
	--accent-soft: #d8eee2;
	--danger: #b42318;
	--must: #d9480f;
	--gladly: #2f9e44;
	--ok: #5c940d;
	--reluctant: #e8a317;
	--no: #868e96;
	--radius: 12px;
	--tap: 44px;
	--nav-height: 60px;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #141513;
		--surface: #1f201d;
		--surface-2: #2a2b27;
		--text: #ecebe6;
		--muted: #a3a29b;
		--border: #3a3b36;
		--accent: #52b788;
		--accent-text: #0d1f16;
		--accent-soft: #1d3a2b;
		--danger: #f97066;
	}
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	overflow-wrap: break-word;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

body.sheet-open { overflow: hidden; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; overflow-x: clip; }

/* Flex and grid children may shrink below their content, so long words or labels never push past the screen. */
.stack > *, .actions > *, .inline-form > *, .new-name > *, .row-actions > *, .proposal-actions > *, .round-actions > * { min-width: 0; }
.primary, .secondary { overflow-wrap: anywhere; }
/* Short action buttons keep their words whole; the text next to them wraps instead. */
.small-button { white-space: nowrap; flex-shrink: 0; }

/* Horizontally scrollable rows fade out on the side where there is more (set by installScrollFades). */
.chip-row.fade-right, .tabs.fade-right {
	-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
	mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}
.chip-row.fade-left, .tabs.fade-left {
	-webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
	mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
}
.chip-row.fade-left.fade-right, .tabs.fade-left.fade-right {
	-webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
	mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}

h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }

a { color: var(--accent); }

.screen { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
.with-nav { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 8px); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.pre-line { white-space: pre-line; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.notice { background: var(--accent-soft); border-radius: var(--radius); padding: 8px 12px; margin: 0; }

/* Controls */
button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }

input, select, textarea {
	min-height: var(--tap);
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; margin: 0; accent-color: var(--accent); }

label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
label.checkbox { flex-direction: row; align-items: center; gap: 10px; }

.primary, .secondary, .name-button, .small-button, .file-button {
	min-height: var(--tap);
	padding: 8px 16px;
	border-radius: 10px;
	border: 1px solid transparent;
	font-weight: 600;
}
.primary { background: var(--accent); color: var(--accent-text); }
.secondary, .file-button { background: var(--surface); border-color: var(--border); }
.file-button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; }
.small-button { min-height: 36px; padding: 4px 10px; font-size: 0.85rem; background: var(--surface-2); }
.danger { color: var(--danger); }
.wide { width: 100%; }
.link-button { background: none; border: none; color: var(--accent); padding: 8px 0; min-height: var(--tap); text-align: left; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.icon-button { background: none; border: none; width: var(--tap); height: var(--tap); font-size: 1.1rem; color: var(--muted); }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.chip {
	min-height: 40px;
	padding: 6px 14px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface);
	white-space: nowrap;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.count-chip { min-width: var(--tap); }
.taste-chip.like { background: var(--accent-soft); border-color: var(--gladly); }
.taste-chip.dislike { background: var(--surface-2); border-color: var(--danger); color: var(--danger); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.must-badge { background: var(--must); color: #fff; }

/* Who are you? */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 10px; margin-bottom: 16px; }
.name-button { min-height: 56px; background: var(--surface); border-color: var(--border); font-size: 1.05rem; }
.name-button:active { background: var(--accent-soft); }
.new-name { display: flex; gap: 8px; }
.new-name input { flex: 1; min-width: 0; }

/* Bottom navigation */
.bottom-nav {
	position: fixed;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	width: 100%;
	max-width: 480px;
	display: flex;
	background: var(--surface);
	border-top: 1px solid var(--border);
	padding-bottom: env(safe-area-inset-bottom);
	z-index: 10;
}
.nav-item { flex: 1; height: var(--nav-height); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; font-size: 0.8rem; }
.nav-item.active { color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 1.25rem; line-height: 1.3; }

.footer { text-align: center; padding: 16px; }
.bgg-credit { font-size: 0.8rem; color: var(--muted); }

/* Games */
.games-toolbar { position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 4px; margin: -16px -16px 0; padding: 12px 16px 4px; }
.list-meta { display: flex; justify-content: space-between; align-items: center; }
.sort { flex-direction: row; align-items: center; gap: 6px; }
.sort select { width: auto; min-height: 36px; padding: 4px 8px; }

.game-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.game-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; cursor: pointer; }
.game-row-main { display: flex; gap: 10px; }
.game-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.game-image { width: 100%; max-height: 280px; border-radius: var(--radius); object-fit: contain; background: var(--surface-2); }
.placeholder { display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: hsl(var(--hue) 45% 45%); }
.game-image.placeholder { height: 160px; font-size: 3rem; }
.game-info { flex: 1; min-width: 0; }
.game-title { min-width: 0; }
.game-title { display: flex; align-items: center; gap: 6px; }
.game-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.game-facts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); margin: 2px 0; }
.pitch { margin: 2px 0; }
.game-row .pitch { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.tag { padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.75rem; line-height: 1.6; }

.weight-dots { display: inline-flex; gap: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--muted); }
.dot.on { background: var(--muted); }

.game-controls, .detail-controls { margin-top: 8px; }
.pref-control { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.pref {
	min-height: var(--tap);
	padding: 2px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--surface);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	filter: grayscale(1);
	opacity: 0.75;
}
.pref-icon { font-size: 1.05rem; line-height: 1.3; position: relative; }
/* Musím: how many are left, as a small counter on the icon. */
.must-left { position: absolute; top: -4px; left: calc(100% + 1px); min-width: 15px; padding: 0 3px; border-radius: 999px; background: var(--must); color: #fff; font-size: 0.6rem; font-weight: 700; line-height: 15px; text-align: center; }
.must-left.none { background: var(--muted); }
.pref.selected .must-left { background: #fff; color: var(--must); }
.pref-label { font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pref.selected { filter: none; opacity: 1; color: #fff; font-weight: 700; }
.pref-must.selected { background: var(--must); border-color: var(--must); }
.pref-gladly.selected { background: var(--gladly); border-color: var(--gladly); }
.pref-ok.selected { background: var(--ok); border-color: var(--ok); }
.pref-reluctant.selected { background: var(--reluctant); border-color: var(--reluctant); color: #222; }
.pref-no.selected { background: var(--no); border-color: var(--no); }
.pref-unsure.selected { background: var(--muted); border-color: var(--muted); }
/* "Znáš ji?" Znám / Neznám: deliberately unlike the rating buttons. */
.know-row { margin-top: 6px; }
.know-switch { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.know-question { color: var(--muted); font-size: 0.85rem; }
.know-options { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.know-option { min-height: 36px; padding: 4px 12px; border: none; background: transparent; color: var(--muted); font-size: 0.85rem; }
.know-option + .know-option { border-left: 1px solid var(--border); }
.know-played.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.know-not_known.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.know-switch.large { justify-content: space-between; }
.know-switch.large .know-question { font-size: 1rem; }
.know-switch.large .know-option { min-height: var(--tap); padding: 6px 18px; font-size: 1rem; }
.must-color { color: var(--must); }

/* Bottom sheets */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 0.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	border-radius: 16px 16px 0 0;
	padding-bottom: env(safe-area-inset-bottom);
	animation: sheet-in 0.18s ease-out;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0.6; } }
.sheet-head { display: flex; align-items: center; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.sheet-title { flex: 1; font-weight: 700; }
.sheet-body { overflow-y: auto; padding: 16px; }
.detail { display: flex; flex-direction: column; gap: 10px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dt .fa-solid { width: 1.25em; text-align: center; }
.facts dd { margin: 0; }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
	transform: translateX(-50%);
	max-width: min(440px, calc(100% - 32px));
	background: var(--text);
	color: var(--bg);
	padding: 10px 16px;
	border-radius: 10px;
	z-index: 30;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
}

/* Admin */
.admin-head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.admin-head h1 { flex: 1 1 100%; margin-bottom: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { flex: 1; text-align: center; padding: 12px 0; text-decoration: none; color: var(--muted); }
.tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); font-weight: 600; }
.admin-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-list > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.admin-list > li.clickable { cursor: pointer; }
.admin-list > li.hidden-game { opacity: 0.6; }
.admin-game { display: flex; gap: 10px; align-items: center; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1 1 160px; min-width: 0; }
.admin-image { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.import-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.import-row { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.confidence-green { border-left-color: var(--gladly); }
.confidence-yellow { border-left-color: var(--reluctant); }
.confidence-red { border-left-color: var(--danger); }
.confidence-manual { border-left-color: var(--accent); }
.import-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.import-head label { min-width: 0; overflow-wrap: anywhere; }
.import-head .badge { flex: none; }
.candidate-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.candidate { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; min-height: var(--tap); padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.candidate.selected { border-color: var(--accent); background: var(--accent-soft); }
.candidate-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.owner-field { flex-direction: row; align-items: center; gap: 8px; }
.owner-field input { flex: 1; min-height: 36px; }
.new-owner { background: var(--reluctant); color: #222; }
.sticky-action { position: sticky; bottom: 12px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.2); }

/* Home */
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.status-card { font-size: 1.05rem; }
.table-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.table-card { display: block; padding: 12px; min-height: var(--tap); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.table-card.mine { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.table-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.table-card-head > strong { min-width: 0; overflow-wrap: anywhere; }
.table-card-head .badge { flex: 0 1 auto; min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.status-playing { background: var(--accent); color: var(--accent-text); }

/* Table */
.screen-head { display: flex; justify-content: space-between; align-items: center; margin: -8px 0 -8px; }
.chip-remove { border: none; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 0.85rem; }
.add-chip { border-style: dashed; color: var(--accent); }
.player-count { display: flex; align-items: center; gap: 10px; margin: 8px 0 16px; flex-wrap: wrap; }
.player-count .small-button { width: var(--tap); min-height: var(--tap); font-size: 1.2rem; }
.table-actions { justify-content: space-between; margin-top: 24px; }
.playing-card { border-color: var(--accent); }
.playing-game { display: flex; gap: 12px; align-items: center; }
.big { font-size: 1.2rem; }
.play-timer { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.name-button.busy { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; opacity: 0.85; }
.name-button.busy .small { font-weight: 400; }
.picker-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.picker-row { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.picker-row.misfit { opacity: 0.55; }

/* Pick round */
.round .chip-row { padding: 0; }
.candidate-card { position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.1s, transform 0.1s; }
.candidate-card.highlighted { border-color: var(--must); transform: scale(1.015); }
.candidate-card.spin-result { border-color: var(--must); box-shadow: 0 0 0 3px color-mix(in srgb, var(--must) 30%, transparent); }
.spin-banner { font-weight: 700; color: var(--must); }
.candidate-main { display: flex; gap: 10px; }
.candidate-main .game-thumb { width: 80px; height: 80px; }

.pref-summary { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; }
.pref-count-must { color: var(--must); }
.pref-count-gladly { color: var(--gladly); }
.pref-count-ok { color: var(--ok); }
.pref-count-reluctant { color: var(--reluctant); }
.pref-count-no, .pref-count-unknown, .pref-count-unsure { color: var(--muted); }
.vote-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.my-votes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vote-button { min-height: 52px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; font-size: 1rem; }
.vote-button.up.selected { background: var(--gladly); border-color: var(--gladly); color: #fff; }
.vote-button.veto:not(:disabled):active { background: var(--danger); color: #fff; }
.round-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.round-actions .secondary { flex: 1 1 140px; }
.secondary.selected { border-color: var(--accent); background: var(--accent-soft); }

/* Proposals */
.spaced { margin-top: 10px; }
.proposal-head { display: flex; gap: 10px; }
.proposal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.suggestion { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: var(--radius); padding: 8px 12px; }
.suggestion > span { flex: 1; min-width: 0; }
.suggestions { margin-bottom: 12px; }

/* Swipe queue */
.swipe-teaser { display: flex; gap: 12px; align-items: center; margin-top: 12px; color: var(--text); text-decoration: none; border-color: var(--accent); }
.swipe-teaser-icon { font-size: 2rem; color: var(--accent); }
.swipe-screen { min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; touch-action: none; }
.swipe-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.swipe-card {
	position: relative;
	flex: 0 1 auto;
	margin: auto 0; /* centred between the header and the controls */
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
	transition: transform 0.22s ease-out;
	user-select: none;
	-webkit-user-select: none;
	cursor: grab;
	display: flex;
	flex-direction: column;
}
.swipe-card .game-image { border-radius: 0; max-height: 38vh; min-height: 160px; object-fit: cover; pointer-events: none; }
.swipe-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.swipe-body h2 { margin: 0; }
.swipe-meta { margin-top: auto; padding-top: 4px; }
.swipe-label {
	position: absolute;
	top: 20px;
	z-index: 2;
	padding: 6px 14px;
	border: 3px solid currentColor;
	border-radius: 10px;
	font-size: 1.6rem;
	font-weight: 800;
	background: rgb(255 255 255 / 0.85);
	transform: rotate(-8deg);
}
.swipe-up { left: 50%; translate: -50% 0; color: var(--must); }
.swipe-right { left: 16px; color: var(--gladly); }
.swipe-left { right: 16px; color: var(--reluctant); }
.swipe-down { left: 50%; translate: -50% 0; color: var(--no); }
.swipe-hint { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 4px 0; }
.swipe-buttons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding-bottom: env(safe-area-inset-bottom); }
.swipe-buttons .pref { filter: none; opacity: 1; min-height: 52px; }
.swipe-done { margin: auto 0; }

/* Admin live */
.live-play { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-candidate { border-top: 1px solid var(--border); padding-top: 6px; }
.tabs { overflow-x: auto; }
.tab { white-space: nowrap; padding-left: 8px; padding-right: 8px; }

/* Share / QR */
.share { align-items: center; text-align: center; }
.share > * { width: 100%; }
.qr { width: min(280px, 100%); aspect-ratio: 1; background: #fff; border-radius: var(--radius); padding: 4px; }
.qr svg { display: block; width: 100%; height: 100%; }
.share-url { overflow-wrap: anywhere; font-size: 0.9rem; }

/* Scores */
.segmented { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.segmented button { flex: 1; min-height: var(--tap); border: none; background: var(--surface); font-size: 0.85rem; padding: 4px 6px; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.winner-button.on { background: var(--accent-soft); border-color: var(--accent); }
.trophy { color: #d4a017; }
.score-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.score-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; min-height: var(--tap); }
.score-list li + li { border-top: 1px solid var(--border); }
.score-list li.winner { font-weight: 700; }
.score-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.score-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.score-table th, .score-table td { padding: 10px 8px; text-align: right; white-space: nowrap; }
.score-table thead th { font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.score-table tbody th, .score-table tfoot th { text-align: left; font-weight: 400; color: var(--muted); font-size: 0.85rem; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.score-table tbody tr.editable { cursor: pointer; }
.score-table tbody tr + tr { border-top: 1px solid var(--border); }
.score-table tfoot tr { border-top: 2px solid var(--text); font-weight: 700; }
.score-table tfoot th { color: var(--text); font-weight: 700; }
.score-table .winner { color: var(--accent); }
.score-input { flex-direction: row; align-items: center; gap: 12px; font-size: 1rem; }
.score-input span { flex: 1; min-width: 0; }
.score-input input { width: 8em; text-align: right; font-size: 1.1rem; }
.confirmed { display: flex; justify-content: space-between; align-items: center; color: var(--accent); }
.confirmed-icon { color: var(--accent); }
.my-plays li { align-items: center; flex-wrap: nowrap; }
.scroll-x.fade-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.scroll-x.fade-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.scroll-x.fade-left.fade-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }

/* Home: availability switch, action tiles, content pills */
.here-switch {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 16px;
	border-radius: var(--radius);
	border: 2px solid var(--border);
	background: var(--surface);
	text-align: left;
}
.here-switch.on { border-color: var(--accent); background: var(--accent-soft); }
.here-text { display: flex; flex-direction: column; min-width: 0; }
.here-text .small { color: var(--muted); }
.switch-track { flex: none; width: 52px; height: 30px; border-radius: 999px; background: var(--border); position: relative; transition: background 0.15s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.15s; }
.here-switch.on .switch-track { background: var(--accent); }
.here-switch.on .switch-thumb { transform: translateX(22px); }
.home-status { margin: 10px 2px 0; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.action-tile {
	min-height: 84px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--surface);
	font-weight: 600;
	overflow-wrap: anywhere;
}
.action-tile.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.action-icon { position: relative; font-size: 1.5rem; color: var(--accent); }
.action-tile.primary .action-icon { color: inherit; }
.action-tile:disabled { background: var(--surface); border-color: var(--border); color: var(--muted); }
.action-tile:disabled .action-icon { color: inherit; }
.action-badge { white-space: nowrap; position: absolute; top: -6px; left: 100%; margin-left: 2px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--must); color: #fff; font-size: 0.7rem; line-height: 20px; }
.home-tabs { margin-bottom: 8px; }
.home-tabs .count { opacity: 0.7; font-size: 0.85em; margin-left: 2px; }
.badge.here { background: var(--accent-soft); color: var(--accent); }

/* People: avatar + name on a soft filled background, so they never look like the outlined toggle pills. */
.player-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 4px 12px 4px 4px;
	border: none;
	border-radius: 10px;
	background: var(--surface-2);
	color: var(--text);
	font: inherit;
	max-width: 100%;
}
button.player-chip { cursor: pointer; }
.player-chip.me { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.player-chip:has(.chip-remove) { padding-right: 0; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: hsl(var(--hue) 45% 45%);
	color: #fff;
	font-weight: 700;
	font-size: 0.9rem;
}
.avatar.vote-up { background: var(--gladly); }
.avatar.vote-veto { background: var(--danger); }
.player-chip.vote-veto .player-name { text-decoration: line-through; color: var(--muted); }
.vote-chips .player-chip { min-height: 36px; font-size: 0.9rem; }
.vote-chips .avatar { width: 28px; height: 28px; font-size: 0.8rem; }

.play-time { margin: -8px 0 0; }

/* Me: stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-value { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.me h2 { margin-top: 0.5rem; }
/* One grid for all rows, so the label column fits the longest label and the bars line up. */
.rating-bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; gap: 8px 10px; font-size: 0.9rem; }
.rating-bars li { display: contents; }
.rating-label { white-space: nowrap; }
.rating-track { height: 10px; border-radius: 4px; background: var(--surface-2); }
.rating-bar { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.rating-bar.muted-bar { background: var(--muted); }
.rating-count { text-align: right; font-variant-numeric: tabular-nums; min-width: 2ch; }
a.chip { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.tag.taste-like { background: var(--accent-soft); color: var(--text); }
.tag.taste-dislike { text-decoration: line-through; }
.me-footer { margin-top: 12px; }

/* Statistiky: short ranked lists, name and value on one line with a thin bar under it */
.stats h2 { margin-top: 0.5rem; }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rank-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
a.rank-name:hover { text-decoration: underline; }
.rank-value { flex: none; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.rank-track { display: block; height: 6px; margin-top: 4px; }
.played-line { margin: 0; }
