
:root{color-scheme:dark;--bg:#0b181a;--base:#132629;--edge:#345052;--text:#f0f5eb;--sub:#b6cbc4;--gold:#ffcb82;--cyan:#9ce6ff;--green:#8ceabd;--ember:#ffac80;font:16px/1.5 system-ui,sans-serif}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0;color:var(--text);background:radial-gradient(ellipse at top,#244047,var(--bg) 60%);min-height:100vh}main{width:min(100% - 1.15rem,1010px);margin:auto;padding:1rem 0 3rem}header,.scene,.row,.selectors,.stats{display:flex;flex-wrap:wrap;align-items:center;gap:.55rem}header,.scene{justify-content:space-between}header{border-bottom:1px solid var(--edge);padding:0 .15rem .8rem;margin-bottom:1rem}h1,h2,h3,p{margin:.2rem 0 .65rem}h1{font-size:clamp(1.2rem,4vw,1.85rem);line-height:1.2}h2{font-size:clamp(1.55rem,5vw,2.6rem);line-height:1.15}h3{font-size:1rem}.eyebrow{font-size:.72rem;color:var(--gold);letter-spacing:.17em;font-weight:800}.hero{border:1px solid var(--edge);border-radius:1.1rem;padding:clamp(1rem,5vw,3rem);margin:1rem 0;background:linear-gradient(125deg,#233c3c,#15282a);box-shadow:0 .7rem 2rem #020b1050}.hero>p{max-width:58ch}.subtle{color:var(--sub);font-size:.91rem}.hint{background:#173c42;color:#d7f4f3;padding:.52rem .65rem;margin:.3rem 0 .65rem;border-left:3px solid var(--cyan);border-radius:.3rem}.selectors{margin:.8rem 0;gap:1rem}label{display:grid;gap:.2rem;color:var(--sub);font-size:.91rem}button,select{color:var(--text);border:1px solid #587678;background:#203d3f;border-radius:.45rem;padding:.52rem .72rem;font:inherit;cursor:pointer}button:hover,select:hover{background:#305255}button:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}button:disabled{opacity:.52;cursor:not-allowed}.primary{background:var(--gold);color:#1e2020;border-color:var(--gold);font-weight:750}.primary:hover{background:#ffe1b4}.stats span{padding:.23rem .5rem;border:1px solid var(--edge);border-radius:1rem;font-size:.84rem}.stats{margin:.6rem 0}.game{display:grid;grid-template-columns:minmax(0,2fr) minmax(200px,1fr);gap:1.1rem;margin-top:.55rem}.game aside{background:var(--base);padding:.6rem .75rem;border:1px solid var(--edge);border-radius:.65rem}.controls{justify-content:center;margin:.6rem 0}.controls button{font-size:1.2rem;padding:.22rem .7rem;min-width:43px}.actions{display:grid;gap:.28rem}.actions button{text-align:left}.actions kbd{float:right;color:var(--cyan)}ol#log{font-size:.85rem;list-style:none;padding:0;color:var(--sub);min-height:3.4em}ol#log li+li{border-top:1px solid #ffffff18}.game details{font-size:.83rem;color:var(--sub)}summary{cursor:pointer}.tile{min-width:0;min-height:0;padding:0;aspect-ratio:1.04;border-radius:.2rem;border:1px solid #2e4b48;font-size:clamp(.83rem,3.6vw,1.36rem);font-weight:750;text-align:center;line-height:1}.tile.wall{background:#172528;border-color:#27383a;color:#627672;cursor:default}.tile.fog{background:#0b181a;border-color:#19292a;color:#506260}.tile.water{background:#254b5f;color:var(--cyan)}.tile.ember{background:#552f21;color:var(--ember)}.tile.foe{color:#ffd4cc;background:#713732;border-color:#ad5d51}.tile.loot{background:#504025;color:var(--gold)}.tile.door{background:#215448;color:var(--green)}.tile.player{color:#132331;background:var(--cyan);border-color:#fff}.tile.focusFoe{outline:2px dashed var(--gold);outline-offset:-3px}#board{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:2px;padding:4px;border:1px solid var(--edge);border-radius:.5rem;background:#102022;max-width:570px;margin:auto;touch-action:manipulation}dialog{width:min(42rem,calc(100% - 1.5rem));max-height:95vh;overflow:auto;background:var(--base);color:var(--text);border:1px solid var(--edge);border-radius:.7rem;padding:1rem}dialog::backdrop{background:#041013dd}dialog img{width:100%;max-height:65vh;object-fit:contain}pre{white-space:pre-wrap;font:inherit;color:var(--sub)}@media(max-width:670px){.game{grid-template-columns:1fr;gap:.28rem}.game aside .actions{grid-template-columns:repeat(2,minmax(0,1fr))}.game aside{padding:.45rem}.game aside .actions button{font-size:.81rem;padding:.35rem}header>button,.scene>button{font-size:.8rem}.eyebrow{letter-spacing:.09em}ol#log{min-height:0}}
canvas{display:block;width:100%;background:#152f34;border:2px solid #436565;border-radius:.6rem;touch-action:none;box-shadow:0 .5rem 1.5rem #02091177}canvas:focus-visible{outline:2px solid var(--cyan)}.touch{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem;margin:.6rem 0}.dpad{display:grid;grid-template-columns:repeat(3,44px);grid-template-areas:"." "w";gap:3px;grid-template-areas:". up ." "left down right"}.dpad button{touch-action:none;padding:4px 0;min-height:42px}.dpad button:nth-child(1){grid-area:up}.dpad button:nth-child(2){grid-area:left}.dpad button:nth-child(3){grid-area:down}.dpad button:nth-child(4){grid-area:right}.touch>div:last-child{align-content:center}.touch>div:last-child button{padding:.35rem .6rem}.choices{display:grid;gap:.5rem}.choices button{text-align:start}.hint{font-size:.93rem}#notice{min-height:1.3em}.stats span:first-child{color:#9ee6cc}
:root{--bg:#0c1820;--base:#142432;--edge:#435761;--text:#fef6df;--sub:#bbc9cb;--gold:#fdd79a;--cyan:#abeafe;--green:#b3ead0}
body{background:radial-gradient(ellipse at 63% 3%,#24494c 0%,transparent 44%),linear-gradient(150deg,#101e2b,#0a151b 66%)}
main{width:min(100% - 1.3rem,1110px);padding-top:1.2rem}
header{border-color:#7c918a50;align-items:end;padding-bottom:1rem}
.hero{position:relative;isolation:isolate;overflow:hidden;background:linear-gradient(110deg,#1b2f3a,#16333b 56%,#20314a);min-height:360px}
.heroart{position:absolute;inset:0;z-index:-1;background:radial-gradient(ellipse at 72% 53%,#c8eee33b,transparent 40%),linear-gradient(90deg,#182936 25%,transparent 65%),url("sprites/sentinela.png") no-repeat 86% 35% / auto 115%;opacity:.8;pointer-events:none}
h1,h2{letter-spacing:-.025em}h2{font-family:Georgia,serif}header .eyebrow{color:#b9ddcf}
.hero h2{font-size:clamp(2.4rem,7vw,5rem);line-height:1.04;margin:.18rem 0 .65rem}
.hero>.eyebrow{color:#f9d8a4}.hero p{max-width:min(52ch,60%)}.hero .hint{width:fit-content}
#playView{position:relative}.scene{align-items:end}.scene h2{margin:0;font-size:clamp(1.5rem,4vw,2.4rem)}
.stats{gap:.47rem;margin:.65rem 0 .35rem}.stats span{background:#182c39;color:#e8e9de;font-weight:650;border-color:#50677274}
.health{height:5px;max-width:100%;overflow:hidden;background:#253b40;border-radius:5px;margin-bottom:.5rem}.health i{display:block;height:100%;width:100%;background:linear-gradient(90deg,#e98e67,#ffd098,#a8f0c0);transform-origin:left;transition:transform .15s}
canvas{border:1px solid #687e78;border-radius:.75rem;isolation:isolate;box-shadow:0 16px 65px #030d15b0}
#playView .hint,#playView #notice{margin:.3rem 0;padding:.22rem .52rem;min-height:.95rem;font-size:clamp(.74rem,2.4vw,.89rem)}
#notice{color:#dddac2;background:#172b33;border-radius:.35rem}
.touch button{border-color:#536777;background:#213947}.touch button:hover{background:#2d5567}
button,select{border-color:#586872;background:#203844}.primary{background:linear-gradient(135deg,#ffe0a7,#e6ae78);color:#32261a}
@media (max-width:660px){.heroart{opacity:.27;background-position:86% top;background-size:auto 94%}.hero p{max-width:100%}.hero h2{font-size:clamp(2.2rem,9vw,3.75rem)}.touch .dpad{grid-template-columns:repeat(3,38px)}.touch .row{gap:.28rem}.touch .row button{font-size:.75rem;min-height:39px}.scene{margin-bottom:.35rem}.stats span{font-size:.72rem;padding:.16rem .37rem}}
@media (min-width:900px) and (max-height:900px){#playView canvas{width:auto;max-width:100%;max-height:calc(100svh - 235px);height:auto;margin-inline:auto}header{margin-bottom:.58rem}#playView .touch{margin:.3rem 0}#playView .scene{margin-bottom:0}}

.heroart{background:radial-gradient(ellipse at 72% 53%,#c8eee33b,transparent 40%),linear-gradient(90deg,#182936 25%,transparent 65%),var(--hero-art,url("sprites/sentinela.png")) no-repeat 91% 30% / auto 104%}
#roster{display:flex;gap:.44rem;flex-wrap:wrap;max-width:min(560px,73%);margin:.65rem 0}
#roster button{display:grid;grid-template-columns:44px 1fr;align-items:center;gap:.2rem;min-height:59px;min-width:108px;flex:1 0 0;padding:.2rem .42rem;font-size:.85rem;line-height:1.13;text-align:left;border:1px solid #688d90;background:#081e2bcc}
#roster button[aria-pressed=true]{border-color:#f3d6aa;background:#306365ca;box-shadow:inset 0 0 0 1px #f3d6aa47;font-weight:bold}
#roster img{width:44px;height:54px;object-fit:cover;object-position:50% 10%;pointer-events:none;border-radius:4px;background:#276a7f33}
@media(max-width:660px){#roster{max-width:100%}#roster button{grid-template-columns:1fr;text-align:center;justify-items:center;min-width:82px;padding:.17rem;font-size:.72rem}#roster img{width:35px;height:38px}}

/* Hand-bound cards from the two banks of Terramar */
#boon{width:min(40rem,calc(100% - 1rem));max-height:calc(100dvh - 1rem);text-align:center;padding:clamp(.9rem,3.8vw,2.05rem);border:1px solid #c5a374;background:radial-gradient(ellipse at top,#31545a,#192c36 52%,#111d27);box-shadow:0 0 0 4px #192c36,0 0 0 5px #846c4f,0 20px 80px #030911bc}
#boon::backdrop{background:#06141cce;backdrop-filter:blur(3px)}
#boonTitle{margin:.4rem 0;color:#ffe0a7}
#boonNote{max-width:46ch;margin:.45rem auto 1.2rem;color:#d5e3dd;font-size:.94rem}
#boon .choices{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch;gap:clamp(.32rem,2vw,.8rem);perspective:750px}
#boon .tide-card{position:relative;isolation:isolate;display:grid;place-items:stretch;min-width:0;padding:clamp(.28rem,1.4vw,.7rem);min-height:clamp(9rem,33vw,14rem);text-align:center;border:1px solid #b48d58;border-radius:.62rem;color:#ffe0a7;background:radial-gradient(ellipse at 50% 35%,#316e70,#183d4c 56%,#142537);box-shadow:0 6px 12px #040e167d;transition:transform .18s,box-shadow .18s}
#boon .tide-card-body{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.43rem;min-width:0;border:1px solid #bda07476;border-radius:.35rem;padding:.35rem .1rem;background:repeating-linear-gradient(45deg,#a9efea05 0 1px,transparent 1px 11px)}
#boon .tide-card:enabled:hover{transform:translateY(-5px);box-shadow:0 8px 18px #071218,0 0 12px #83dfdd53;background:radial-gradient(ellipse at 50% 35%,#397e7e,#214d58 56%,#192f43)}
#boon .tide-card strong{font:700 clamp(.76rem,2.6vw,1.05rem)/1.16 Georgia,serif;overflow-wrap:anywhere;color:#ffedc7}
#boon .tide-card small{font-size:clamp(.62rem,2.1vw,.82rem);line-height:1.2;color:#cce8df;overflow-wrap:anywhere}
#boon .tide-seal{display:grid;place-items:center;border:1px solid #e3bd80;outline:1px dashed #e3bd8069;outline-offset:3px;border-radius:50%;width:clamp(1.85rem,7vw,3.65rem);aspect-ratio:1;font-size:clamp(1.18rem,4.8vw,2.2rem);margin:.1rem auto .35rem;background:#0b283a96;text-shadow:0 0 .7rem #bceceb8a}
#boon .tide-card.unchosen{opacity:.5;cursor:default}
#boon .tide-card.turned{opacity:1;cursor:default;border-color:#f2ca84;background:radial-gradient(ellipse at 50% 35%,#59503b,#293b40 62%,#192933);box-shadow:0 0 20px #fccf853e;animation:tide-turn .48s both}
#boonContinue{margin-top:1.15rem}
.boon-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);margin:0}
@keyframes tide-turn{0%{transform:rotateY(-88deg);opacity:.25}100%{transform:rotateY(0);opacity:1}}
@media(prefers-reduced-motion:reduce){#boon .tide-card{animation:none;transition:none}#boon .tide-card:enabled:hover{transform:none}}

@supports selector(:has(*)){
 @media(max-width:440px){
  #boon .choices:has(.tide-card.turned:nth-child(1)){grid-template-columns:minmax(0,1.72fr) repeat(2,minmax(0,1fr))}
  #boon .choices:has(.tide-card.turned:nth-child(2)){grid-template-columns:minmax(0,1fr) minmax(0,1.72fr) minmax(0,1fr)}
  #boon .choices:has(.tide-card.turned:nth-child(3)){grid-template-columns:repeat(2,minmax(0,1fr)) minmax(0,1.72fr)}
 }
}

