/* Jólakapphlaupið – jólaþema */
:root {
  --night: #0b1f33;
  --night2: #12304c;
  --red: #c8102e;
  --red-d: #8e0b20;
  --green: #17803d;
  --green-d: #0f5a2b;
  --gold: #f6c343;
  --gold-d: #b98a12;
  --cream: #fff8ec;
  --paper: #fffdf6;
  --ink: #2b1b17;
  --muted: #6b5b55;
  --shadow: 0 4px 0 var(--ink);
  --radius: 18px;
  --candy: repeating-linear-gradient(-45deg, #c8102e 0 9px, #fff 9px 18px);
  --candy-g: repeating-linear-gradient(-45deg, #17803d 0 9px, #fff 9px 18px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 6%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 22%, #fff 50%, transparent 51%),
    radial-gradient(ellipse at 50% -20%, #2c5d86 0%, var(--night2) 40%, var(--night) 75%, #060f1a 100%) fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body::after { /* snjóþaktar hæðir neðst */
  content: ""; position: fixed; left: -10%; right: -10%; bottom: -40px; height: 160px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 40% 70px at 20% 100%, #f4f9ff 98%, transparent 100%),
    radial-gradient(ellipse 45% 90px at 75% 100%, #e3eefa 98%, transparent 100%);
}
body[data-screen="screen-game"]::after { display: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.error { color: var(--red); min-height: 1.2em; margin: 0.4rem 0 0; text-align: center; font-weight: 800; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin: 0.5rem 0; }

/* snjókoma í þremur lögum */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.snow i {
  position: absolute; inset: -200px 0 0 0;
  background-image:
    radial-gradient(3px 3px at 20px 30px, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 90px 140px, #fff 50%, transparent 52%),
    radial-gradient(3px 3px at 170px 70px, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 230px 180px, #fff 50%, transparent 52%),
    radial-gradient(4px 4px at 280px 20px, #fff 50%, transparent 52%);
  background-size: 300px 200px;
  animation: snowfall 14s linear infinite;
  opacity: 0.75;
}
.snow i:nth-child(2) { background-size: 220px 160px; animation-duration: 22s; opacity: 0.45; filter: blur(0.5px); }
.snow i:nth-child(3) { background-size: 420px 260px; animation-duration: 10s; opacity: 0.9; }
@keyframes snowfall { to { transform: translate3d(40px, 200px, 0); } }
body[data-screen="screen-game"] .snow { display: none; }

/* hnappar: saumaðir eins og jólasokkur */
.btn {
  position: relative; font: inherit; font-weight: 800; font-size: 1rem;
  border: 3px solid var(--ink); border-radius: 14px;
  background: #fff; color: var(--ink);
  padding: 0.6rem 1rem; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
}
.btn::after {
  content: ""; position: absolute; inset: 3px; border-radius: 9px; pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.55);
}
.btn:not(.btn-red):not(.btn-green)::after { border-color: rgba(43, 27, 23, 0.14); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-red { background: linear-gradient(#e0243f, var(--red)); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn-green { background: linear-gradient(#1f9a4c, var(--green)); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn-gold { background: linear-gradient(#ffe089, var(--gold)); }
.btn-big { font-size: 1.2rem; padding: 0.85rem 1.2rem; width: 100%; margin: 0.4rem 0; }
.btn-small { font-size: 0.85rem; padding: 0.35rem 0.75rem; box-shadow: 0 2px 0 var(--ink); border-width: 2px; }
.btn-small::after { display: none; }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; box-shadow: none; }
.btn.ghost::after { display: none; }
.btn.round { width: 2.8rem; height: 2.8rem; padding: 0; border-radius: 50%; font-size: 1.4rem; }
.btn.round::after { display: none; }
.input {
  font: inherit; font-size: 1.1rem; width: 100%;
  border: 3px solid var(--ink); border-radius: 12px; padding: 0.6rem 0.8rem; background: #fff;
}
.input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.label { display: block; font-weight: 800; margin: 0.8rem 0 0.35rem; }

/* skjáir */
.screen { position: relative; z-index: 1; }
.center-screen {
  min-height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: 1.2rem 1rem 6rem; gap: 1.1rem;
}
.back-link { align-self: flex-start; color: #d9ecfb; text-decoration: none; font-weight: 800; }
.back-link.small { color: #fff; font-size: 1.3rem; }
.logo {
  position: relative; font-family: "Lilita One", cursive; font-weight: 400; margin: 1.2rem 0 0;
  font-size: clamp(2.6rem, 11vw, 4.3rem); color: var(--red); line-height: 0.95;
  text-shadow: 0 3px 0 #fff, 3px 6px 0 var(--ink); text-align: center;
  transform: rotate(-2deg);
}
.logo > span:not(.hat) { color: #1f9a4c; display: block; font-size: 0.72em; }
.logo .hat {
  position: absolute; left: -0.18em; top: -0.36em; width: 0.8em; height: 0.66em; transform: rotate(-22deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 50'%3E%3Cpath d='M6 40 C10 14 34 2 52 16 L46 22 C38 14 24 20 22 40 Z' fill='%23c8102e' stroke='%232b1b17' stroke-width='3'/%3E%3Crect x='2' y='36' width='34' height='11' rx='5.5' fill='%23fff' stroke='%232b1b17' stroke-width='3'/%3E%3Ccircle cx='51' cy='20' r='6' fill='%23fff' stroke='%232b1b17' stroke-width='3'/%3E%3C/svg%3E") no-repeat center/contain;
}
.logo.small { font-size: clamp(1.9rem, 7.5vw, 2.7rem); }
.tagline { color: #e6f2fb; text-align: center; margin: 0; max-width: 26rem; }

/* spjöld: jólastafsrammi með snjó ofan á */
.card {
  position: relative; width: 100%; max-width: 440px; padding: 1.2rem 1.1rem 1.1rem;
  border: 7px solid transparent; border-radius: 22px;
  background: linear-gradient(var(--paper), var(--cream)) padding-box, var(--candy) border-box;
  box-shadow: 0 0 0 3px var(--ink), 0 9px 0 3px var(--ink);
}
.card::before {
  content: ""; position: absolute; left: 6%; right: 6%; top: -19px; height: 22px; pointer-events: none;
  background:
    radial-gradient(circle at 50% 100%, #fff 68%, transparent 70%) 0 0 / 34px 100% repeat-x,
    linear-gradient(#fff, #fff) 0 80% / 100% 40% no-repeat;
  border-radius: 14px 14px 4px 4px;
  filter: drop-shadow(0 2px 0 rgba(43, 27, 23, 0.35));
}
.or { text-align: center; color: var(--muted); margin: 0.5rem 0; }
.code-form { display: flex; gap: 0.5rem; }
.code-form .btn { white-space: nowrap; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 800; }
.how summary { font-weight: 800; cursor: pointer; }
.how ul { padding-left: 1.2rem; margin: 0.6rem 0 0; line-height: 1.55; }
.code-pill { background: var(--gold); border: 2px solid var(--ink); border-radius: 8px; padding: 0 0.4rem; letter-spacing: 0.15em; }
.big-code {
  font-family: "Lilita One", cursive; font-size: 3.4rem; text-align: center; letter-spacing: 0.25em;
  color: var(--red); text-shadow: 2px 3px 0 var(--ink); margin: 0.1rem 0;
}

/* fígúrur */
.figure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 0.45rem; }
.figure-btn {
  font-size: 1.8rem; aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 50%; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, #f3ece0 70%);
}
.figure-btn.selected { background: radial-gradient(circle at 35% 30%, #fff6c9 0 20%, var(--gold) 75%); transform: scale(1.1); box-shadow: 0 3px 0 var(--ink); }
.figure-btn.taken { opacity: 0.22; pointer-events: none; }

/* merkimiðar (lobby og listar) */
.lobby-players { list-style: none; padding: 0; margin: 0.8rem 0; display: grid; gap: 0.45rem; }
.lobby-players li, .plist li {
  position: relative; display: flex; align-items: center; gap: 0.5rem; background: #fff;
  border: 2px solid var(--ink); border-left: 9px solid var(--pc, var(--red)); border-radius: 6px 14px 14px 6px;
  padding: 0.35rem 0.65rem 0.35rem 0.9rem;
}
.lobby-players li::before, .plist li::before { /* gatið á merkimiðanum */
  content: ""; position: absolute; left: 0.2rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--cream); border: 1.5px solid var(--ink);
}
.lobby-players li:nth-child(4n+2) { --pc: var(--green); }
.lobby-players li:nth-child(4n+3) { --pc: var(--gold); }
.lobby-players li:nth-child(4n+4) { --pc: #3a86ff; }
.lobby-players li.offline { opacity: 0.5; }
.lp-fig { font-size: 1.6rem; }
.lp-name { flex: 1; font-weight: 800; }
.badge { font-size: 0.75rem; background: #f3ead6; border-radius: 8px; padding: 0.1rem 0.4rem; }
.lobby-players .x { border: 0; background: none; font-size: 1rem; cursor: pointer; }

/* ================= leikskjár ================= */
.game { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.topbar {
  position: relative; z-index: 3; display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.8rem 0.55rem; color: #fff;
  border-bottom: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 6px, transparent 6px 24px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 6px, transparent 6px 24px),
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(255,214,80,.35) 11px 13px, transparent 13px 24px),
    var(--red);
}
.top-title { font-family: "Lilita One", cursive; font-size: 1.3rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 2px 2px 0 var(--ink); }
.round-pill { background: var(--cream); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 0.1rem 0.75rem; font-size: 0.9rem; white-space: nowrap; box-shadow: 0 2px 0 var(--ink); }
.topbar .btn.ghost { color: #fff; }

/* jólasería undir toppnum */
.garland {
  position: absolute; z-index: 4; left: 0; right: 0; top: 46px; height: 22px; pointer-events: none;
  background: radial-gradient(ellipse 50% 9px at 50% 0, transparent 92%, #1e3b1e 93%, #1e3b1e 100%, transparent 101%) 0 0 / 60px 12px repeat-x;
}
.garland::before, .garland::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(5px 7px at 15px 12px, #ff4d5e 60%, transparent 66%),
    radial-gradient(5px 7px at 45px 12px, #ffd23f 60%, transparent 66%);
  background-size: 60px 22px;
  filter: drop-shadow(0 0 4px rgba(255, 220, 120, 0.9));
  animation: blink 1.6s steps(1) infinite;
}
.garland::after {
  background:
    radial-gradient(5px 7px at 30px 14px, #4dd2ff 60%, transparent 66%),
    radial-gradient(5px 7px at 0px 14px, #5cff8f 60%, transparent 66%);
  background-size: 60px 22px;
  animation-delay: 0.8s;
}
@keyframes blink { 50% { opacity: 0.35; } }

.game-main { flex: 1; min-height: 0; display: flex; }
.board-view {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background: #dfeaf5; cursor: grab;
  border-right: 3px solid var(--ink);
}
.board-view:active { cursor: grabbing; }
.board-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#board { display: block; }
.board-hud { position: absolute; z-index: 5; top: 1.6rem; left: 0.5rem; right: 0.5rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; pointer-events: none; }
.board-hud > * { pointer-events: auto; }
.turn-line {
  background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.95rem;
  box-shadow: 0 3px 0 var(--ink); max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.turn-line:empty { display: none; }
.cam-btns { display: flex; flex-direction: column; gap: 0.35rem; margin-left: auto; }
.cam-btn {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--ink); font-size: 1.15rem; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff 0 25%, #f1e8d6 75%); box-shadow: 0 3px 0 var(--ink); padding: 0;
}
.cam-btn:active { transform: translateY(3px); box-shadow: none; }
.minimap {
  position: absolute; z-index: 5; left: 0.5rem; bottom: 0.5rem; width: 70px; height: 98px; cursor: pointer;
  border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink); background: #fff;
}
.mm-bg { fill: #eef5fb; }
.mm-lm { fill: #d6e8f6; }
.mm-road { stroke: #c8102e; stroke-width: 2.6; stroke-linecap: round; }
.mm-dot { stroke: #fff; stroke-width: 1.2; }
.mm-me { stroke: var(--ink); stroke-width: 2; }
.mm-sled { font-size: 9px; text-anchor: middle; }
.mm-view { fill: rgba(246, 195, 67, 0.18); stroke: var(--ink); stroke-width: 2; }
.drag-hint {
  position: absolute; z-index: 5; left: 50%; bottom: 0.7rem; transform: translateX(-50%); margin: 0; pointer-events: none;
  background: rgba(43, 27, 23, 0.8); color: #fff; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.85rem; white-space: nowrap;
  animation: fadeout 1s 6s forwards;
}
@keyframes fadeout { to { opacity: 0; visibility: hidden; } }

.side {
  width: 370px; flex-shrink: 0; overflow-y: auto; padding: 1.4rem 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.7rem;
  background: linear-gradient(#173a5a, #0d2238);
}
.action {
  position: relative; text-align: center; min-height: 3.5rem; padding: 0.8rem 0.8rem 0.7rem;
  border: 6px solid transparent; border-radius: 18px;
  background: linear-gradient(var(--paper), var(--cream)) padding-box, var(--candy-g) border-box;
  box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink);
}
.action::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: -15px; height: 16px; pointer-events: none;
  background: radial-gradient(circle at 50% 100%, #fff 68%, transparent 70%) 0 0 / 28px 100% repeat-x, linear-gradient(#fff, #fff) 0 80% / 100% 40% no-repeat;
  border-radius: 12px 12px 3px 3px;
}
.action:empty { display: none; }
.act-title { font-family: "Lilita One", cursive; font-size: 1.3rem; margin: 0.1rem 0 0.4rem; color: var(--red-d); }
.act-note { margin: 0.3rem 0; color: var(--muted); font-size: 0.9rem; }
.act-wait { margin: 0.3rem 0; }
.items-row, .route-row { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin: 0.4rem 0; }
.route-row .btn { flex: 1; min-width: 8rem; }
.roll-btn { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }

.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.plist li { font-size: 0.95rem; cursor: pointer; }
.plist li.cur { background: linear-gradient(#fff3c2, #ffe28a); }
.plist li.mine .pl-name { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--red); }
.plist li.offline { opacity: 0.5; }
.pl-fig { font-size: 1.3rem; }
.pl-name { flex: 1; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-gifts, .pl-cookies { font-weight: 800; white-space: nowrap; }
.pl-gifts { min-width: 2.6rem; }
.pl-cookies { min-width: 3rem; text-align: right; }
.log-wrap { color: #d7e9f7; background: rgba(255,255,255,.07); border-radius: 12px; padding: 0.4rem 0.7rem; }
.log-wrap summary { cursor: pointer; font-weight: 800; }
.log { list-style: none; margin: 0.3rem 0 0; padding: 0; font-size: 0.85rem; }
.log li { padding: 0.15rem 0; border-bottom: 1px dashed rgba(255,255,255,.12); }
.log li:first-child { color: #fff; font-weight: 800; }
.log li:last-child { border-bottom: 0; }

/* kortið */
.shadow { fill: rgba(30, 50, 80, 0.16); }
.sparkles circle { fill: #fff; opacity: 0.9; }
.drifts ellipse { fill: #fff; opacity: 0.85; }
.window { fill: #ffd76a; stroke: #5a3a1a; stroke-width: 0.25; }
.road-edge { stroke: #7a1622; stroke-width: 4.1; stroke-linecap: round; }
.road-base { stroke: #fff; stroke-width: 3.3; stroke-linecap: round; }
.road-stripe { stroke: #d6233d; stroke-width: 3.3; stroke-dasharray: 1 1.15; }
.road-stripe.green { stroke: #1d8a45; }
.road-arrow { fill: none; stroke: rgba(43, 27, 23, 0.32); stroke-width: 0.35; stroke-linecap: round; stroke-linejoin: round; }
.sign-board { fill: #8b5a2b; stroke: #4a2c12; stroke-width: 0.35; }
.sign-snow { fill: #fff; }
.sign-text { font-size: 2.2px; font-weight: 800; text-anchor: middle; fill: #fff; font-family: "Nunito", sans-serif; }
.lm-emoji { font-size: 4px; text-anchor: middle; dominant-baseline: middle; }
.lm-emoji.sm { font-size: 2.4px; }
.lm-emoji.skater { font-size: 3.6px; animation: skate 6s ease-in-out infinite; transform-box: fill-box; }
@keyframes skate { 50% { transform: translate(8px, -2px); } }
.ornament { stroke: rgba(0,0,0,.25); stroke-width: 0.15; }
.star { filter: drop-shadow(0 0 0.8px #ffe066); animation: twinkle 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes twinkle { 50% { transform: scale(1.15); } }
.smoke circle, .steam circle { fill: rgba(240, 240, 245, 0.85); animation: puff 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.steam circle { fill: rgba(140, 230, 120, 0.7); }
@keyframes puff { from { transform: translateY(0) scale(0.6); opacity: 0.9; } to { transform: translateY(-3px) scale(1.4); opacity: 0; } }
.eye { fill: #ffd23f; animation: eyes 4s infinite; }
@keyframes eyes { 0%, 92%, 100% { opacity: 1; } 95% { opacity: 0; } }
.node-c { stroke: #fff; stroke-width: 0.55; }
.node-in { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 0.25; }
.node > .node-c { filter: drop-shadow(0 0.35px 0 #2b1b17); }
.node-i { font-size: 2.7px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.node-i.flake { font-size: 2.4px; fill: #fff; font-weight: 800; }
.junction { fill: rgba(246, 195, 67, 0.25); stroke: var(--gold-d); stroke-width: 0.4; stroke-dasharray: 1.1 0.7; }
.node.choice { cursor: pointer; }
.node.choice .node-c { stroke: var(--gold); stroke-width: 1; animation: glow 0.8s ease-in-out infinite alternate; }
@keyframes glow { to { stroke-width: 1.8; } }
.sled-ring { fill: rgba(246, 195, 67, 0.3); stroke: var(--gold-d); stroke-width: 0.5; stroke-dasharray: 1.4 0.9; animation: spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.sled-emoji { font-size: 4.6px; text-anchor: middle; }
.sled-gift { font-size: 3px; text-anchor: middle; }
.price-tag { fill: var(--gold); stroke: var(--ink); stroke-width: 0.3; }
.price-text { font-size: 1.9px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.fig-in { transform-box: fill-box; }
.fig.cur .fig-in { animation: hop 0.9s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-0.8px); } }
.fig-disc { fill: #fff; stroke-width: 0.6; }
.fig-e { font-size: 3.4px; text-anchor: middle; dominant-baseline: middle; }
.fig-ring { fill: rgba(255, 255, 255, 0.5); stroke: var(--red); stroke-width: 0.5; stroke-dasharray: 1 0.6; animation: spin 4s linear infinite; transform-box: fill-box; transform-origin: center; }
.fig.mine .fig-disc { stroke-width: 0.9; }
.fig-tag { fill: var(--cream); stroke: var(--ink); stroke-width: 0.25; }
.fig-tag.cur { fill: var(--gold); }
.fig-tag-t { font-size: 1.5px; font-weight: 800; text-anchor: middle; fill: var(--ink); font-family: "Nunito", sans-serif; }

/* teningur: jólakúla */
.dice {
  position: absolute; z-index: 8; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 25%, #fff 0 12%, var(--cream) 60%); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 0 0 5px var(--gold), 0 0 0 8px var(--ink), 0 12px 0 8px var(--ink);
  padding: 0.7rem 1.2rem; text-align: center; animation: pop 0.2s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(0.6); } }
.dice-who { font-weight: 800; margin-bottom: 0.3rem; }
.dice-row { display: flex; align-items: center; gap: 0.5rem; justify-content: center; }
.die {
  width: 3.6rem; height: 3.6rem; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; color: var(--red);
}
.die.rolling { animation: wob 0.14s linear infinite; }
@keyframes wob { 50% { transform: rotate(12deg); } }
.die-sum { font-family: "Lilita One", cursive; font-size: 2rem; }

/* ================= smáleikir ================= */
.mg {
  position: fixed; inset: 0; z-index: 20; background: rgba(6, 16, 26, 0.74);
  display: flex; align-items: center; justify-content: center; padding: 0.8rem;
  backdrop-filter: blur(2px);
}
.mg-card {
  width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column;
  border: 7px solid transparent; border-radius: 24px;
  background: linear-gradient(var(--paper), var(--cream)) padding-box, var(--candy) border-box;
  box-shadow: 0 0 0 3px var(--ink), 0 9px 0 3px var(--ink);
}
.mg-head {
  padding: 0.7rem 1rem 0.6rem; border-bottom: 3px solid var(--ink); color: #fff;
  border-radius: 16px 16px 0 0; text-align: center; position: sticky; top: 0; z-index: 2;
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 70% 60%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 45% 80%, #fff 50%, transparent 52%),
    linear-gradient(#1f9a4c, var(--green-d));
  background-size: 60px 40px, 70px 50px, 50px 40px, auto;
}
.mg-head h2 { font-family: "Lilita One", cursive; font-weight: 400; margin: 0.25rem 0 0; font-size: 1.6rem; text-shadow: 2px 2px 0 var(--ink); }
.mg-body { padding: 0.9rem 1rem; text-align: center; }
.mg-body p { margin: 0.5rem 0; }
.mg-foot { padding: 0 1rem 0.8rem; text-align: center; }
.mg-foot .btn.ghost { color: var(--muted); }
.cat {
  display: inline-block; font-size: 0.75rem; font-weight: 800; padding: 0.1rem 0.55rem; border-radius: 999px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink);
}
.cat-tal { background: #ffcad4; }
.cat-hradi { background: #ffe066; }
.cat-minni { background: #b8e0ff; }
.cat-bluff { background: #d7c4ff; }
.mg-options { display: grid; gap: 0.7rem; margin: 0.6rem 0; }
.mg-opt {
  font: inherit; text-align: left; border: 3px solid var(--ink); border-left-width: 10px; border-radius: 8px 16px 16px 8px; background: #fff;
  padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 0.25rem; cursor: pointer; box-shadow: 0 4px 0 var(--ink);
}
.mg-opt:nth-child(1) { border-left-color: var(--red); }
.mg-opt:nth-child(2) { border-left-color: var(--green); }
.mg-opt:nth-child(3) { border-left-color: var(--gold); }
.mg-opt b { font-size: 1.15rem; }
.mg-opt small { color: var(--muted); line-height: 1.3; }
.mg-opt .cat { align-self: flex-start; }
.mg-opt:disabled { cursor: default; opacity: 0.85; }
.mg-opt:not(:disabled):hover { background: #fffbe0; }
.mg-rules { text-align: left; background: #fff; border: 2px dashed #d3c2a0; border-radius: 12px; padding: 0.4rem 0.9rem; margin-bottom: 0.6rem; }
.mg-rules h3 { margin: 0.6rem 0 0.1rem; font-size: 1rem; }
.mg-rules p { margin: 0.2rem 0 0.4rem; line-height: 1.4; }
.mg-role { font-weight: 800; color: var(--red-d); }
.mg-play .mg-role { background: #fff3c4; border: 2px solid var(--ink); border-radius: 10px; padding: 0.3rem 0.6rem; margin: 0 0 0.5rem; }
.mg-auto { background: #fff3c4; border-radius: 10px; padding: 0.4rem; }
.mg-play { position: relative; }
.countdown {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(255, 248, 236, 0.93);
  font-family: "Lilita One", cursive; font-size: 5rem; color: var(--red); text-shadow: 3px 3px 0 var(--ink); border-radius: 12px;
  min-height: 10rem;
}
.result-banner { font-size: 3rem; margin: 0.2rem 0; }
.result-banner.none { opacity: 0.6; }
.result-reason { font-weight: 800; font-size: 1.1rem; }
.payouts { list-style: none; padding: 0; margin: 0.6rem 0; display: grid; gap: 0.3rem; }
.payouts li { display: flex; justify-content: space-between; background: #fff; border: 2px solid #ddd0b8; border-radius: 10px; padding: 0.3rem 0.7rem; }
.payouts li.won { border-color: var(--ink); background: #e6f8ec; }
.payouts li.won b { color: var(--green-d); }
.result-lines { text-align: left; font-size: 0.9rem; margin: 0.4rem 0; }
.result-lines ul { margin: 0.3rem 0; padding-left: 1.2rem; }

/* sameiginlegt í leikjum */
.g-timer {
  display: inline-block; font-weight: 800; background: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: 0.1rem 0.8rem; margin-bottom: 0.5rem;
}
.g-timer.urgent { background: var(--red); color: #fff; animation: pulse 0.6s infinite; }
.g-wait { font-weight: 800; color: var(--green-d); }
.g-status { font-weight: 800; color: var(--green-d); min-height: 1.2em; margin: 0.4rem 0 0; }
.g-feedback { font-weight: 800; color: var(--red-d); min-height: 1.2em; }
.big-emoji { font-size: 3rem; line-height: 1.1; }
.secret-card {
  background: #1d2b3a; color: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 0.8rem; margin: 0.4rem 0 0.7rem;
}
.secret-label { font-size: 0.8rem; color: var(--gold); font-weight: 800; }
.secret-title { font-family: "Lilita One", cursive; font-size: 2rem; margin: 0.3rem 0; }
.secret-text { opacity: 0.9; }
.ban-list { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; align-items: center; }
.ban-list span { background: var(--red); border-radius: 8px; padding: 0.1rem 0.45rem; }
.guess-card, .gift-card, .bowl-card, .auc-item, .q-card {
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 0.8rem; margin: 0.4rem 0;
}
.guess-title, .gift-name { font-family: "Lilita One", cursive; font-size: 1.6rem; }
.bowl-card.yes { background: #fff3c4; }
.q-big { font-family: "Lilita One", cursive; font-size: 1.45rem; line-height: 1.2; margin: 0.4rem 0; }
.pick-box { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 0.6rem; margin: 0.5rem 0; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.4rem; margin: 0.4rem 0; }
.pbtn {
  font: inherit; font-weight: 800; display: flex; align-items: center; gap: 0.4rem; justify-content: center;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--cream); padding: 0.5rem; cursor: pointer; box-shadow: 0 2px 0 var(--ink);
}
.pbtn:active { transform: translateY(2px); box-shadow: none; }
.pf { font-size: 1.4rem; }
.speaker { display: flex; align-items: center; gap: 0.7rem; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 0.6rem; margin: 0.5rem 0; text-align: left; }
.speaker.me { background: #fff3c4; }
.speaker-fig { font-size: 2.4rem; }
.chain-count { font-size: 1.2rem; }
.flag-box { background: #ffe1e1; border: 2px solid var(--red); border-radius: 12px; padding: 0.5rem; margin: 0.5rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin: 0.5rem 0; }
.chip { background: #fff; border: 2px solid #cfc5b2; border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.9rem; }
.chip.on { border-color: var(--ink); background: var(--gold); }
.chip.out { opacity: 0.4; text-decoration: line-through; }
.chip-btn { font: inherit; font-weight: 800; border: 2px solid var(--ink); border-radius: 999px; background: #fff; padding: 0.3rem 0.7rem; cursor: pointer; }
.chip-btn.on { background: var(--green); color: #fff; }

/* 7 dagatal */
.calendar {
  font: inherit; width: 100%; max-width: 280px; aspect-ratio: 1; margin: 0.5rem auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); cursor: pointer; touch-action: manipulation; user-select: none;
}
.cal-month { background: var(--red); color: #fff; width: 100%; font-weight: 800; letter-spacing: 0.2em; padding: 0.3rem; margin-top: -0.2rem; }
.cal-day { font-family: "Lilita One", cursive; font-size: 6rem; line-height: 1.1; }
.cal-hint { color: var(--muted); font-size: 0.85rem; }
.calendar.xmas { background: #e6f8ec; }
.calendar.xmas .cal-day { color: var(--green); }
.calendar.fail { background: #ffe1e1; }

/* 8 og fleiri: leiksvæði */
.arena { position: relative; height: min(55vh, 440px); background: linear-gradient(#1b3550, #3a6a8f); border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; touch-action: none; }
.arena canvas { width: 100%; height: 100%; display: block; }
.arena-hud { position: absolute; top: 0.4rem; right: 0.5rem; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 0.05rem 0.6rem; font-weight: 800; z-index: 3; }

/* 9 sería */
.lights-prog { font-weight: 800; margin-bottom: 0.5rem; }
.bulbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; max-width: 280px; margin: 0 auto; }
.bulb {
  aspect-ratio: 1; border-radius: 50% 50% 45% 45%; border: 3px solid var(--ink); background: #3a3a44; cursor: pointer; touch-action: manipulation;
}
.bulb.on { background: hsl(var(--hue), 90%, 60%); box-shadow: 0 0 18px hsl(var(--hue), 90%, 60%); }

/* 10 pakkaflóð */
.flood { position: relative; height: min(55vh, 420px); background: #eef6fd; border: 3px solid var(--ink); border-radius: 14px; touch-action: none; user-select: none; overflow: hidden; }
.dest { position: absolute; font-weight: 800; font-size: 0.85rem; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 0.2rem 0.45rem; }
.dest-up { top: 0.4rem; left: 50%; transform: translateX(-50%); }
.dest-down { bottom: 0.4rem; left: 50%; transform: translateX(-50%); }
.dest-left { left: 0.3rem; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; rotate: 180deg; }
.dest-right { right: 0.3rem; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; }
.flood .arena-hud { top: 0.4rem; right: 0.4rem; left: auto; }
.parcel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; transition: transform 0.16s ease-in, opacity 0.16s; }
.parcel-box { font-size: 4rem; }
.parcel-tag { background: var(--gold); border: 2px solid var(--ink); border-radius: 8px; padding: 0.1rem 0.5rem; font-weight: 800; white-space: nowrap; }
.parcel.fly-up { transform: translate(-50%, -250%); opacity: 0; }
.parcel.fly-down { transform: translate(-50%, 150%); opacity: 0; }
.parcel.fly-left { transform: translate(-250%, -50%); opacity: 0; }
.parcel.fly-right { transform: translate(150%, -50%); opacity: 0; }
.parcel.shake { animation: shake 0.16s linear; }
@keyframes shake { 25% { margin-left: -8px; } 75% { margin-left: 8px; } }

/* 11 sleði */
.track { position: relative; height: 4.2rem; background: linear-gradient(#fff 60%, #dbe9f4); border: 3px solid var(--ink); border-radius: 14px; margin: 0.6rem 0; overflow: hidden; }
.track .tree, .track .sled { position: absolute; bottom: 0.3rem; font-size: 2.4rem; transform: translateX(-10%); }
.power { height: 1.1rem; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; margin: 0.5rem 0; }
.power-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); }
.hold { user-select: none; touch-action: none; -webkit-user-select: none; }

/* 12 grautur */
.porridge { position: relative; }
.bowl {
  position: relative; width: min(80vw, 300px); aspect-ratio: 1; margin: 0.5rem auto; border-radius: 50%;
  background: radial-gradient(circle, #fff6e0 0 55%, #f1dfb8 70%, #c98c3a 71% 78%, #8b5a2b 79%); border: 4px solid var(--ink);
  touch-action: none; overflow: hidden;
}
.spoon { position: absolute; left: 50%; top: 50%; font-size: 2.6rem; margin: -1.3rem 0 0 -1.3rem; pointer-events: none; }
.almond { position: absolute; font-size: 2rem; transform: translate(-50%, -50%); border: 0; background: none; cursor: pointer; padding: 0.3rem; animation: pop2 0.2s ease-out; }
@keyframes pop2 { from { transform: translate(-50%, -50%) scale(0.2); } }
.almond.sink { transition: opacity 0.25s, transform 0.25s; opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
.porridge .arena-hud { position: static; display: inline-block; }

/* 13–18 þrautir */
.box-items { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; background: #f7e3c3; border: 3px solid var(--ink); border-radius: 14px; padding: 0.6rem; margin: 0.4rem 0; }
.box-items span { font-size: 2.3rem; }
.box-items.closed { background: #fff; }
.box-label { width: 100%; font-weight: 800; margin-bottom: 0.2rem; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; margin: 0.5rem 0; }
.emoji-opts { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.emoji-opts .opt { font-size: 1.8rem; padding: 0.4rem; }
.wish { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 0.6rem; background-image: repeating-linear-gradient(#fff 0 2.3rem, #dbe9f4 2.3rem 2.4rem); }
.wish-row { font-size: 1.8rem; display: flex; align-items: center; gap: 0.6rem; justify-content: center; }
.wish-row b { font-size: 1.1rem; }
.wish-out { display: flex; gap: 0.4rem; justify-content: center; margin: 0.4rem 0; }
.slot { width: 3.2rem; height: 3.2rem; display: grid; place-items: center; font-size: 1.8rem; border: 3px dashed var(--ink); border-radius: 12px; background: #fff; color: var(--muted); }
.wires svg { width: 100%; max-width: 300px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.clues { text-align: left; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 0.5rem 0.8rem; }
.clues ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.owners { display: grid; gap: 0.4rem; margin: 0.6rem 0; }
.owner-row { display: flex; flex-direction: column; gap: 0.25rem; }
.owner-row .chips { margin: 0; }
.house-svg { width: 100%; max-width: 280px; }
.house .box-label { margin-top: 0.3rem; }
.dark-scene { position: relative; height: min(52vh, 400px); border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; touch-action: none; background: linear-gradient(#34495e, #5d6d7e); }
.dark-item { position: absolute; transform: translate(-50%, -50%); font-size: 1.9rem; border: 0; background: none; padding: 0; pointer-events: none; }
.darkness { position: absolute; inset: 0; background: rgba(5, 8, 20, 0.985); pointer-events: none; }

/* 20 samstillt */
.sync-form { display: grid; gap: 0.5rem; margin: 0.5rem 0; }

/* 21 pakkaverksmiðja */
.parcel-model {
  position: relative; width: 120px; height: 100px; margin: 0.6rem auto; border: 3px solid var(--ink); border-radius: 8px;
  background: var(--paper); display: grid; place-items: center; overflow: hidden;
}
.parcel-model::before, .parcel-model::after { content: ""; position: absolute; background: var(--ribbon); }
.parcel-model::before { left: 50%; top: 0; bottom: 0; width: 14px; margin-left: -7px; }
.parcel-model::after { top: 50%; left: 0; right: 0; height: 14px; margin-top: -7px; }
.pm-pattern { font-size: 1.6rem; opacity: 0.75; position: absolute; left: 0.3rem; top: 0.1rem; z-index: 1; }
.pm-tag { position: absolute; right: 0.2rem; bottom: 0.1rem; font-size: 1.6rem; z-index: 1; }
.secret-card .parcel-model { border-color: #fff; }
.model-list { list-style: none; padding: 0; margin: 0.4rem 0; }
.preview { min-height: 112px; }
.pk-row { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.4rem 0; }
.pk-opts { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.pk { width: 2.8rem; height: 2.8rem; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-size: 1.3rem; cursor: pointer; padding: 0; }
.pk.on { outline: 4px solid var(--gold); outline-offset: 2px; transform: scale(1.08); }

/* 22 ofn */
.fact { background: rgba(255,255,255,.1); border-radius: 8px; padding: 0.4rem; margin: 0.3rem 0; font-size: 1.1rem; }
.oven-art { font-size: 3rem; }

/* 23 uppboð */
.last-auc { font-size: 0.9rem; background: #fff3c4; border-radius: 10px; padding: 0.3rem; }
.bidder { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin: 0.5rem 0; }
.bid-val { font-family: "Lilita One", cursive; font-size: 2.2rem; min-width: 3rem; }

/* 24 síðasta piparkakan */
.nums { display: flex; gap: 0.5rem; justify-content: center; margin: 0.5rem 0; }
.num { width: 3.4rem; height: 3.4rem; font-size: 1.6rem; padding: 0; }
.num.on { background: var(--gold); }


/* lokastaða */
.final-title { font-family: "Lilita One", cursive; font-weight: 400; text-align: center; color: var(--red); font-size: 1.9rem; margin: 0.2rem 0 0.8rem; text-shadow: 0 2px 0 #fff, 2px 4px 0 rgba(43,27,23,.25); }
.final-list { list-style: none; padding: 0; margin: 0 0 0.9rem; display: grid; gap: 0.45rem; }
.final-list li {
  display: flex; align-items: center; gap: 0.5rem; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 0.45rem 0.7rem;
}
.final-list li.place-1 {
  background: linear-gradient(#fff3c2, var(--gold)); border-width: 3px; box-shadow: 0 4px 0 var(--ink); font-size: 1.15rem;
  animation: winner 1.6s ease-in-out infinite;
}
@keyframes winner { 50% { transform: scale(1.02); } }
.final-list li.place-2 { background: #eef3f7; }
.final-list li.place-3 { background: #f7e7d7; }
.fp { width: 2rem; font-weight: 800; text-align: center; }
.ff { font-size: 1.6rem; }
.fn { flex: 1; font-weight: 800; }
.fg, .fc { font-weight: 800; white-space: nowrap; }
#btn-leave-final { display: block; margin: 0.4rem auto 0; }

/* tilkynningar */
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--red); color: #fff; text-align: center; padding: 0.4rem; font-weight: 800; }
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 200%); z-index: 60; transition: transform 0.25s;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 12px; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* sími */
@media (max-width: 820px) {
  .game-main { flex-direction: column; }
  .board-view { flex: 1 1 auto; min-height: 50%; border-right: 0; border-bottom: 3px solid var(--ink); }
  .side { width: auto; flex: 0 1 auto; max-height: 44dvh; padding: 1.1rem 0.6rem 0.8rem; gap: 0.55rem; }
  .plist { display: flex; overflow-x: auto; gap: 0.4rem; padding-bottom: 0.2rem; scrollbar-width: none; }
  .plist li { flex: 0 0 auto; padding: 0.25rem 0.55rem 0.25rem 0.85rem; font-size: 0.85rem; }
  .plist .pl-name { max-width: 5.5rem; }
  .pl-gifts, .pl-cookies { min-width: 0; }
  .top-title { font-size: 1.05rem; }
  .garland { top: 42px; }
  .minimap { width: 58px; height: 81px; }
  .mg { padding: 0; align-items: stretch; }
  .mg-card { max-width: none; border-radius: 0; border-width: 6px; box-shadow: none; }
  .mg-head { border-radius: 0; }
  .mg-head h2 { font-size: 1.35rem; }
  .cal-day { font-size: 5rem; }
}
