/* Tree Hero, X11 / twm skin (hero suite kit 1.0.0): the weave root window, black on white windows with grey title strips,
   square buttons, MediumBlue for the selected branch. Plex Mono. Loaded after the page's own styles. */
body[data-skin=x11]{--ground:#FFFFFF;--ink:#000000;--dim:#4D4D4D;--acc:#0000CD;font-family:"Plex Mono",ui-monospace,Menlo,Consolas,monospace;-webkit-font-smoothing:none;color:#000}
:root{--weave:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='4' height='4' fill='%23fff'/%3E%3Crect width='1' height='1' fill='%23000'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23000'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%23000'/%3E%3Crect x='3' y='1' width='1' height='1' fill='%23000'/%3E%3C/svg%3E")}
[hidden]{display:none!important}

/* brand strip, top-left on every screen (tap = the menu) */
.topstrip{position:fixed;top:0;left:0;right:0;z-index:40;height:calc(52px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 6px 0;display:flex;align-items:center;background:#fff;border-bottom:2px solid #000}
.topstrip .brand{display:flex;align-items:center;gap:8px;min-height:44px;min-width:44px;padding:0 8px 0 2px;background:none;border:0;color:#000;font:inherit;cursor:pointer}
.topstrip .brand:focus-visible{outline:3px solid #0000CD;outline-offset:2px}
.brand [data-px] svg{height:auto}

/* the game is one xterm-like window */
/* one screen (P1FS32): #app's top margin collapsed through body and pushed it 60 px down, so the page was 60 px taller than the screen */
body{display:flow-root}
#app{width:calc(100% - 16px);max-width:900px;margin:calc(60px + env(safe-area-inset-top)) auto 8px;height:calc(100svh - 68px - env(safe-area-inset-top));background:#fff;border:2px solid #000;box-shadow:3px 3px 0 #000;
  padding:0 10px max(8px,env(safe-area-inset-bottom));
  grid-template-rows:auto auto auto auto minmax(0,1fr) auto auto auto auto auto;
  grid-template-areas:"xt" "hud" "clock" "coach" "board" "simnote" "branchguide" "fb" "pad" "submitrow"}
.xtitle{grid-area:xt;display:flex;align-items:center;gap:8px;height:28px;margin:0 -10px;padding:0 8px;background:#D9D9D9;border-bottom:2px solid #000;font:700 14px/1 "Plex Mono",monospace;white-space:nowrap}
.xtitle .grip{flex:1;height:12px;background:repeating-linear-gradient(#000 0 1px,transparent 1px 3px)}
#hud{min-height:2.8rem}
#hud #par{font-weight:700}
#parlab,#goal,#left{color:#000}
#clock{border-radius:0;height:8px;background:#D9D9D9;border:1px solid #000}#clock i{border-radius:0}
#coach{color:#000;font-weight:700}
canvas{border:0;border-top:2px solid #000;border-bottom:2px solid #000;border-radius:0;background:#fff}
#board{margin:.25rem -10px}
#hintLayer{border-radius:0}
#simnote{color:#4D4D4D;font-size:.78rem}
#branchGuide{color:#0000CD}
#branchGuide span:last-child{color:#000}
.lane{background:#fff;color:#000;border:2px solid #000;border-radius:0;min-height:5.2rem}
.lane .col,.lane .nm{color:#000;font-weight:700}
.lane .prev,.lane .preview{color:#4D4D4D}
.lane.best{box-shadow:inset 0 0 0 3px #0000CD;border-color:#000}
.lane:active,.lane.hit{background:#000}
.lane:active .col,.lane:active .nm,.lane:active .prev,.lane:active .preview,.lane.hit .col,.lane.hit .nm,.lane.hit .prev,.lane.hit .preview{color:#fff!important}
.lane:focus-visible{outline:3px solid #0000CD;outline-offset:2px}
.lane:disabled{opacity:.45}
#submitrow{padding:0 0 .3rem}
#submit.ready{box-shadow:0 0 0 3px #fff,0 0 0 6px #0000CD}

/* menu and the other screens are windows on the weave */
.screen{inset:calc(60px + env(safe-area-inset-top)) 8px 8px 8px;background:#fff;border:2px solid #000;box-shadow:3px 3px 0 #000;padding:0 12px 16px;max-width:900px;margin-inline:auto}
body:has(.screen:not(.hide)){}
.screen::before{display:block;position:sticky;top:0;z-index:2;margin:0 -12px .5rem;padding:7px 8px;height:28px;background:#D9D9D9;border-bottom:2px solid #000;font:700 14px/1 "Plex Mono",monospace;white-space:nowrap;content:"tree hero"}
#menu::before{content:"menu"}#why::before{content:"help"}#over::before{content:"result"}
#menu h1{display:none}
.screen h1{font-size:calc(var(--t-num)*.8);letter-spacing:.04em;color:#000}
.screen h2{color:#000;letter-spacing:.06em}
.screen p,.screen .sub{color:#000}
.screen .sub{color:#4D4D4D}
.eyebrow{color:#0000CD!important}
.screen .credit{margin:.6rem 0 .1rem;font-size:.95rem;color:#4D4D4D}
.credit a{color:#000;display:inline-flex;align-items:center;min-height:44px}
.mission div{border:2px solid #000;border-radius:0;background:#fff}
.mission b{color:#000}.mission span{color:#4D4D4D}
.dna{color:#0000CD!important}
.btn{background:#fff;color:#000;border:2px solid #000;border-radius:0;box-shadow:none;text-align:left;font-weight:700}
.btn:not(.ghost){background:#000;color:#fff}
.btn.ghost{background:#fff;color:#000;border:2px solid #000}
.btn:active{background:#000;color:#fff}.btn.ghost:active{background:#000;color:#fff}
.btn:focus-visible,.seg button:focus-visible{outline:3px solid #0000CD;outline-offset:2px}
.seg button{background:#fff;color:#000;border:1px solid #000;border-radius:0}
.seg button.on{background:#000;color:#fff;border-color:#000}
.seg button.btn{background:#000;color:#fff;border-color:#000}
.seg button.btn.ghost{background:#fff;color:#000;border-color:#000}
.seg button.btn:focus-visible{border:3px solid #0000CD}
#menu .plc-target,.plc-target{border:2px solid #000;border-radius:0;background:#fff}
#menu .plc-target__head{color:#000}
#menu .plc-target__count{color:#0000CD}
#menu .plc-target__track{border-radius:0;height:10px;background:#D9D9D9;border:1px solid #000}
#menu .plc-target__fill{border-radius:0;background:#0000CD}
pre.card{background:#fff;color:#000;border:2px solid #000;border-radius:0}
kbd{border:1px solid #000;border-radius:0;background:#fff;color:#000}
td{border-bottom:1px dashed #000}

/* the result: a fan-fold printout inside its window */
#over{--ink:#1F2420;--dim:#4A4538;--match:#1F2420;--mis:#EE0000;--warn:#EE0000;--acc:#0000CD;--edge:#8A806A;--panel:#FBFAF3;--bg:#FBFAF3;--faint:#6A6252;--board:#E9EFE2;--gap:#4A4538;--track:#CFC6AE;
  color:#1F2420;padding-left:38px;padding-right:38px;
  background-color:#FBFAF3;
  background-image:radial-gradient(circle at 11px 10px,#fff 0 4px,transparent 4.5px),radial-gradient(circle at calc(100% - 11px) 10px,#fff 0 4px,transparent 4.5px),repeating-linear-gradient(#FBFAF3 0 40px,#DCEBD6 40px 80px);
  background-size:22px 20px,22px 20px,auto;background-position:0 0,100% 0,0 0;background-repeat:repeat-y,repeat-y,repeat;background-attachment:local}
#over::before{margin:0 -38px .5rem}
#over h1,#over h2,#over p,#over td,#over .sub{color:#1F2420}
#over h2{color:#4A4538}
#over .btn{background:#000;color:#fff;border:0;text-align:center}
#over .btn.ghost{background:transparent;color:#1F2420;border:2px solid #000}
#over pre.card{background:transparent;color:#1F2420;border:2px dashed #8A806A}
#over td{border-bottom:1px dashed #8A806A}
body:has(#over:not(.hide)) .topstrip{background:#fff}

@media (max-width:359px){#over{padding-left:34px;padding-right:34px}#over::before{margin:0 -34px .5rem}}
@media (max-height:700px){#app{margin-top:calc(56px + env(safe-area-inset-top));height:calc(100svh - 62px - env(safe-area-inset-top))}.lane{min-height:3.8rem}#hud{min-height:2.2rem}}

.screen>.btn{display:flex;align-items:center;justify-content:flex-start;min-height:52px}
#submitrow small{color:#D9D9D9}
#submit.btn{display:flex;align-items:center;justify-content:center}
.screen::before{box-sizing:border-box;flex:none}
@media (max-height:700px){
  #simnote{display:none}
  #coach{min-height:0;font-size:.78rem;line-height:1.2}
  #goal{font-size:.78rem}
  #hud{min-height:0;gap:.3rem}
  #hud #par{font-size:1.5rem}
  #branchGuide{min-height:1.2rem;font-size:.8rem}
  #fb{min-height:1.2rem;font-size:.85rem}
  .lane{min-height:3.9rem;padding:.15rem .1rem}
  .lane .col{font-size:1.25rem}
  .lane .prev:empty{display:none}
  .lane .nm{font-size:.8rem}
  .lane .preview{display:none}
  .lane.undo{min-height:44px}
  #submit.btn{min-height:44px}
}
@media (max-height:700px){
  .topstrip{height:calc(44px + env(safe-area-inset-top))}
  #app{margin-top:calc(50px + env(safe-area-inset-top));height:calc(100svh - 56px - env(safe-area-inset-top))}
  .screen{inset:calc(50px + env(safe-area-inset-top)) 6px 6px 6px}
  #hud{grid-template-columns:auto 1fr;grid-template-areas:"par left" "goal goal"}
  #parwrap{grid-area:par}#left{grid-area:left}
  #goal{grid-area:goal;font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #coach{font-size:.72rem;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
  #branchGuide{white-space:normal;flex-wrap:wrap;gap:.1rem .4rem;min-height:1.2rem;line-height:1.15}
  #submitrow{gap:.4rem}
  .lane.undo{flex:0 0 36%;min-height:44px;padding:.2rem .4rem}
  .lane.undo .col{font-size:1.3rem}
  .lane.undo .nm{font-size:.8rem}
  .lane{gap:0}
}

/* the result sheet: sits on the bottom of the screen so the solved tree stays in view above it */
#over.sheet{inset:auto 8px 8px 8px;padding:8px 26px 12px;max-height:calc(100svh - 120px);gap:.4rem}
#over.sheet::before{display:none}
#over.sheet .verdict{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:.3rem}
#over.sheet h1{margin:0;font-size:1.3rem;line-height:1.15}
#over.sheet h1 small{display:block;margin-top:.15rem;font-size:.9rem;font-weight:700;color:#4A4538}
#over.sheet .verdict .btn{flex:0 0 auto;min-height:44px;padding:.4rem .8rem;font-size:.85rem;text-align:center}
#over.sheet pre.card{margin:0;font-size:.85rem;line-height:1.35}
#over.sheet>.btn{justify-content:center;text-align:center;min-height:48px;padding-block:.5rem}
#over.sheet .row3{flex-wrap:nowrap;gap:.4rem}
#over.sheet .row3 button{min-width:0;min-height:44px;padding:.3rem .2rem;font-size:.8rem;text-align:center;justify-content:center;line-height:1.1}
@media (max-height:700px){#over.sheet pre.card{display:none}}

/* short screens: the coach line is for lessons only; swap buttons drop the "with <name>" line (the selected branch line names the pair) */
@media (max-height:700px){
  body:not(.in-lesson) #coach{display:none}
  .lane .preview{display:none}
}
#hud #goal{font-size:24px;line-height:1.15;color:#000;white-space:normal;overflow:visible}
