:root{--ink:#163a2f;--forest:#173f30;--cream:#f6f3e7;--light:#e4e8d7;--rule:#c3cbb8;--gold:#eac281;--serif:Georgia,'Times New Roman',serif;font:16px/1.45 'DM Sans',Arial,sans-serif;color:var(--ink);background:var(--cream)}
*{box-sizing:border-box}body{margin:0}a{color:inherit}button,.primary{font:inherit;line-height:1.2;font-weight:700;border:0;cursor:pointer;color:#fff6d9;background:var(--forest);padding:13px 20px;border-radius:28px;text-decoration:none}button.secondary{background:transparent;color:var(--ink);border:1px solid var(--rule)}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #dc9542;outline-offset:3px}button:disabled{opacity:.5;cursor:default}[hidden]{display:none!important}.mast{background:var(--forest);color:var(--cream);display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 5vw;border-bottom:1px solid #ffffff33}.brand{font:25px var(--serif);letter-spacing:-.055em;display:flex;align-items:center;gap:10px;text-decoration:none}.brand img{width:36px;height:36px;object-fit:contain}.mast nav{display:flex;align-items:center;gap:18px;font-size:14px}.mast nav a{text-underline-offset:4px}.mast nav button{color:inherit;background:transparent;border:1px solid #a3bc9e;padding:7px 11px}.wrap{max-width:1500px;margin:auto;padding-inline:clamp(16px,5vw,80px)}.intro{background:var(--forest);color:var(--cream);padding:38px 0 33px}.eyebrow{text-transform:uppercase;letter-spacing:.16em;font-size:12px;font-weight:750;margin:0 0 8px}.intro .eyebrow{color:#cedbc2}.intro h1,.gamehead h1,#phone h1{font:normal clamp(45px,6.7vw,100px)/.99 var(--serif);letter-spacing:-.065em;margin:0}.intro h1 i{color:var(--gold);font-weight:normal}.intro p:last-child{margin:12px 0 0;color:#dbe4cf;font-size:18px}.grid{padding-block:30px 45px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:28px 24px}.gamecard{display:block;text-decoration:none}.gamecard canvas{width:100%;height:auto;display:block;border-radius:6px}.gamecard h2{font:normal clamp(24px,2.2vw,38px)/1.08 var(--serif);letter-spacing:-.045em;margin:10px 0 4px}.gamecard p{margin:0;color:#446252;font-size:14px}.gamecard:hover h2{text-decoration:underline;text-underline-offset:5px}.handset{overscroll-behavior:none}.handset .mast{display:none}#phone{min-height:100svh;display:grid;place-items:center;padding:22px;background:#183d32;color:var(--cream);touch-action:manipulation;user-select:none}.phone-inner{width:min(100%,480px);text-align:center}#phone h1{font-size:clamp(38px,10vw,70px);color:var(--phone-color,#ffe5b2)}#phoneInfo{font-size:18px}#phoneButtons{justify-content:center}#phoneButtons button{background:#edd18c;color:#233c31}#phoneButtons .secondary{color:var(--cream);background:transparent;border:1px solid #739280}#phone #sensorStatus{color:#f1c9a2}.handset.play #phone{touch-action:none}.handset.play .phone-inner{opacity:.8}
#gallery footer{padding-bottom:30px}.handset .phone-inner{margin:auto}#phone h1{font:700 clamp(40px,11vw,82px)/1.02 system-ui,sans-serif}#phoneButtons{display:flex;flex-wrap:wrap;gap:9px}body.handset{background:#183d32}
body.in-game{background:#11271f;overflow:hidden;overscroll-behavior:none}body.in-game .mast{display:none}
#host{position:fixed;inset:0;width:100%;height:100%;height:100dvh;isolation:isolate;overflow:hidden;background:#162d28;color:#fdf7df;--paper:#fff6df;--accent:#e7f894;--edge:clamp(10px,2vw,30px);font-family:'DM Sans',system-ui,sans-serif}
#host:fullscreen{width:100vw;height:100vh;background:#162d28}
#field,.scene-shade,#count{position:absolute;inset:0;width:100%;height:100%}#field{display:block;touch-action:none;outline-offset:-4px}
.scene-shade{pointer-events:none;background:linear-gradient(90deg,rgba(10,25,28,.82) 0%,rgba(12,30,30,.69) 24%,rgba(12,30,30,.2) 52%,transparent 76%);transition:opacity .2s}
#host[data-stage="playing"] .scene-shade{opacity:0}
.top-hud,.bottom-hud{position:absolute;left:max(var(--edge),env(safe-area-inset-left));right:max(var(--edge),env(safe-area-inset-right));display:flex;align-items:flex-start;justify-content:space-between;gap:8px;pointer-events:none}
.top-hud{top:max(var(--edge),env(safe-area-inset-top));z-index:4}.bottom-hud{bottom:max(var(--edge),env(safe-area-inset-bottom));align-items:flex-end;z-index:2}
.readouts,.game-tools,#quick,#scores{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.readouts span,#scores span,.icon,#quick button{box-shadow:0 2px 0 #0b201c55;background:#182d2bf0;color:var(--paper);border:1px solid #d8e8c536}
.readouts span,#scores span{border-radius:8px;padding:6px 11px;font-size:clamp(12px,1.1vw,16px);font-weight:730;white-space:nowrap}
.readouts span:empty{display:none}#phase{font-variant-numeric:tabular-nums}#farmStatus{color:#e3f3ab}.game-tools,.game-tools>* ,#quick button{pointer-events:auto}.icon{font:750 20px/1 monospace;text-decoration:none;display:grid;place-items:center;width:38px;height:38px;border-radius:8px;padding:0;cursor:pointer}
#fullscreen{font-size:26px}.exit{font-size:25px}
#panel{position:absolute;z-index:2;top:50%;left:max(clamp(22px,6vw,115px),env(safe-area-inset-left));transform:translateY(-50%);max-width:min(500px,83vw);max-height:calc(100% - 126px);overflow:auto;scrollbar-width:thin;padding:12px 5px 14px 0;text-shadow:0 2px 2px #0e25287a}
#panel .eyebrow{color:#e0efa0;letter-spacing:.11em;font-size:clamp(12px,1vw,16px);margin:0 0 9px}
#gameTitle,#panelTitle{font:850 clamp(38px,5vw,84px)/.99 'DM Sans',system-ui,sans-serif;letter-spacing:-.06em;margin:0;color:#fff8e3;text-wrap:balance}
#host[data-game="targets"] #gameTitle{font-family:'Arial Black','DM Sans',system-ui,sans-serif;font-weight:950;text-shadow:2px 4px 0 #173a39}
#host:not([data-stage="intro"]) #gameTitle{display:none}#host[data-stage="intro"] #panelTitle{display:none}
#instruction,#helpText{font-size:clamp(15px,1.45vw,22px);line-height:1.43;margin:15px 0;max-width:35ch;text-wrap:pretty}
#pointGuide{display:flex;gap:8px;align-items:center;font-weight:750;color:#fff7d8;font-size:15px}#pointGuide b{color:var(--accent)}#pointGuide span{opacity:.6;margin-inline:3px}
#buttons,#phoneButtons{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
#panel button,#closeHelp{background:var(--accent);color:#18352d;box-shadow:0 3px 0 #0a26266e;border-radius:8px;min-height:44px;font-size:15px}
#panel .secondary,#buttons a{background:#162d29e8;border:1px solid #cadbc480;color:var(--paper);border-radius:8px;text-decoration:none;font-size:14px;padding:12px 16px;font-weight:700}
#buttons:empty,#lineup:empty,#lobby:not(:has(#qrBox:not([hidden]),.roster)){display:none}
#lobby{display:flex;align-items:flex-start;gap:18px;flex-wrap:wrap;margin-block:10px 16px}
#qrBox{display:flex;flex-direction:column;gap:4px;align-items:center}#qr{width:clamp(120px,16vmin,205px);height:auto;image-rendering:pixelated;border-radius:4px}
#joinUrl{font-size:13px;font-weight:700;text-underline-offset:3px}
#lineup{min-width:min(205px,50vw)}.roster{display:flex;align-items:center;gap:9px;border-bottom:1px solid #d6e2ba42;padding:6px 0;font-size:15px;font-weight:700}
.roster small{margin-left:auto;color:#f2ebcc}.badge{border:1px solid #132c28;border-radius:50%;width:24px;height:24px;display:grid;place-items:center;color:#172b28;text-shadow:none;font-weight:800}
#panel .roster button{font-size:12px;padding:4px 7px;min-height:25px;box-shadow:none}#lineup p{font-size:13px}
#host:not([data-stage="playing"]) .bottom-hud,#host[data-stage="playing"] #panel{display:none}
#scores span{border-left:5px solid var(--tint)}#quick button{border-radius:7px;font-size:13px;padding:7px 11px}
#count{z-index:3;display:grid;place-items:center;text-align:center;background:#11252848;pointer-events:none}
#count>div{background:#172e2cec;padding:14px 24px;border:1px solid #f6f2c465;border-radius:14px;width:min(500px,88vw)}
#countHint{font-size:clamp(15px,1.9vw,26px);line-height:1.25;margin:.15em 0 0}#countNum{font:900 clamp(60px,13vmin,140px)/1 system-ui,sans-serif;color:var(--accent)}
#helpBox{position:absolute;z-index:5;right:var(--edge);top:calc(var(--edge) + 48px);max-width:min(415px,92vw);padding:18px 21px;background:#192f2df5;border:1px solid #f5f0c56b;border-radius:10px}#helpBox h2{margin:0;font-size:22px}#helpText{margin-block:8px 14px;font-size:16px}#helpBox button{min-height:36px;padding:7px 13px}
#msg{position:absolute;z-index:6;top:64px;left:var(--edge);margin:0;background:#452e26;color:#fff4dc;border-radius:6px;padding:8px 12px;font-size:14px}#msg:empty{display:none}
@media(max-width:800px){.grid{grid-template-columns:1fr 1fr}.intro{padding:25px 0}}
@media(max-width:640px) and (orientation:portrait){#panel{top:auto;bottom:max(6vh,env(safe-area-inset-bottom));left:5vw;transform:none;max-width:90vw;max-height:calc(100% - 100px)}.scene-shade{background:linear-gradient(to top,#0e292aef 0%,#173433bf 28%,#17343328 72%,transparent 94%)}#host[data-stage="waiting"] .scene-shade,#host[data-stage="finished"] .scene-shade{background:linear-gradient(to top,#102d2bf5 5%,#152d2bd4 45%,#142c2b48 95%)}#instruction{font-size:16px}.icon{width:34px;height:34px}#scores{gap:3px}#scores span{font-size:11px;padding:4px 6px}.bottom-hud{gap:4px}.grid{gap:20px 13px}.readouts{gap:3px}.readouts span{font-size:11px;padding:6px}}
@media(max-height:540px) and (orientation:landscape){#host{--edge:9px}#panel{max-height:calc(100% - 55px);max-width:min(570px,73vw);top:54%}#lobby{margin:5px 0;gap:12px}#instruction{font-size:14px;margin:7px 0}#gameTitle,#panelTitle{font-size:clamp(27px,5vw,45px)}#qr{width:92px}.roster{padding:2px 0}.game-tools .icon{width:30px;height:30px}#panel button,#panel .secondary,#buttons a{min-height:33px;padding:7px 11px}}

.runner-portrait{
  display:inline-block;
  background:var(--runner-color) url('../art/hurdles/club-skin-portraits.png') no-repeat;
  background-size:600% 100%;
  border-radius:50%;
}
.roster .runner-portrait{flex:none;width:32px;height:32px;border:1px solid #ffedcc8c}
#runnerHandPlayer{width:clamp(72px,17vmin,112px);aspect-ratio:1;margin-bottom:12px;border:3px solid var(--runner-color)}

#host[data-game="marathon"],#phone[data-game="marathon"]{
  --club-ink:#604369;--club-type:#48324e;--club-paper:#fff1d6;--club-gold:#ffe181;
  --club-mint:#96e9cd;--club-shadow:#9a727d;
  color:var(--club-type);--accent:var(--club-gold);--paper:var(--club-paper);
}
#host[data-game="marathon"] .scene-shade{background:transparent}
#host[data-game="marathon"] :is(#panel,#helpBox,#count>div),#phone[data-game="marathon"] .phone-inner{
  background:var(--club-paper);border:4px solid var(--club-ink);border-radius:25px;
  box-shadow:0 5px 0 var(--club-ink);color:var(--club-type);text-shadow:none;
}
#host[data-game="marathon"] #panel{
  padding:clamp(17px,2vmin,26px) clamp(20px,2.45vw,34px);
  max-width:min(460px,85vw);left:max(4vw,env(safe-area-inset-left));scrollbar-color:#b6a3aa transparent;
}
#host[data-game="marathon"] :is(#gameTitle,#panelTitle),#phone[data-game="marathon"] h1{
  color:var(--club-ink);letter-spacing:-.05em;line-height:1.02;font-family:ui-rounded,'Trebuchet MS',system-ui,sans-serif;
  font-weight:900;
}
#host[data-game="marathon"] :is(#gameTitle,#panelTitle){font-size:clamp(32px,4.5vw,66px)}
#host[data-game="marathon"] :is(#panel .eyebrow,#countNum){color:var(--club-ink)}
#host[data-game="marathon"] #panel .eyebrow{letter-spacing:.075em}
#host[data-game="marathon"] :is(.readouts span,.game-tools .icon,#scores span,#quick button),
#host[data-game="marathon"] :is(#panel button,#buttons a,#closeHelp),
#phone[data-game="marathon"] #phoneButtons button{
  background:var(--club-paper);color:var(--club-type);border:3px solid var(--club-ink);
  border-radius:13px;box-shadow:0 3px 0 var(--club-ink);font-weight:800;
}
#host[data-game="marathon"] :is(#buttons button:not(.secondary),#closeHelp,.readouts span),
#phone[data-game="marathon"] #phoneButtons button:not(.secondary){background:var(--club-gold)}
#host[data-game="marathon"] :is(#panel .secondary,#buttons a){background:var(--club-mint)}
#host[data-game="marathon"] #scores{gap:6px}
#host[data-game="marathon"] #scores span{
  border-radius:11px;background:var(--club-paper);padding:5px 9px;display:flex;gap:6px;align-items:center;
}
#host[data-game="marathon"] #scores span::before{
  content:'';width:.65em;height:.65em;border:2px solid var(--club-ink);background:var(--tint);border-radius:50%;
}
#host[data-game="marathon"] #count{background:#60436936}
#host[data-game="marathon"] #count>div{width:min(465px,86vw)}
#host[data-game="marathon"] #qr{border:3px solid var(--club-ink);background:white;border-radius:12px}
#host[data-game="marathon"] .roster{border-color:#e0c9bb}
#host[data-game="marathon"] .roster small{color:#624764}
#host[data-game="marathon"] .roster button{min-height:24px;padding:3px 8px;border-width:2px;border-radius:9px;box-shadow:none}
#host[data-game="marathon"] .roster .runner-portrait{border:2px solid var(--club-ink)}
#host[data-game="marathon"] :is(a,button):focus-visible,#phone[data-game="marathon"] :is(input,button):focus-visible{
  outline:3px solid #398d8d;outline-offset:4px;
}
#phone[data-game="marathon"]{
  background:linear-gradient(to bottom,#afcde6 0 23%,#604369 23% calc(23% + 4px),#f3ba90 calc(23% + 4px) 74%,#fff1d6 74% calc(74% + 5px),#604369 calc(74% + 5px) calc(74% + 9px),#d4e884 calc(74% + 9px));
}
#phone[data-game="marathon"] .phone-inner{padding:clamp(17px,5vmin,37px);opacity:1}
#phone[data-game="marathon"] #runnerHandPlayer{
  width:clamp(82px,22vmin,146px);border:4px solid var(--club-ink);
  box-shadow:0 4px 0 var(--club-ink);background-color:var(--phone-color);
}
#phone[data-game="marathon"] #playerName{color:var(--club-type);background:#fffaf1;border:3px solid var(--club-ink);border-radius:12px}
#phone[data-game="marathon"] #sensorStatus{color:#79425b}
@media(max-width:640px) and (orientation:portrait){
  #host[data-game="marathon"] #panel{bottom:max(5vh,env(safe-area-inset-bottom));left:5vw;max-width:90vw}
  #host[data-game="marathon"] #scores{gap:4px}
  #host[data-game="marathon"] #scores span{padding:3px 6px;border-width:2px}
}
@media(max-height:540px) and (orientation:landscape){
  #host[data-game="marathon"] #panel{padding:9px 16px;max-width:min(510px,68vw);border-radius:17px}
  #host[data-game="marathon"] :is(#gameTitle,#panelTitle){font-size:clamp(26px,4vw,40px)}
  #host[data-game="marathon"] .roster{padding:2px 0}
  #phone[data-game="marathon"] .phone-inner{padding:12px 18px}
}
/* The score row sits above the widened course, leaving the finish and distance boards clear. */
#host[data-game="marathon"] .bottom-hud{
  bottom:auto;top:max(var(--edge),env(safe-area-inset-top));
  left:clamp(112px,13vw,225px);right:clamp(150px,13vw,225px);justify-content:center;
}
#host[data-game="marathon"] #scores{justify-content:center}
#host[data-game="marathon"] #quick:empty{display:none}
@media(max-width:919px){
  #host[data-game="marathon"] .bottom-hud{
    top:calc(max(var(--edge),env(safe-area-inset-top)) + 42px);
    left:var(--edge);right:var(--edge);
  }
}
@media(max-height:480px) and (orientation:landscape){
  #host[data-game="marathon"] #scores span{padding:2px 5px;font-size:11px;border-width:2px;gap:3px}
}
@media(min-width:700px){
  #host[data-game="marathon"][data-stage="waiting"] #panel{
    left:auto;right:max(4vw,env(safe-area-inset-right));
  }
}
