/* sudokuonline.dk - blæk på papir, ét rødt stempel */
@font-face { font-family: "Albert Sans"; src: url("/assets/fonts/albert-sans.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --papir: #f5f1e8;
  --papir-2: #ebe5d7;
  --hvid: #fdfbf6;
  --blaek: #1b2350;
  --blaek-2: #4b5379;
  --blaek-3: #7d8199;
  --linje: #cbc3b0;
  --roed: #c8381e;
  --roed-lys: #f7dcd3;
  --blaa: #2446b3;
  --valgt: #f4dd9b;
  --naer: #ece4cf;
  --samme: #dbe1f4;
  --radius: 6px;
  --sans: "Albert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papir);
  color: var(--blaek);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--blaek); text-decoration-color: var(--roed); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--roed); }
:focus-visible { outline: 3px solid var(--blaa); outline-offset: 2px; }
.ramme { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skjult { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spring { position: absolute; left: -999px; top: 8px; background: var(--blaek); color: var(--hvid); padding: 8px 12px; z-index: 5; }
.spring:focus { left: 8px; }

/* Top */
.top { border-bottom: 1px solid var(--linje); background: var(--papir); }
.top-indre { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.ordmaerke { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--blaek); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.ordmaerke em { font-style: normal; font-weight: 400; color: var(--blaek-2); }
.ordmaerke:hover { color: var(--blaek); }
.maerke { width: 26px; height: 26px; flex: none; }
.menu { display: flex; gap: 2px; }
.menu a { text-decoration: none; padding: 6px 9px; border-radius: var(--radius); font-size: 0.95rem; font-weight: 500; color: var(--blaek-2); }
.menu a:hover { color: var(--blaek); background: var(--papir-2); }
.menu a[aria-current="page"] { color: var(--blaek); box-shadow: inset 0 -2px 0 var(--roed); border-radius: 0; }

/* Spil */
.spil { padding-top: 18px; padding-bottom: 28px; }
.spil-hoved { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.spil-hoved h1 { margin: 0; font-size: clamp(1.35rem, 4.5vw, 2rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.status { margin: 0; font-family: var(--mono); font-size: 0.9rem; color: var(--blaek-2); white-space: nowrap; }
.tid { font-variant-numeric: tabular-nums; display: inline-block; min-width: 3.4em; text-align: right; }

.spil-layout { display: grid; gap: 14px; grid-template-columns: 1fr; }
.plade-ramme { width: 100%; max-width: 560px; margin: 0 auto; }

.plade {
  container-type: inline-size;
  aspect-ratio: 1;
  width: 100%;
  background: var(--hvid);
  border: 2.5px solid var(--blaek);
  border-radius: 3px;
  display: grid;
  grid-template-rows: repeat(9, 1fr);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.raekke { display: grid; grid-template-columns: repeat(9, 1fr); min-height: 0; }
.felt {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--linje);
  border-bottom: 1px solid var(--linje);
  cursor: pointer;
  min-width: 0; min-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.raekke > .felt:last-child { border-right: 0; }
.raekke:last-child > .felt { border-bottom: 0; }
.felt.hk { border-right: 2px solid var(--blaek); }
.felt.bk { border-bottom: 2px solid var(--blaek); }
.felt:focus { outline: none; }
.felt:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--blaa); }
.felt.naer { background: var(--naer); }
.felt.samme { background: var(--samme); }
.felt.valgt { background: var(--valgt); }
.felt .v { grid-area: 1 / 1; font-size: 6.4cqw; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.felt.fast .v { font-weight: 750; color: var(--blaek); }
.felt.egen .v { color: var(--blaa); font-weight: 500; }
.felt.fejl .v { color: var(--roed); }
.felt.fejl { background: var(--roed-lys); }
.felt.fejl.valgt { background: #f1c4b6; }
.felt .n {
  grid-area: 1 / 1;
  align-self: stretch; justify-self: stretch;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 0.25cqw;
}
.felt .n i { font-style: normal; font-family: var(--mono); font-size: 2.15cqw; line-height: 1; color: var(--blaek-2); display: grid; place-items: center; }
.plade.loest .felt { background: var(--hvid); }
.plade.loest .felt.egen .v { color: var(--blaek); }
.notetilstand .plade { border-color: var(--blaa); }
.ingen-js { grid-column: 1 / -1; padding: 24px; margin: 0; }

.besked { min-height: 1.6em; margin: 6px 0 0; font-size: 0.98rem; color: var(--blaek-2); text-align: center; }
.besked.vundet { color: var(--blaek); font-weight: 700; }
.besked.vundet::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; background: var(--roed); margin-right: 8px; vertical-align: 0.02em; }

/* Panel */
.panel { display: grid; gap: 12px; width: 100%; max-width: 560px; margin: 0 auto; align-content: start; }
/* Mobil: værktøjer og tal lige under pladen, nyt spil nederst */
.panel .vaerktoej { order: 1; }
.panel .tal { order: 2; }
.panel .skift { order: 3; }
.panel .niveauer { order: 4; margin-top: 10px; }
.panel #nyt-spil { order: 5; }
.niveauer { border: 0; margin: 0; padding: 0; min-width: 0; }
.niveauer legend { padding: 0; margin-bottom: 6px; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blaek-3); }
.segment { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--blaek); border-radius: var(--radius); overflow: hidden; background: var(--hvid); }
.segment label { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment span { display: block; text-align: center; padding: 9px 4px; font-weight: 600; font-size: 0.97rem; cursor: pointer; }
.segment label + label span { border-left: 1.5px solid var(--blaek); }
.segment input:checked + span { background: var(--blaek); color: var(--hvid); }
.segment input:focus-visible + span { outline: 3px solid var(--blaa); outline-offset: -5px; }

.knap {
  font: inherit; font-weight: 700; font-size: 1rem;
  border: 1.5px solid var(--blaek); border-radius: var(--radius);
  padding: 11px 16px; cursor: pointer; background: var(--hvid); color: var(--blaek);
  min-height: 46px;
}
.knap-primaer { background: var(--roed); border-color: var(--roed); color: #fff; }
.knap-primaer:hover { background: #ad2e17; border-color: #ad2e17; }
.knap:active { transform: translateY(1px); }

.vaerktoej { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vk {
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--blaek);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px; min-height: 52px; cursor: pointer;
  background: transparent; border: 1px solid var(--linje); border-radius: var(--radius);
}
.vk svg { width: 22px; height: 22px; }
.vk:hover { background: var(--papir-2); }
.vk:disabled { color: var(--blaek-3); cursor: default; background: transparent; opacity: 0.6; }
.vk[aria-pressed="true"] { background: var(--blaa); border-color: var(--blaa); color: #fff; }
.til-fra { font-weight: 800; }

.tal { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.tal button {
  font: inherit; position: relative; cursor: pointer;
  background: var(--hvid); color: var(--blaek);
  border: 1px solid var(--linje); border-radius: var(--radius);
  min-height: 54px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tal button span { font-size: 1.55rem; font-weight: 600; line-height: 1; }
.tal button small { font-family: var(--mono); font-size: 0.66rem; color: var(--blaek-3); min-height: 1em; line-height: 1.3; }
.tal button:hover { border-color: var(--blaek); }
.tal button:active { background: var(--valgt); }
.tal button.faerdig span { color: var(--blaek-3); opacity: 0.45; }
.notetilstand .tal button span { color: var(--blaa); }

.skift { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; color: var(--blaek-2); padding: 4px 0; }
.skift input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.skift-spor { width: 40px; height: 24px; border-radius: 12px; background: var(--linje); position: relative; flex: none; transition: background 0.15s; }
.skift-spor::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.skift input:checked + .skift-spor { background: var(--blaek); }
.skift input:checked + .skift-spor::after { transform: translateX(16px); }
.skift input:focus-visible + .skift-spor { outline: 3px solid var(--blaa); outline-offset: 2px; }

@media (min-width: 900px) {
  .spil { padding-top: 32px; }
  .spil-layout { grid-template-columns: minmax(0, 560px) minmax(260px, 340px); gap: 40px; justify-content: center; }
  .plade-ramme { margin: 0; }
  .panel { margin: 0; gap: 16px; }
  .panel .niveauer, .panel #nyt-spil, .panel .vaerktoej, .panel .tal, .panel .skift { order: 0; margin-top: 0; }
  .tal { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tal button { min-height: 64px; }
  .tal button span { font-size: 1.8rem; }
  .spil-hoved { max-width: 940px; margin-left: auto; margin-right: auto; }
}

/* Intro på forsiden */
.intro { padding-top: 28px; padding-bottom: 56px; border-top: 1px solid var(--linje); }
.intro h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 12px; }
.intro-gitter { display: grid; gap: 24px; }
.intro p { margin: 0 0 12px; max-width: 62ch; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; }
.genveje { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--linje); align-self: start; }
.genveje div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linje); }
.genveje dt { font-family: var(--mono); font-size: 0.9rem; color: var(--blaek); }
.genveje dt::before { content: ""; }
.genveje dd { margin: 0; color: var(--blaek-2); font-size: 0.97rem; }
@media (min-width: 900px) {
  .intro-gitter { grid-template-columns: 1.4fr 1fr; gap: 56px; }
  .intro .ramme, .intro { max-width: 1012px; }
}

/* Tekstsider */
.tekstside { padding: 32px 0 64px; }
.tekstside .ramme { max-width: 760px; }
.kicker { font-family: var(--mono); font-size: 0.85rem; color: var(--roed); margin: 0 0 6px; letter-spacing: 0.02em; }
.tekstside h1 { font-size: clamp(1.9rem, 6vw, 2.9rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin: 0 0 16px; }
.tekstside h2 { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; margin: 40px 0 10px; line-height: 1.2; }
.tekstside h3 { font-size: 1.1rem; font-weight: 700; margin: 24px 0 6px; }
.tekstside p, .tekstside li { max-width: 66ch; }
.tekstside p { margin: 0 0 14px; }
.tekstside ul, .tekstside ol { padding-left: 1.3em; margin: 0 0 16px; }
.tekstside li { margin-bottom: 6px; }
.indledning { font-size: 1.18rem; color: var(--blaek-2); line-height: 1.5; }
.teknik { border-top: 2px solid var(--blaek); padding-top: 4px; margin-top: 40px; }
.teknik h2 { margin-top: 12px; display: flex; gap: 12px; align-items: baseline; }
.teknik h2 .nr { font-family: var(--mono); font-size: 0.9rem; font-weight: 400; color: var(--roed); }
.faktaboks { background: var(--hvid); border: 1px solid var(--linje); border-left: 4px solid var(--roed); padding: 14px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 20px 0; }
.faktaboks p:last-child { margin-bottom: 0; }
.mini { display: inline-grid; grid-template-columns: repeat(3, 2.1rem); grid-template-rows: repeat(3, 2.1rem); border: 2px solid var(--blaek); background: var(--hvid); margin: 8px 0 16px; }
.mini span { display: grid; place-items: center; border-right: 1px solid var(--linje); border-bottom: 1px solid var(--linje); font-weight: 700; }
.mini span:nth-child(3n) { border-right: 0; }
.mini span:nth-child(n+7) { border-bottom: 0; }
.mini .x { background: var(--valgt); color: var(--blaa); }
.knap-link { display: inline-block; text-decoration: none; margin-top: 8px; }
.knap-link:hover { color: #fff; }

/* Fod */
.bund { border-top: 1px solid var(--linje); background: var(--papir-2); }
.bund-indre { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; padding-bottom: 18px; font-size: 0.92rem; color: var(--blaek-2); }
.bund p { margin: 0; font-family: var(--mono); }

@media (max-width: 380px) {
  .menu a { padding: 6px 6px; font-size: 0.9rem; }
  .ordmaerke { font-size: 1.05rem; }
  .tal { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .skift-spor, .skift-spor::after { transition: none; }
}
