*{box-sizing:border-box}
:root{--blue:#2f83c5;--red:#d75550;--bg:#edf1f4;--ink:#172431;--panel:#fff;--gap:8px}
html,body{margin:0;min-height:100%;background:var(--bg)}
body{font-family:system-ui,Segoe UI,sans-serif;color:var(--ink);overflow-x:hidden}
.game-shell{width:min(100%,920px);min-height:100svh;margin:0 auto;padding:clamp(6px,1.2vw,14px);display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto auto;gap:var(--gap)}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:54px}
.brand small{letter-spacing:.18em}h1{margin:0;font-size:clamp(28px,4vw,46px);line-height:1}
button,select{border:0;border-radius:11px;padding:10px 14px;font-weight:750}
button{background:#202a33;color:#fff;cursor:pointer}
.toolbar{background:var(--panel);border-radius:12px;padding:7px 10px}
.toolbar label{font-size:13px;font-weight:700;display:flex;align-items:center;gap:8px}
.toolbar select{background:#eef1f4;min-width:118px}
.scorebar{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
.scorebar>div{background:var(--panel);border-radius:12px;text-align:center;padding:6px 8px;min-height:54px}
.scorebar strong{display:block;font-size:clamp(18px,2.5vw,24px);line-height:1.1}
.scorebar span{display:block;font-size:11px;color:#69747d;margin-top:2px}
.score.blue strong{color:var(--blue)}.score.red strong{color:var(--red)}
.playarea{min-height:0;display:flex;align-items:center;justify-content:center}
.board{position:relative;width:min(92vw,620px,calc(100svh - 255px));max-width:100%;aspect-ratio:1;flex:0 0 auto;background:#faf7ef;border-radius:18px;box-shadow:0 10px 30px #0002;overflow:hidden}
.box{position:absolute;z-index:1;border-radius:8px;display:grid;place-items:center;font-size:clamp(15px,3.4vw,28px);font-weight:900;background:#f4f1e8;transition:.15s}
.box.dead{background:#484e54;color:#fff}.box.safe{background:#bfe5c7;color:#24502e}.box.bonus{background:#f5d574;color:#674d00}
.box.claim0{background:#9fc9e9;color:#123c5c!important}.box.claim1{background:#edaaa6;color:#67221e!important}
.box.claim0.dead{background:#78acd4}.box.claim1.dead{background:#df8580}
.edge{position:absolute;z-index:4;background:#d2cec4;border-radius:8px;cursor:pointer}
.edge:hover{background:#aaa69d}.edge.h{height:clamp(7px,1.2vw,11px);transform:translateY(-50%)}.edge.v{width:clamp(7px,1.2vw,11px);transform:translateX(-50%)}
.edge.blue{background:var(--blue)}.edge.red{background:var(--red)}
.dot{position:absolute;z-index:5;width:clamp(9px,1.5vw,13px);height:clamp(9px,1.5vw,13px);border-radius:50%;background:#252c31;transform:translate(-50%,-50%)}
.message{text-align:center;font-weight:750;min-height:20px;margin:0;font-size:clamp(12px,1.6vw,15px)}
.legend{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.legend div{background:var(--panel);border-radius:12px;text-align:center;padding:6px}
.legend i{display:grid;place-items:center;width:28px;height:28px;margin:auto;border-radius:7px;font-style:normal}
.legend b,.legend small{display:block}.legend b{font-size:12px}.legend small{font-size:9px;color:#68727b}
.legend .dead{background:#484e54;color:#fff}.legend .safe{background:#bfe5c7}.legend .bonus{background:#f5d574}.legend .normal{background:#f4f1e8;border:1px solid #ddd}
.overlay{position:fixed;inset:0;z-index:50;background:#17243199;display:grid;place-items:center;padding:20px}
.overlay.hidden{display:none}
.result-card{width:min(360px,92vw);background:#fff;border-radius:18px;padding:24px;text-align:center;box-shadow:0 18px 60px #0004}
.result-card small{letter-spacing:.12em;text-transform:uppercase;color:#68727b}.result-card h2{margin:8px 0 2px;font-size:30px}.result-card p{font-size:24px;font-weight:800;margin:8px 0 18px}
@media(max-width:640px){:root{--gap:6px}.game-shell{padding:6px}.topbar{min-height:46px}h1{font-size:30px}button,select{padding:8px 11px}.toolbar{padding:5px 8px}.scorebar>div{min-height:48px;padding:5px}.legend{grid-template-columns:repeat(2,1fr)}.board{width:min(96vw,calc(100svh - 310px))}}
@media(max-width:430px){.toolbar label{justify-content:space-between}.legend{grid-template-columns:repeat(4,1fr);gap:4px}.legend div{padding:4px 2px}.legend i{width:24px;height:24px}.legend b{font-size:10px}.legend small{display:none}.board{width:min(96vw,calc(100svh - 250px))}}
@media(max-height:720px){.game-shell{padding:5px;gap:5px}.topbar{min-height:42px}h1{font-size:28px}.toolbar{padding:4px 8px}.scorebar>div{min-height:44px;padding:4px}.scorebar strong{font-size:18px}.legend{display:none}.board{width:min(94vw,calc(100svh - 190px))}.message{font-size:12px}}
@media(max-height:600px){.toolbar{display:none}.board{width:min(92vw,calc(100svh - 140px))}}


/* v0.9: tydelig markering af seneste træk */
.edge.last-move.h{
  animation:lastMoveH .85s ease-out;
  z-index:9;
}
.edge.last-move.v{
  animation:lastMoveV .85s ease-out;
  z-index:9;
}
@keyframes lastMoveH{
  0%{transform:translateY(-50%) scaleY(2.35);filter:brightness(1.12)}
  45%{transform:translateY(-50%) scaleY(2.35);filter:brightness(1.12)}
  100%{transform:translateY(-50%) scaleY(1);filter:none}
}
@keyframes lastMoveV{
  0%{transform:translateX(-50%) scaleX(2.35);filter:brightness(1.12)}
  45%{transform:translateX(-50%) scaleX(2.35);filter:brightness(1.12)}
  100%{transform:translateX(-50%) scaleX(1);filter:none}
}


/* v0.10: grafiske specialfelter */
.box{
  overflow:hidden;
}
.field-icon{
  width:64%;
  height:64%;
  display:block;
  filter:drop-shadow(0 3px 3px #0003);
  pointer-events:none;
}
.coffin-icon{width:54%;height:68%}
.beacon-icon{width:46%;height:72%}
.bonus-icon{width:58%;height:58%}

/* Keep the icon readable after a field is claimed. */
.box.claim0 .field-icon,
.box.claim1 .field-icon{
  filter:drop-shadow(0 3px 3px #0004);
}


/* v0.11: legendens ikoner er nu de samme som på spillebrættet */
.legend i{
  overflow:visible;
}
.legend i .field-icon{
  width:24px;
  height:24px;
  filter:drop-shadow(0 2px 2px #0002);
}
.legend i.dead .field-icon{
  width:22px;
  height:26px;
}
.legend i.safe .field-icon{
  width:20px;
  height:27px;
}
.legend i.bonus .field-icon{
  width:24px;
  height:24px;
}
.legend i.dead,
.legend i.safe,
.legend i.bonus{
  background:transparent;
}


/* soQan Cross v1.0 release */
html{-webkit-text-size-adjust:100%}
button,select,.edge{-webkit-tap-highlight-color:transparent}
button:focus-visible,select:focus-visible,.edge:focus-visible{outline:3px solid #6aa9d8;outline-offset:2px}
@media (orientation:landscape) and (max-height:520px){
 .game-shell{grid-template-rows:auto auto minmax(0,1fr) auto}
 .toolbar,.legend{display:none}
 .scorebar{position:absolute;right:8px;top:8px;width:min(42vw,320px);z-index:20}
 .topbar{padding-right:min(44vw,340px)}
 .board{width:min(78vh,72vw)}
}
