/* Julbocken – serietidningsestetik som de andra spelen. Gemensamma färger och mått finns i
   /api/ui/comic.css. */
:root {
  --straw: #e8c26a;
  --ribbon: #c8202c;
  --night: #1c2346;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--hand);
  font-size: 17px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle, var(--paper-dot) 1.4px, transparent 1.8px),
    radial-gradient(circle, var(--paper-dot) 1.4px, transparent 1.8px);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  padding-top: var(--panikbar-h, 0);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

h2, h3 { font-family: var(--title); font-weight: 400; letter-spacing: 0.05em; }
.muted { color: #5a4a3a; }
.small { font-size: 14px; }
.frame { padding: 16px; border-radius: 4px; --fill: var(--white); margin-bottom: 20px; }
.frame h2 { font-size: 28px; margin: 0 0 8px; }

.caption {
  display: inline-block;
  background: var(--caption);
  border: var(--line) solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 6px 12px;
  font-family: var(--title);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 8px 0 12px;
}
.tilt-l { transform: rotate(-1.5deg); }

/* ---------------------------------------------------------------- knappar */

button, .btn-link {
  font-family: var(--title);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: var(--white);
  border: var(--line) solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.06s, box-shadow 0.06s;
}
button:active:not(:disabled), .btn-link:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button.big, .btn-link.big {
  font-size: 26px;
  padding: 10px 26px;
  background: var(--accent);
  color: var(--white);
  text-shadow: 2px 2px 0 var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
.error {
  display: inline-block;
  color: var(--white);
  background: var(--danger);
  border: var(--line) solid var(--ink);
  padding: 6px 12px;
}

/* ---------------------------------------------------------------- start */

#home, #play { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; }
.title {
  font-family: var(--title);
  font-weight: 400;
  margin: 4px 0 22px;
  line-height: 0.88;
  font-size: clamp(52px, 14vw, 104px);
  letter-spacing: 0.02em;
  color: var(--accent);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--ink);
  transform: rotate(-3deg);
}
.title span { display: block; }
.lead { font-size: 18px; line-height: 1.4; margin: 12px 0 0; }
.bubble { --bubble-shout: var(--danger); }
.closed { --fill: var(--caption); }

/* Adventskalendern: 24 luckor i blandad ordning. */
.calendar-box { --fill: var(--night); color: var(--white); }
.calendar-box .muted { color: #cfd6ff; }
.calendar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 520px) { .calendar { grid-template-columns: repeat(4, 1fr); } }
.door {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: var(--line) solid var(--ink);
  border-radius: 6px;
  background: #b5462f;
  color: var(--white);
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s;
}
.door .nr { font-family: var(--title); font-size: clamp(26px, 7vw, 38px); line-height: 1; text-shadow: 2px 2px 0 var(--ink); }
.door .sub { font-size: 12px; font-weight: 700; margin-top: 2px; }
.door.open:hover { transform: translate(-1px, -2px) rotate(-1deg); }
.door.locked { background: #3a3f63; color: #9aa3d6; box-shadow: none; opacity: 0.8; }
.door.locked .nr { text-shadow: none; }
.door.today { background: var(--accent); animation: wiggle 1.6s ease-in-out infinite; }
.door.solved { background: #2f8f4e; }
.door.perfect { background: var(--caption); color: var(--ink); }
.door.perfect .nr { color: var(--ink); text-shadow: none; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg) scale(1.04); } }
[data-reduced-motion] .door.today { animation: none; }

.legend { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 16px; line-height: 1.35; }
.legend b { font-family: var(--title); font-weight: 400; letter-spacing: 0.04em; font-size: 18px; }

/* Topplistor */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 2px dashed rgba(20, 16, 16, 0.15); }
.list li.me { font-weight: 700; color: var(--accent); }
.list li.empty { color: #5a4a3a; border: 0; }
.list .place { width: 2.2em; font-family: var(--title); }
.list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .score { font-family: var(--title); letter-spacing: 0.03em; }

/* ---------------------------------------------------------------- luckan */

.play-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.back { font-family: var(--title); font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: 0.04em; }
.lucka-title { font-size: clamp(26px, 6vw, 38px); margin: 0; color: var(--accent); -webkit-text-stroke: 1px var(--ink); }
.mission { margin: 6px 0 4px; font-size: 16px; line-height: 1.35; background: var(--white); border: 2px solid var(--ink); border-radius: 6px; padding: 6px 10px; box-shadow: 2px 2px 0 var(--ink); }
.mission b { font-family: var(--title); font-weight: 400; letter-spacing: 0.04em; font-size: 18px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 10px; }
.stat { font-size: 16px; }
.stat b { font-family: var(--title); font-weight: 400; font-size: 24px; letter-spacing: 0.03em; margin-left: 4px; }

.stage { position: relative; display: flex; justify-content: center; }
#board {
  display: block;
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
  background: #efe9dd;
  touch-action: manipulation;
  cursor: pointer;
  max-width: 100%;
}
.banner {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) rotate(-4deg);
  font-family: var(--title);
  font-size: clamp(30px, 8vw, 52px);
  padding: 8px 18px;
  border: var(--line) solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.banner.good { background: var(--good); color: var(--white); text-shadow: 2px 2px 0 var(--ink); }
.banner.bad { background: var(--danger); color: var(--white); text-shadow: 2px 2px 0 var(--ink); }

.hint { min-height: 2.6em; margin: 12px 0 6px; font-size: 16px; line-height: 1.3; transition: color 0.2s; }
.hint.warn { color: var(--danger); font-weight: 700; }

.tools { display: flex; flex-wrap: wrap; gap: 10px; }
.tool { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 14px; min-width: 104px; }
.tool .tool-name { font-size: 20px; }
.tool .tool-cost, .tool .tool-left { font-family: var(--hand); font-size: 13px; font-weight: 700; letter-spacing: 0; }
.tool.active { background: var(--caption); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

.result { --fill: var(--caption); margin-top: 18px; }
.result h2 { font-size: 34px; }

/* Smala skärmar: brädet, verktygen och "Låt natten falla" ska rymmas utan att man scrollar. */
@media (max-width: 520px) {
  #play { padding-top: 10px; }
  .play-head { gap: 4px 12px; }
  .mission { font-size: 14px; padding: 4px 8px; }
  .mission b { font-size: 16px; }
  .stats { margin: 4px 0 6px; }
  .stat b { font-size: 20px; }
  .hint { min-height: 2.4em; margin: 8px 0 4px; font-size: 14px; }
  .tools { gap: 8px; }
  .tool { min-width: 0; flex: 1; padding: 4px 8px; }
  .tool .tool-name { font-size: 17px; }
  #play .actions { flex-wrap: nowrap; gap: 8px; margin: 10px 0; }
  #play .actions button { font-size: 16px; padding: 6px 10px; }
  #play .actions button.big { font-size: 20px; padding: 8px 12px; flex: 1; }
}
