:root {
	--bg: #0f2a1f;
	--bg2: #143628;
	--card: #1b4434;
	--card2: #22523f;
	--line: #2e6650;
	--text: #f4efe4;
	--muted: #b9c7bd;
	--gold: #f2c14e;
	--red: #d9534f;
	--accent: #e8b04a;
	--good: #4caf6d;
	--mid: #e0a53b;
	--poor: #d9534f;
	--silver: #c9d1d6;
	--bronze: #cd8a52;
	--radius: 14px;
	--bg-glow: #1f4d39;   /* soft light at the top of the page */
	--on-gold: #2a1c00;   /* text on gold buttons */
	--toast-bg: #0b1f16;
	color-scheme: dark;
}

/* Site pages (front page, login, sign-up, admin): colours taken from the Hlandblettur logo —
   denim-blue ink for surfaces, antique gold from the ornaments, parchment from the banner,
   rose red from the roses, and the banner's dark-brown lettering on gold. */
body.theme-site {
	--bg: #111925;
	--bg-glow: #25395a;
	--bg2: #18233a;
	--card: #1d2b42;
	--card2: #263852;
	--line: #34496a;
	--text: #f3e7cf;
	--muted: #b9b2a3;
	--gold: #d9ad5b;
	--accent: #a3222f;
	--red: #c2414b;
	--on-gold: #2e1d0e;
	--toast-bg: #111925;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	background: radial-gradient(circle at 50% -20%, var(--bg-glow) 0%, var(--bg) 60%) fixed, var(--bg);
	color: var(--text);
	font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	min-height: 100vh;
	-webkit-tap-highlight-color: transparent;
}
a { color: var(--gold); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { text-align: center; padding: 3rem; color: var(--muted); }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
.topbar {
	display: flex; align-items: center; gap: 10px; justify-content: space-between;
	padding: 12px 16px; max-width: 760px; margin: 0 auto;
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: .3px; }
.brand span { color: var(--gold); }
.brand-logo { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo span { color: inherit; }
.brand-logo .brand-text span { color: var(--gold); }
.brand-logo img { height: 38px; width: auto; flex: 0 0 auto; }
@media (max-width: 480px) { .brand-logo .brand-text { font-size: 1rem; } .brand-logo img { height: 32px; } }
.topbar .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.card {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px; margin-bottom: 14px;
}
.card.flat { background: var(--bg2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

button, .btn {
	appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text);
	padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
	text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
	min-height: 42px;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-danger { background: transparent; color: #ff9a96; border-color: #7a3431; }
.btn-ghost { background: transparent; }
/* Google's sign-in button guidelines: white button, dark text, the multicolour G. */
.btn-google { background: #fff; color: #1f1f1f; border-color: #747775; font-weight: 600; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: .9rem; }
.btn-block { width: 100%; }

label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
input, select, textarea {
	width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
	background: var(--bg); color: var(--text); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
/* Every checkbox is the same size, even next to a label that wraps onto several lines. */
input[type="checkbox"] {
	width: 22px; height: 22px; min-width: 22px; flex: 0 0 22px;
	padding: 0; margin: 0; accent-color: var(--gold); cursor: pointer;
}
input[type="checkbox"]:disabled { cursor: not-allowed; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.error { background: #4a1f1d; border: 1px solid #7a3431; color: #ffd0cd; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.warn { background: #4a3a14; border: 1px solid #806322; color: #ffe7b0; padding: 8px 12px; border-radius: 10px; margin-top: 6px; font-size: .9rem; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--card2); border: 1px solid var(--line); }
.pill.setup { color: #9fd3ff; }
.pill.tasting { color: var(--gold); }
.pill.revealed { color: #b6f2c4; }
.pill.finished { color: var(--muted); }

.tabs {
	display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; margin-bottom: 4px;
	scrollbar-width: none;
}
.tabs a {
	flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line);
	color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.tabs a.active { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .9rem; }

.beer { display: flex; gap: 12px; align-items: flex-start; }
.beer + .beer { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--bg2); flex: 0 0 auto; display: grid; place-items: center; font-size: 1.6rem; }
.beer .name { font-weight: 700; }
.order { font-weight: 800; color: var(--gold); min-width: 1.6em; }

.score-badge { font-weight: 800; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 10px; background: var(--bg2); min-width: 3.2em; text-align: center; }
.band-good { color: #0b2913; background: var(--good); }
.band-mid { color: #2b1d00; background: var(--mid); }
.band-poor { color: #fff; background: var(--poor); }

/* Scoring */
.score-card .photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.picker { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.picker button { padding: 0; min-height: 44px; font-size: 1rem; border-radius: 8px; }
.picker button.on { background: var(--gold); color: #2a1c00; border-color: var(--gold); }
@media (max-width: 420px) { .picker { grid-template-columns: repeat(5, 1fr); } }
.picker-desc { min-height: 1.4em; font-size: .9rem; color: var(--muted); margin-top: 4px; font-style: italic; }
.progress { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gold); transition: width .3s; }
.scale { font-size: .88rem; }
.scale ol { margin: 6px 0 0; padding-left: 1.8em; }
.scale li { margin: 2px 0; }
.navbar {
	position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
	background: rgba(15, 42, 31, .96); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: center;
	backdrop-filter: blur(6px);
}
.navbar > * { flex: 1; max-width: 240px; }

/* Leaderboard */
.lb-row { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); margin-bottom: 8px; color: inherit; text-decoration: none; }
.lb-row .rank { font-size: 1.4rem; font-weight: 900; text-align: center; }
.lb-row.top1 { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; background: linear-gradient(90deg, rgba(242,193,78,.18), var(--bg2)); }
.lb-row.top2 { border-color: var(--silver); background: linear-gradient(90deg, rgba(201,209,214,.13), var(--bg2)); }
.lb-row.top3 { border-color: var(--bronze); background: linear-gradient(90deg, rgba(205,138,82,.15), var(--bg2)); }
.top1 .rank { color: var(--gold); }
.top2 .rank { color: var(--silver); }
.top3 .rank { color: var(--bronze); }
.cats { display: flex; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.cats b { color: var(--text); font-variant-numeric: tabular-nums; }
.big-score { font-size: 1.5rem; }

/* TV mode */
.tv { min-height: 100vh; padding: 3vh 4vw; background: radial-gradient(circle at 50% 0%, #24573f 0%, #0a1f16 70%); }
.tv h1 { font-size: 4vw; text-align: center; margin-bottom: 3vh; }
.tv .lb-row { font-size: 2vw; padding: 1.4vh 1.6vw; grid-template-columns: 3em 1fr auto; }
.tv .lb-row .rank { font-size: 3vw; }
.tv .big-score { font-size: 3vw; }
.tv .cats { font-size: 1.3vw; }
.tv-controls { position: fixed; top: 10px; right: 10px; display: flex; gap: 8px; opacity: .25; transition: opacity .2s; }
.tv-controls:hover { opacity: 1; }
@media (max-width: 700px) {
	.tv h1 { font-size: 1.8rem; }
	.tv .lb-row { font-size: 1rem; }
	.tv .lb-row .rank, .tv .big-score { font-size: 1.4rem; }
	.tv .cats { font-size: .8rem; }
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: var(--bg2); border-radius: 12px; padding: 10px; text-align: center; border: 1px solid var(--line); }
.stat .v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .78rem; color: var(--muted); }

.award { display: flex; gap: 12px; align-items: flex-start; }
.award .icon { font-size: 2rem; line-height: 1; }

/* Sortable */
.sortable-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.sortable-item.dragging { opacity: .9; box-shadow: 0 8px 24px rgba(0,0,0,.4); border-color: var(--gold); position: relative; z-index: 2; }
.handle { cursor: grab; touch-action: none; user-select: none; font-size: 1.3rem; padding: 4px 6px; color: var(--muted); }

.qr { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; line-height: 0; }
.qr svg, .qr img { width: 180px; height: 180px; }
.code-big { font-size: 2.2rem; font-weight: 900; letter-spacing: .2em; color: var(--gold); font-variant-numeric: tabular-nums; }

.avatar { width: 1.6em; height: 1.6em; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 6px; border: 1px solid var(--line); }
.avatar-preview { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 1.8rem; flex: 0 0 auto; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .modes { grid-template-columns: 1fr; } }
.mode { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg2); cursor: pointer; font-weight: 400; margin: 0; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode.on { border-color: var(--gold); background: rgba(242, 193, 78, .1); }
.mode.disabled { cursor: not-allowed; opacity: .7; }
.mode:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.mode-title { font-weight: 800; font-size: 1.05rem; }
.mode-desc { font-size: .85rem; color: var(--muted); }
/* Site front page */
.hero { text-align: center; padding: 20px 0 20px; }
.hero-logo { width: 170px; height: auto; display: block; margin: 0 auto 6px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
/* Site theme: a classic serif title like the logo's lettering, and a gold–rose ornament under it. */
.theme-site .hero h1 { font-family: Georgia, "Times New Roman", serif; font-size: 2.5rem; letter-spacing: .5px; color: var(--text); text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.theme-site .hero p { font-style: italic; }
.theme-site .hero::after {
	content: ""; display: block; width: 180px; height: 10px; margin: 14px auto 0;
	background:
		radial-gradient(circle, var(--accent) 0 3px, transparent 4px) center / 10px 10px no-repeat,
		linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent) center / 100% 1px no-repeat;
}
.theme-site .brand { font-family: Georgia, "Times New Roman", serif; letter-spacing: .4px; }
.theme-site .project-card { background: linear-gradient(180deg, var(--card2), var(--card)); border-color: var(--line); }
.theme-site a.project-card:hover, .theme-site a.project-card:focus-visible { border-color: var(--gold); box-shadow: 0 8px 26px rgba(163, 34, 47, .22); }
.theme-site .project-card.soon { background: transparent; border-color: rgba(217, 173, 91, .35); }
.theme-site .card { border-color: var(--line); }
.theme-site h1, .theme-site h2 { color: var(--text); }
.project-logo { width: 86px; height: auto; }
.card-logo { width: 96px; height: auto; flex: 0 0 auto; }
@media (max-width: 480px) { .card-logo { width: 72px; } }
.hero h1 { font-size: 2.4rem; margin-bottom: 6px; letter-spacing: .5px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.project-card {
	display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
	color: inherit; text-decoration: none; transition: border-color .15s, transform .15s;
}
a.project-card:hover, a.project-card:focus-visible { border-color: var(--gold); transform: translateY(-2px); }
.project-card h2 { margin: 0; }
.project-card p { margin: 0 0 8px; flex: 1; }
.project-card.soon { border-style: dashed; background: transparent; opacity: .75; }
.project-icon { font-size: 2.2rem; line-height: 1; }
/* Wish lists */
.wish-row { display: grid; grid-template-columns: 1.6em 1.4fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.wish-move { display: inline-flex; gap: 2px; }
@media (max-width: 520px) { .wish-row { grid-template-columns: 1.6em 1fr auto; } .wish-row input[name=brewery] { grid-column: 2; grid-row: 2; } }
.member-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.member-list .check { display: flex; padding: 4px 0; }
.card.invited { border-color: var(--gold); }
.clash { padding: 8px 0; border-top: 1px solid var(--line); }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; }
.avatars button { font-size: 1.4rem; min-height: 44px; width: 48px; padding: 0; }
.avatars button.on { border-color: var(--gold); background: rgba(242,193,78,.25); }

#toast {
	position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
	background: var(--toast-bg); border: 1px solid var(--gold); color: var(--text); padding: 10px 16px; border-radius: 999px;
	opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); }
