:root {
  color-scheme: light;
  --paper: #f5f1e7;
  --sheet: #fffaf0;
  --ink: #152c2b;
  --muted: #52645d;
  --rule: #c7c5b4;
  --night: #102927;
  --deep: #091e20;
  --light: #faf2de;
  --gold: #f2ca7a;
  --brass: #b69453;
  --brick: #863e2d;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --display: "Instrument Sans", "Avenir Next", "Segoe UI", Arial, sans-serif;
  font-family: var(--display);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* {box-sizing:border-box}
body {margin:0;min-height:100dvh}
button,input,select,summary,a {touch-action:manipulation}
button,select,input {font:inherit}
button {cursor:pointer;color:inherit;-webkit-tap-highlight-color:transparent}
button:disabled {cursor:default}
button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible {outline:3px solid #cb7537;outline-offset:3px}
[hidden] {display:none!important}
.symbols {position:absolute;inline-size:0;block-size:0;overflow:hidden;pointer-events:none}
.ico,.tool svg {display:inline-block;flex:none;width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.sr {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.shell {max-width:1600px;margin:0 auto;padding:0 clamp(14px,3.3vw,64px) max(32px,env(safe-area-inset-bottom))}
.mast,.mast nav,.mast-tools,.actions,.selection-heading,.crew-trigger,.manifest,.crew-label,.choose-crew,.fort-stops,.route-progress>div:first-child {display:flex;align-items:center}
.mast {min-height:78px;gap:24px;padding:8px 0;margin:0 0 16px;border-bottom:1px solid var(--rule)}
.brand {flex:1;line-height:0}.brand img {display:block;width:106px;max-height:54px;object-fit:contain;object-position:left}
.mast nav {gap:clamp(20px,2.6vw,42px)}
.mast nav button,.mast nav a {display:inline-flex;align-items:center;min-height:44px;border:0;background:none;padding:4px 0;color:var(--ink);font-size:.92rem;font-weight:650;text-decoration:none}
.mast nav button:hover,.mast nav a:hover {color:var(--brick);text-decoration:underline;text-underline-offset:5px}
.mast-tools {gap:5px;padding-left:16px;border-left:1px solid var(--rule)}
.tool {display:inline-grid;place-items:center;flex:none;width:44px;height:44px;padding:0;border:1px solid #bcbfae;border-radius:50%;background:transparent}
.tool:hover {background:#e7e3d6}.tool .mute,.tool[aria-pressed=false] .waves {display:none}.tool[aria-pressed=false] .mute {display:block}
.feature {overflow:hidden;border-radius:16px;color:var(--light);background:var(--night);box-shadow:0 5px 16px #29352d19}
.cover {isolation:isolate;position:relative;display:flex;align-items:center;overflow:hidden;min-height:clamp(378px,54svh,600px);background:var(--deep);--campaign-color:#f2ca7a}
.panorama,.captain,.cover-near,.cover::after {position:absolute;pointer-events:none}
.panorama {inset:-1%;width:102%;height:102%;object-fit:cover;object-position:var(--focus,60%) 48%;z-index:-4}
.captain {z-index:-2;right:3%;bottom:-5%;width:41%;height:103%;object-fit:contain;object-position:center bottom;filter:drop-shadow(-7px 6px 10px #0a222e75)}
.cover-near {z-index:-1;left:-2%;top:-4%;width:22%;max-height:37%;object-fit:contain;object-position:left top;opacity:.83}
.cover::after {content:"";z-index:-1;inset:0;background:linear-gradient(90deg,#091e22ee 0%,#0c2226b5 28%,#11252914 58%,transparent 80%),linear-gradient(0deg,#102622a8,transparent 31%)}
.cover-content {position:relative;z-index:1;width:min(60%,760px);padding:clamp(22px,3.4vw,56px);display:grid;justify-items:start;gap:clamp(15px,2.6vh,26px)}
.cover h1,.cover h2,.selection-heading h2,.dialog-head h2,.panel h2,.crew-file h3 {margin:0}
.cover h1 {line-height:0;width:min(100%,520px)}
.cover h1 img {display:block;width:100%;height:auto;max-height:clamp(95px,19vh,170px);object-fit:contain;object-position:left;filter:drop-shadow(0 4px 4px #0a2023a6)}
.eyebrow,.crew-label small,.route-progress small,.route-copy small,.dialog-head small,.file-copy>small,.panel-art small {display:block;font-size:.73rem;line-height:1.35;font-weight:750;text-transform:uppercase;letter-spacing:.115em}
.eyebrow {color:var(--campaign-color);display:flex;align-items:center;gap:9px}
.eyebrow::before {content:"";width:21px;height:1px;background:currentColor}
.cover h2 {font:500 clamp(1.8rem,3.3vw,3.25rem)/1.03 var(--serif);letter-spacing:-.04em;color:#fff6e3;text-wrap:balance;margin:5px 0 6px}
.cover-copy p {margin:0;max-width:43ch;font-size:clamp(.96rem,1.2vw,1.1rem);line-height:1.45;color:#f2ead8;text-shadow:0 1px 4px #0b211e}
.actions {flex-wrap:wrap;gap:10px}
.primary,.secondary,.choose-crew {display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:46px;padding:10px 18px;border:1px solid transparent;border-radius:9px;font:750 .95rem/1.2 var(--display);text-align:center}
.primary {color:#202c22;background:var(--gold);border-color:#ffe1a4;box-shadow:0 2px 4px #101e1c22}
.primary:hover {background:#ffdc98}.primary:disabled {color:#d4ddd1;background:#3d5353;border-color:#63736c;box-shadow:none}
.secondary {color:var(--light);background:#0f292ad9;border-color:#e0d4ac9c}.secondary:hover {background:#274041}
.actions .ico {width:18px;height:18px}
.manifest {position:relative;gap:0;background:#102a29;border-top:1px solid #a9935e96}
.crew-trigger {text-align:left;min-width:0;flex:1.16;gap:14px;padding:12px clamp(16px,3.3vw,52px);color:var(--light);background:none;border:0}
.crew-trigger:hover .choose-crew,.crew-trigger:focus-visible .choose-crew {color:#172a26;background:var(--gold)}
.cameo {flex:none;display:block;width:58px;height:58px;overflow:hidden;border:1px solid #b59d6f;border-radius:12px;background:radial-gradient(ellipse at 50% 93%,#9c875d,#426056 65%,#2d433b)}
.cameo img {height:144%;width:100%;object-fit:cover;object-position:center 0}
.crew-label {display:grid;gap:2px;min-width:0}.crew-label small,.route-progress small {color:#c5cbc0}
.crew-label strong {font:500 clamp(1.15rem,1.6vw,1.55rem)/1.12 var(--serif);overflow-wrap:break-word}
.crew-label>span {font-size:.87rem;color:#dfcfac}
.choose-crew {margin-left:auto;min-height:42px;padding:6px 11px;color:#f2dbac;border-color:#8c927d;font-size:.87rem}.choose-crew .ico {width:17px;height:17px}
.route-progress {flex:.83;padding:2px clamp(16px,3.3vw,52px);border-left:1px solid #627366;min-width:0}
.route-progress>div:first-child {justify-content:space-between;gap:6px;flex-wrap:wrap}
.route-progress>div:first-child span {color:#e7d6ae;font-size:.76rem}
.fort-stops {position:relative;justify-content:space-between;gap:4px}
.fort-stops::before {content:"";position:absolute;left:21px;right:21px;top:50%;height:1px;background:#697b68}
.fort-stop {isolation:isolate;position:relative;display:grid;place-items:center;min-width:44px;min-height:44px;border:0;background:none;color:#d0d6c6;font-size:.73rem;font-weight:700;font-variant-numeric:tabular-nums}
.fort-stop::before {content:"";position:absolute;z-index:-1;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:30px;height:25px;border:1px solid #75836e;border-radius:5px;background:#193430}
.fort-stop[data-state=next],.fort-stop:hover {color:#1b2e27}.fort-stop[data-state=next]::before,.fort-stop:hover::before {background:var(--gold);border-color:var(--gold)}
.fort-stop[data-state=done]::before {background:#35594b;border-color:#94c6a5}
.campaign-index {margin-top:clamp(24px,3.4vw,46px);scroll-margin-top:12px}
.selection-heading {justify-content:space-between;gap:10px;margin-bottom:15px}
.selection-heading h2,.dialog-head h2 {font:500 clamp(1.95rem,3vw,3rem)/1.02 var(--serif);letter-spacing:-.045em}
.total-progress {display:grid;justify-items:end;gap:5px;color:var(--muted);font-size:.85rem;font-weight:600;font-variant-numeric:tabular-nums}
.total-progress progress {display:block;appearance:none;width:100%;max-width:140px;height:3px;border:0;background:#d5d3c5;color:var(--brick);border-radius:4px;overflow:hidden}
progress::-webkit-progress-bar {background:#d5d3c5}progress::-webkit-progress-value {background:var(--brick)}progress::-moz-progress-bar {background:var(--brick)}
.campaigns {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:clamp(10px,1.25vw,20px)}
.route {position:relative;min-width:0;display:flex;flex-direction:column;align-items:stretch;text-align:left;padding:0;background:var(--sheet);border:1px solid var(--rule);border-radius:10px;overflow:hidden;color:var(--ink)}
.route[aria-pressed=true] {border-color:#274e40;box-shadow:0 0 0 1px #274e40}.route:hover {border-color:#638074}
.route-art {width:100%;aspect-ratio:2.12;display:block;object-fit:cover}.route-copy {padding:11px clamp(8px,1.05vw,17px) 15px;display:grid;gap:4px}
.route-copy small {font-size:.69rem;letter-spacing:.085em;color:var(--brick)}
.route-copy b {font:600 clamp(1.01rem,1.45vw,1.45rem)/1.12 var(--serif);letter-spacing:-.02em;text-wrap:balance}
.route-count {position:absolute;right:6px;top:6px;padding:3px 6px;color:#fff3da;background:#102b29ed;border:1px solid #e9d7a35c;border-radius:4px;font-size:.69rem;font-weight:650;font-variant-numeric:tabular-nums}
.route[aria-pressed=true] .route-count {background:#e8d4a0;color:#173629}
.route[aria-pressed=true] .route-copy::before {content:"";position:absolute;left:0;bottom:0;height:3px;width:100%;background:#325942}
@media(hover:hover) and (prefers-reduced-motion:no-preference){button,a{transition:background-color .16s,border-color .16s,color .16s}.route-art{transition:filter .18s}.route:hover .route-art{filter:brightness(1.13)}}
@media(prefers-reduced-motion:no-preference){
  .panorama{animation:coast 18s ease-in-out infinite alternate}
  .cover-near{transform-origin:top left;animation:breeze 9s ease-in-out infinite alternate}
  @keyframes coast{from{transform:scale(1.004)}to{transform:scale(1.032) translateX(-.3%)}}
  @keyframes breeze{from{transform:rotate(-1deg)}to{transform:rotate(1.4deg)}}
}
@media(max-width:950px){.campaigns{grid-template-columns:repeat(3,minmax(0,1fr))}.route-copy b{font-size:1.23rem}.route-progress{flex:.9}.crew-trigger{padding-inline:18px}.route-progress{padding-inline:18px}}
@media(max-width:700px){
  .shell{padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}
  .mast{min-height:60px;padding-top:max(7px,env(safe-area-inset-top));gap:8px;margin-bottom:10px}.brand img{width:85px}.mast nav{display:none}.mast-tools{border:0;padding:0}.tool{width:44px;height:44px}
  .feature{border-radius:12px}.cover{align-items:stretch;min-height:0}.cover-content{width:72%;min-height:clamp(325px,44svh,400px);padding:19px 0 18px 18px;align-content:space-between;gap:17px}
  .cover h1{width:min(109%,310px)}.cover h1 img{max-height:104px}.cover h2{font-size:clamp(1.62rem,5.5vw,2.2rem);margin:4px 0 7px}.cover-copy p{font-size:.91rem;max-width:30ch}
  .captain{height:83%;width:58%;right:-5%;bottom:0}.cover-near{width:30%;max-height:28%}
  .cover::after{background:linear-gradient(90deg,#091e25cf 0%,#0c22269c 30%,#11252905 73%),linear-gradient(0deg,#0c2326f2,transparent 41%)}
  .actions{gap:7px;width:max-content;max-width:calc(100vw - 60px)}.actions button{padding:9px 12px;font-size:.89rem}
  .manifest{flex-direction:column;align-items:stretch}.crew-trigger{padding:10px 15px;gap:10px}.cameo{width:48px;height:48px;border-radius:9px}.crew-label{gap:1px}.crew-label strong{font-size:1.25rem}.crew-label>span{font-size:.8rem}
  .route-progress{padding:0 15px 3px;border:0;display:flex;align-items:center;gap:10px}.route-progress>div:first-child{display:grid;gap:1px}.route-progress small{font-size:.65rem;letter-spacing:.06em}.route-progress>div:first-child span{font-size:.71rem}.fort-stops{flex:1}
  .campaign-index{margin-top:24px}.campaigns{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.route-art{aspect-ratio:2.25}.route-copy{padding:9px 9px 12px;gap:4px}.route-copy b{font-size:1.13rem}
  .campaigns .route:last-child:nth-child(odd){grid-column:1/-1;display:grid;grid-template-columns:46% 1fr;align-items:center}.campaigns .route:last-child:nth-child(odd) .route-art{height:100%;min-height:75px}.campaigns .route:last-child:nth-child(odd) .route-count{right:auto;left:6px}
  .selection-heading{margin-bottom:11px}.cover .eyebrow{font-size:.66rem}
}
@media(max-width:370px){.cover-content{padding-left:13px;width:78%}.actions{gap:5px}.actions button{padding:9px;font-size:.84rem}.choose-crew{padding:7px}.crew-trigger{padding-inline:10px}.route-progress{padding-inline:10px}.route-copy b{font-size:1.04rem}}
@media(orientation:landscape) and (max-height:540px){.mast{min-height:48px;margin-bottom:8px}.brand img{width:70px}.cover-content{min-height:0;gap:9px;padding:15px 24px}.cover{min-height:245px}.cover h1 img{max-height:71px}.cover h2{font-size:1.65rem}.cover-copy p{font-size:.88rem}.manifest{min-height:65px}.cameo{width:42px;height:42px}.crew-trigger{padding-block:8px}}

dialog {color:var(--ink);background:var(--paper);border:1px solid #99a493;border-radius:16px;box-shadow:0 22px 90px #071f24a8;padding:0;width:min(760px,calc(100% - 32px));max-width:calc(100vw - 16px);max-height:min(88dvh,850px);overflow:auto;overscroll-behavior:contain;scrollbar-color:#948f79 var(--paper)}
dialog::backdrop {background:#091f24bf}
.dialog-head {position:sticky;top:0;z-index:3;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:17px clamp(16px,2.4vw,30px);border-bottom:1px solid #718271;background:var(--night);color:var(--light)}
.dialog-head small {color:#dac79d;margin-bottom:5px;letter-spacing:.09em}.dialog-head h2{font-size:clamp(1.8rem,2.7vw,2.65rem)}
.dialog-head .tool {border-color:#96a18c82;color:var(--light)}.dialog-head .tool:hover{background:#2b4940}
#roster {width:min(960px,calc(100% - 36px))}
.roster-body {display:grid;grid-template-columns:minmax(0,.97fr) minmax(0,1.03fr);align-items:start}
.roster-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:clamp(12px,1.65vw,24px);align-content:start}
.crew-card {position:relative;overflow:hidden;display:grid;grid-template-columns:clamp(48px,5vw,65px) minmax(0,1fr);align-items:center;min-width:0;min-height:65px;gap:7px;padding:0 5px 0 0;border:1px solid var(--rule);border-radius:8px;background:var(--sheet);color:var(--ink);text-align:left}
.crew-card img {display:block;width:100%;height:100%;min-height:65px;max-height:86px;object-fit:cover;object-position:center 8%;background:radial-gradient(ellipse at 45% 65%,#7a8770,#334e47)}
.crew-card b {display:block;padding:5px 0;font:650 .87rem/1.23 var(--display);overflow-wrap:break-word}
.crew-card[aria-pressed=true] {background:#e5e9da;border-color:#3a634f;box-shadow:inset 0 0 0 1px #3a634f}
.crew-card[aria-pressed=true]::after {content:"✓";position:absolute;left:3px;bottom:3px;display:grid;place-items:center;width:17px;height:17px;background:#184637;color:#fff4d2;border:1px solid #d5dbc3;border-radius:50%;font:bold 11px/1 Arial,sans-serif}
.crew-card:hover {border-color:#71816b}
.crew-file {position:relative;overflow:hidden;margin:15px 16px 16px 0;border:1px solid var(--rule);border-radius:10px;background:var(--sheet)}
.file-portrait {position:relative;isolation:isolate;overflow:hidden;height:clamp(110px,19dvh,180px);border-bottom:1px solid #9d967b;background:radial-gradient(ellipse at 58% 120%,#9aa188 -20%,#456158 50%,#203d3b 98%)}
.file-portrait::after {content:"";position:absolute;inset:8px;border:1px solid #dccba544;z-index:-1}
.file-portrait img {width:100%;height:172%;display:block;object-fit:contain;object-position:center top;margin-top:5px}
.crew-back {display:none}
.file-copy {padding:14px clamp(13px,1.4vw,22px) 17px}
.file-copy>small {color:var(--brick)}.crew-file h3 {font:550 clamp(1.65rem,2.7vw,2.5rem)/1.06 var(--serif);letter-spacing:-.04em;margin:3px 0 12px;overflow-wrap:break-word}
.crew-power {display:flex;align-items:flex-start;gap:8px;padding:10px 0;border-block:1px solid var(--rule)}.crew-power>.ico{color:#8c5723;width:21px}.crew-power b {display:block;font-size:.96rem}
.crew-power p,.file-copy>p {font-size:.9rem;line-height:1.42;margin:3px 0 0;color:#3b4f45}
.file-copy>p {margin:12px 0 3px}.file-copy a {display:inline-flex;align-items:center;min-height:32px;font-size:.85rem;color:#773d2c;text-decoration:underline;text-underline-offset:3px}
.crew-file .primary {width:100%;margin-top:10px}
.atlas-body,.guide-body {padding:clamp(14px,2.2vw,26px)}
.chart-filter {display:flex;align-items:center;gap:12px;color:var(--muted);margin:0 0 16px;font-size:.88rem;font-weight:650}
.chart-filter select {appearance:none;color:var(--ink);background-color:var(--sheet);font-size:1rem;font-weight:600;flex:1;min-width:0;min-height:44px;padding:9px 36px 9px 12px;border:1px solid #a1ad9b;border-radius:8px;background-image:linear-gradient(45deg,transparent 50%,#53685a 51%),linear-gradient(135deg,#53685a 50%,transparent 51%);background-position:calc(100% - 18px) 51%,calc(100% - 13px) 51%;background-size:5px 5px;background-repeat:no-repeat}
#level-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.level {position:relative;display:flex;flex-direction:column;min-width:0;overflow:hidden;padding:0;text-align:left;border:1px solid var(--rule);border-radius:9px;background:var(--sheet)}
.level:hover {border-color:var(--brick)}.level>img {display:block;width:100%;aspect-ratio:3.25;object-fit:cover}
.level-copy {display:grid;gap:4px;padding:10px 12px 13px}.level-copy b{font:600 clamp(1.08rem,1.6vw,1.4rem)/1.12 var(--serif);letter-spacing:-.02em}.level-copy small{color:var(--muted);font-size:.8rem}
.rating {position:absolute;top:7px;right:7px;background:#0c2926de;border:1px solid #d4d3b878;padding:3px 6px;color:#fff4d2;border-radius:4px;line-height:1;letter-spacing:.07em;font-size:.84rem}.rating[data-earned=true]{color:#ffd877}
#guide {width:min(575px,calc(100% - 28px))}
.guide-intro {font:500 1.26rem/1.3 var(--serif);margin:0 0 14px}
.guide-steps {list-style:none;padding:0;margin:0}.guide-steps li {display:grid;grid-template-columns:34px 1fr;align-items:start;gap:10px;border-top:1px solid var(--rule);padding:10px 0}
.guide-steps .ico{width:28px;height:28px;color:var(--brick);padding:3px;background:#eae5d5;border-radius:6px}.guide-steps b{font-size:1rem}.guide-body p:not(.guide-intro){font-size:.93rem;line-height:1.45;margin:3px 0 4px}
.guide-body details{border-top:1px solid var(--rule)}.guide-body summary{cursor:pointer;padding:14px 0;font-weight:650;font-size:.93rem}
.guide-body a{color:var(--brick)}kbd{font-family:inherit;font-weight:700}
@media(max-width:700px){
  dialog,#roster,#guide {width:calc(100% - 16px);max-width:560px;max-height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-radius:13px}
  .dialog-head{padding:12px 14px}.dialog-head h2{font-size:1.9rem}.dialog-head small{font-size:.67rem}
  .roster-body{display:block}.roster-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:10px}
  .crew-card{grid-template-columns:clamp(42px,12vw,62px) minmax(0,1fr);min-height:65px;gap:6px}.crew-card b{font-size:.85rem}
  #roster[data-view=list] .crew-file,#roster[data-view=detail] .roster-grid {display:none}
  .crew-file{margin:0;border:0;border-radius:0}.crew-back{display:inline-flex;align-items:center;gap:6px;border-radius:7px;background:#193730ed;color:#f8eed8;border:1px solid #d8cba28c;padding:7px 9px;min-height:44px;position:absolute;left:10px;top:8px;z-index:1;font-size:.8rem;font-weight:650}
  .crew-back .ico{width:17px;height:17px}.file-portrait{height:clamp(118px,22dvh,195px)}.file-copy{padding:14px 16px}.file-copy h3{font-size:1.95rem}
  .file-copy a{min-height:40px}.crew-file .primary{margin-top:5px}
  .atlas-body,.guide-body{padding:12px}.chart-filter{gap:7px;margin-bottom:10px}#level-list{gap:8px}
  .level>img{aspect-ratio:1.95}.level-copy{padding:8px}.level-copy b{font-size:1.11rem}.level-copy small{font-size:.76rem}
}
@media(max-width:360px){.crew-card{grid-template-columns:39px minmax(0,1fr);gap:4px}.roster-grid{padding:7px;gap:5px}.crew-card b{font-size:.8rem}}
@media(orientation:landscape) and (max-height:540px){
  dialog,#roster,#guide{max-height:calc(100dvh - 12px);margin-block:auto}.dialog-head{padding:5px 15px}.dialog-head h2{font-size:1.5rem}.dialog-head small{margin:0}
  .crew-file{margin:9px}.file-portrait{height:92px}.file-copy{padding:8px 12px}.roster-grid{padding:8px;gap:5px}.crew-card,.crew-card img{min-height:55px}.level>img{aspect-ratio:4}
  .dialog-head .tool{width:44px;height:44px}
}

/* Play uses a dark instrument panel over the unframed illustration. */
.sea {isolation:isolate;background:#234c49 center/cover no-repeat}
.scene-image {position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:var(--focus,50%) 52%;pointer-events:none;z-index:0}
.sea canvas {position:relative;z-index:1;width:100%;height:100%;display:block;touch-action:none;outline:0}
.veil {position:absolute;inset:0;display:grid;place-items:center;backdrop-filter:blur(3px)}
/* The battlefield fills the visual viewport; only its controls receive touches. */
body.playing{overflow:hidden;overscroll-behavior:none}
body.playing .mast{display:none}
#game{--edge:clamp(12px,2vw,30px);--top:max(var(--edge),env(safe-area-inset-top));--left:max(var(--edge),env(safe-area-inset-left));--right:max(var(--edge),env(safe-area-inset-right));--bottom:max(var(--edge),env(safe-area-inset-bottom));position:fixed;inset:0;width:100%;height:100%;height:100dvh;overflow:hidden;isolation:isolate;background:#0a252b}
#game .sea{position:absolute;inset:0;width:100%;height:100%;min-height:0}
#field{cursor:crosshair;-webkit-user-select:none;user-select:none}
#game::after{content:"";position:absolute;z-index:1;inset:0;pointer-events:none;background:linear-gradient(180deg,#06171c9e 0%,transparent 21%,transparent 72%,#071c2294 100%)}
.battle-head,.battle-controls{position:absolute;left:var(--left);right:var(--right);z-index:2;pointer-events:none}
.battle-head{top:var(--top);display:grid;align-items:start;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:10px}
.battle-head button,.battle-controls button,.battle-controls input,.battle-controls #instruments{pointer-events:auto}
.battle-name,.battle-tools,.battle-score,.battle-score>div,.action-row,.battle-cue,.adjust-button,#fire{display:flex;align-items:center}
.battle-name{grid-column:1;grid-row:1;gap:10px;min-width:0;color:#fff5de;text-shadow:0 2px 6px #001015,0 1px 2px #001015}
.battle-name>div{min-width:0}.battle-name small{display:block;font:700 .79rem/1.18 var(--display);color:#ffe3a5}.battle-name h1{margin:3px 0 0;font:700 clamp(1.08rem,2vw,1.6rem)/1.05 Georgia,serif;text-wrap:balance}
.battle-tools{grid-column:3;grid-row:1;justify-self:end;gap:7px}
.battle-tool,.adjust-button,.battle-score,#instruments,.battle-cue{background:linear-gradient(155deg,#183639f2,#0a2029ec);border:1px solid #b9a477ae;box-shadow:0 2px 10px #06151e53;color:#fff0d1}
.battle-tool{display:grid;place-items:center;width:46px;height:46px;flex:none;padding:0;border-radius:50%;font-size:1.4rem}
.battle-head svg,.battle-controls svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.battle-tool:hover,.adjust-button:hover,.adjust-button[aria-expanded=true]{background:#345557;border-color:#f7d681}
.battle-score{grid-column:2;grid-row:1;justify-self:center;gap:0;padding:5px 6px;border-radius:16px;min-height:45px}
.battle-score>div{display:grid;grid-template-columns:24px auto;column-gap:6px;align-items:center;padding:0 11px;border-left:1px solid #d1c49c44}
.battle-score>div:first-child{border:0}.battle-score img,.battle-score i{grid-row:1/3;width:23px;height:23px;object-fit:contain;color:#ffd37b;font:normal 23px/1 Georgia,serif;text-align:center}
.battle-score span{font-size:.7rem;color:#e4e5d6;line-height:1.1}.battle-score b{font-variant-numeric:tabular-nums;font-size:1rem;line-height:1.1;color:#ffe2a1}
.battle-controls{bottom:var(--bottom)}
.action-row{gap:12px;justify-content:space-between}
.adjust-button,#fire{justify-content:center;min-height:52px;gap:8px;border-radius:16px;font:750 1.02rem/1.1 var(--display);padding:8px 16px}
#fire{margin-left:auto;min-width:132px}#fire .power-glyph,#fire[data-mode=power] .launch-glyph{display:none}#fire[data-mode=power] .power-glyph{display:block}
#fire[data-mode=power]:enabled{background:linear-gradient(155deg,#b7ffe4,#69d5bc);color:#082e33;border-color:#caf3cf;box-shadow:inset 0 -3px #338e83,0 3px 10px #0c1c25}
.battle-cue{position:absolute;left:50%;transform:translateX(-50%);max-width:calc(100% - 330px);gap:9px;padding:6px 12px 6px 6px;border-radius:14px;color:#fff3d7;font-size:.92rem;line-height:1.2}
.battle-cue img{width:31px;height:33px;object-fit:cover;object-position:50% 8%;border:1px solid #b79c6b;border-radius:9px;background:#45564a}
.battle-cue span{display:block}.battle-cue #power-title{font-weight:750;color:#ffda8e}
#instruments{position:absolute;bottom:calc(100% + 10px);left:0;display:grid;gap:4px;width:min(292px,100%);padding:10px 14px 12px;border-radius:15px}
#instruments header,#instruments label{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;margin:0}
#instruments header{font:750 1.08rem var(--display)}#instruments header button{width:44px;height:44px;font-size:1.2rem;border:none;background:transparent;box-shadow:none}
#instruments label{font-size:.91rem}#instruments output{color:#ffdf9b;font-weight:700}#instruments input{display:block;flex:0 0 100%;width:100%;height:32px;margin:0;accent-color:#f6c16c}
#game .veil{z-index:5;padding:var(--top) var(--right) var(--bottom) var(--left);background:#071a228c}
#game .panel{width:min(350px,100%);max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:17px 18px 10px}
#game .panel h2{font-size:1.45rem}#game .panel .primary,#game .panel .text-action,.pause-tools button{min-height:44px}
.pause-tools{display:flex;justify-content:center;gap:7px}.pause-tools button{border:0;background:transparent;color:#ffdc93;font-size:.87rem;padding:6px}
@media(max-width:740px){
  .battle-head{grid-template-columns:minmax(0,1fr) auto;gap:9px 7px}
  .battle-tools{grid-column:2}.battle-score{grid-row:2;grid-column:1/-1;justify-self:start;min-height:34px;border-radius:11px}
  .battle-score>div{display:flex;gap:4px;padding:0 7px}.battle-score img,.battle-score i{width:17px;height:17px;font-size:17px}
  .battle-score span{font-size:.72rem}.battle-score b{font-size:.86rem}
  .battle-name small{font-size:.72rem}.battle-name h1{font-size:1.12rem}
}
@media(max-width:600px) and (orientation:portrait){
  .battle-cue{left:0;bottom:calc(100% + 9px);transform:none;max-width:100%;font-size:.87rem}
  #instruments{z-index:1}#game:has(#instruments:not([hidden])) .battle-cue{visibility:hidden}
  .battle-cue img{width:25px;height:27px}#fire{min-width:130px}
}
@media(orientation:landscape) and (max-height:560px){
  #game{--edge:8px}.battle-head{grid-template-columns:minmax(0,1fr) auto minmax(92px,.4fr);align-items:start;gap:5px}
  .battle-score{grid-column:2;grid-row:1;justify-self:center;min-height:36px;border-radius:11px}
  .battle-score>div{display:flex;gap:4px;padding:0 6px}.battle-score img,.battle-score i{width:17px;height:17px;font-size:17px}
  .battle-tools{grid-column:3;gap:4px}.battle-name{gap:5px}.battle-name h1{font-size:1rem}.battle-name small{font-size:.71rem}
  .battle-tool{width:44px;height:44px}.adjust-button,#fire{min-height:46px;padding:7px 12px;border-radius:13px}
  .battle-cue{max-width:calc(100% - 265px);font-size:.84rem}.battle-cue img{height:26px;width:25px}
  #instruments{bottom:calc(100% + 4px);padding:4px 12px 8px}
  #game .panel{padding:10px 14px 6px}#game .panel h2{font-size:1.15rem}
}
@media(orientation:landscape) and (max-width:700px){.battle-name small{display:none}.battle-score span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}}

#game {color:var(--light);color-scheme:dark}
.battle-name {gap:9px}.battle-name small {font-weight:650;letter-spacing:.03em;color:#ffe2a2}.battle-name h1{font-family:var(--serif);font-weight:600;line-height:1.08;text-shadow:0 1px 3px #001216}
.battle-tool,.adjust-button,.battle-cue,#instruments,.battle-score{background:#102c2ef2;border-color:#e3d4b372;box-shadow:0 2px 8px #081b2257}
.battle-tool{border-radius:12px}.battle-score{padding:6px 3px;border-radius:12px}.battle-score b{color:#fff0c3;font-size:1.09rem}.battle-score span{color:#d8e1d5}
#fire,.adjust-button {border-radius:11px}.battle-cue{border-radius:10px}#fire{background:var(--gold);color:#172d28;border-color:#fbe1aa;box-shadow:0 3px 8px #081b2257}
#fire:disabled{background:#314a48;color:#d4dfd5;border-color:#859288}
#instruments{border-radius:12px;background:#143433}#instruments header{color:#fff0d1;border-bottom:1px solid #71827660;margin-bottom:6px}#instruments label{color:#e2e4d5}
#game .panel{background:var(--paper);color:var(--ink);width:min(375px,100%);padding:0;overflow:auto;border:1px solid #b4b39b;border-radius:14px;text-align:center;box-shadow:0 14px 60px #06161988}
.panel-art {position:relative;isolation:isolate;display:grid;place-content:end center;min-height:115px;padding:15px 12px 12px;color:var(--light);background:var(--night)}
.panel-art img,.panel-art::after{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2}.panel-art::after{content:"";z-index:-1;background:linear-gradient(0deg,#0d2629fa,#0c282a55 86%)}
.panel-art small{color:#ffe5ae;margin-bottom:5px}#game .panel-art h2{font:550 2rem/1.05 var(--serif);letter-spacing:-.03em}
.panel-body{padding:15px}.panel-body>p {font:550 1.28rem/1.2 var(--serif);margin:0}
.result-stats{display:grid;grid-template-columns:repeat(3,1fr);margin:11px 0 14px;padding-block:10px;border-block:1px solid var(--rule)}
.result-stats div+div{border-left:1px solid var(--rule)}.result-stats dt{font-size:.74rem;color:var(--muted)}.result-stats dd{font-weight:750;font-variant-numeric:tabular-nums;margin:3px 0 0}.stars{color:#915d1a;letter-spacing:.15em;margin:4px 0 0}
#game .panel .primary{width:100%}.text-action,.pause-tools button{color:#465d50;font-size:.88rem;background:none;border:0;text-decoration:underline;text-underline-offset:3px}.panel .text-action{display:block;width:100%}.pause-tools{border-top:1px solid var(--rule)}.pause-tools button{font-weight:600;color:#77412e}
@media(max-width:740px){.battle-score{padding:4px}.battle-score b{font-size:.9rem}}
@media(orientation:landscape) and (max-height:540px){
  #game .panel{display:grid;grid-template-columns:minmax(165px,.8fr) minmax(235px,1fr);width:min(590px,100%);padding:0}
  .panel-art{height:100%;align-content:end;min-height:120px;padding:12px}.panel-body{padding:10px}.panel-body>p{font-size:1.02rem}.result-stats{margin:5px 0;padding-block:5px}#game .panel-art h2{font-size:1.5rem}
  .battle-score{padding:4px}.battle-score b{font-size:.93rem}
}

/* Keep the keyboard cursor legible over both artwork and solid controls. */
:is(button, a, summary, input):focus-visible {
  outline: 3px solid #ffefbc;
  outline-offset: 1px;
  box-shadow: 0 0 0 6px #181e25;
}
:where(button, a, summary) { touch-action: manipulation; }

@media (pointer: coarse), (max-width: 700px), (max-height: 550px) {
  #sound,#help,#pause,#home,#expand,#close-aim,dialog .close,.round-guide summary,#guide summary { min-inline-size: 44px; min-block-size: 44px; }
}

@media (pointer: coarse), (max-width: 700px), (max-height: 550px) {
  #play,#main-action,#fire,#adjust { min-height: 44px; min-width: 44px; }
}
