.shell [hidden], .campaign-dialog [hidden] { display: none !important; }
.battle-settings { gap: 12px; }
#scenario { min-width: auto; gap: 6px; }
#scenario .campaign-down { width: 12px; height: 12px; transform: rotate(90deg); }
.campaign-current { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
#chapter-count { color: #d3bc87; font: 600 13px/1 Georgia, serif; letter-spacing: .04em; }
.campaign-current strong { font: 700 15px/1.2 "Songti SC",STSong,SimSun,serif; letter-spacing: .05em; }
.direct-route {
  flex: none; padding: 5px 10px; min-height: 32px;
  color: #d5e4d9; background: #1d363b;
  border: 1px solid #89a397; border-radius: 5px; font-size: 12px;
}
.direct-route:hover:not(:disabled), .direct-route[aria-pressed="true"] {
  border-color: #c2dfb8; background: #3d6155; color: #fff2c9;
}
.direct-route:disabled { opacity: .5; }
.campaign-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.campaign-actions #fire { margin: 0; }
.campaign-advance {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; min-height: 43px; color: #392e20;
  border: 1px solid #fff1b6; border-radius: 6px;
  background: linear-gradient(165deg,#ffeab5,#e5b66c 79%,#c99758);
  box-shadow: inset 0 0 0 2px #d7ad6a, 0 2px 0 #825f3c;
  font: 750 15px/1.3 system-ui,sans-serif; white-space: nowrap;
}
.campaign-advance .icon { width: 17px; height: 17px; }
.campaign-advance:hover:not(:disabled) { filter: brightness(1.055); }
.campaign-advance:disabled { opacity: .68; }
.console[data-outcome="win"] #fire { min-width: 0; min-height: 41px; font-size: 15px; box-shadow: none; background: #284545; color: #f4e1bd; border: 1px solid #af9d79; }
.console[data-outcome="win"] #fire kbd { display: none; }
#campaign-tip {
  display: flex; align-items: center; gap: 7px; min-height: 32px;
  color: #d3dfce; line-height: 1.55; font-size: 12px; padding: 2px 4px;
}
#campaign-tip > .icon { width: 16px; height: 16px; flex: none; color: #d6bc86; }
#campaign-tip > span { flex: 1; }
#campaign-tip button {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  color: #b9c6b5; border: 0; background: none; border-radius: 4px;
}
#campaign-tip button:hover { background: #42615d; }
#campaign-tip button .icon { width: 14px; height: 14px; }

.campaign-dialog {
  width: min(550px,calc(100vw - 24px)); max-width: none;
  max-height: min(740px,calc(100svh - 20px)); padding: 0; overflow: hidden;
  color: #f2e8d0; border: 1px solid #d4b77d; border-radius: 10px;
  background: #193638; box-shadow: 0 20px 70px #051d22a6, inset 0 0 0 2px #719082;
}
.campaign-dialog[open] { display: flex; flex-direction: column; }
.campaign-dialog::backdrop { background: #071d24b0; }
body:has(.campaign-dialog[open]) { overflow: hidden; }
.campaign-dialog-head {
  flex: none; min-height: 57px; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 8px 12px 8px 18px;
  border-bottom: 3px double #a68f63;
  background: repeating-linear-gradient(118deg,#f4d6a008 0 1px,transparent 1px 14px),linear-gradient(112deg,#355652,#203d3f);
}
.campaign-dialog-head > div { display: flex; align-items: center; gap: 9px; }
.campaign-dialog-head > div > .icon { width: 23px; height: 23px; color: #e2bd7e; }
.campaign-dialog h2 { margin: 0; font: 750 24px/1.25 "Songti SC",STSong,SimSun,serif; letter-spacing: .07em; color: #fff0c9; }
.campaign-dialog h2:focus { outline: none; }
.campaign-close, .ending-sound {
  display: grid; place-items: center; flex: none; width: 39px; height: 39px;
  border: 1px solid #a99c74; border-radius: 50%; background: #28494a; color: #f2dfb6;
}
.campaign-close:hover, .ending-sound:hover { background: #385c56; }
.campaign-close .icon, .ending-sound .icon { width: 17px; height: 17px; }
.campaign-map-scroll, .settings-scroll, .ending-scroll { overflow: auto; overscroll-behavior: contain; min-height: 0; scrollbar-color: #839783 #1a3738; }
.campaign-map-scroll { padding: 13px 16px 18px; }
.campaign-summary { margin: 0 0 11px; font-size: 13px; color: #d0d4bb; }
#campaign-levels { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.campaign-card {
  display: grid; align-items: center; grid-template-columns: 49px minmax(0,1fr) auto; gap: 7px;
  text-align: left; width: 100%; padding: 5px 8px 5px 5px; min-height: 66px;
  background: linear-gradient(118deg,#2e504e,#23413f);
  color: #f2edd6; border: 1px solid #7c8e78; border-radius: 6px; overflow: hidden;
}
.campaign-card:disabled { background: #29403e; border-color: #5b7268; color: #b6c4b8; }
.campaign-card:hover:not(:disabled) { border-color: #e5c886; background: #3c5c54; }
.campaign-card[data-current="true"] { background: linear-gradient(115deg,#4d6251,#344e45); border: 1px solid #e2c17c; box-shadow: inset 0 0 0 1px #b79e6359; }
.card-vista { align-self: stretch; min-height: 48px; position: relative; overflow: hidden; border-radius: 3px; border: 1px solid #d5cf9e85; background: #62827a; }
.card-vista img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: 58% 63%; }
.card-vista::after { position: absolute; inset: 0; content:""; background: linear-gradient(180deg,#153a3a70,transparent 75%); box-shadow: inset 0 0 0 1px #ffe4a125; }
.card-vista > .icon { position: absolute; z-index: 1; width: 25px; height: 25px; top: 4px; left: 50%; transform: translateX(-50%); color: #fff0bc; filter: drop-shadow(0 1px 1px #293c35); stroke-width: 1.55; }
.campaign-card[data-terrain="pass"] .card-vista img { object-position: 48% 60%; }
.campaign-card:disabled .card-vista img { filter: saturate(.4) brightness(.68); }
.card-num {
  position: absolute; z-index: 1; bottom: 0; right: 0; padding: 3px; line-height: 1;
  background: #213b36d6; color: #ffebbd; font: 700 11px/1 Georgia,serif; border-radius: 2px 0 0 0;
}
.card-label { min-width: 0; }
.card-label strong, .card-label small { display: block; }
.card-label strong { font: 700 16px/1.25 "Songti SC",STSong,SimSun,serif; }
.card-label small { margin-top: 4px; color: #c3d3bd; font-size: 11px; line-height: 1.25; }
.card-marker { color: #cfdeb7; font-size: 10px; }
.card-marker span { color: #f5d38d; }
.card-marker .icon { width: 14px; height: 14px; }
.campaign-card:disabled .card-marker { color: #a8b8ae; }
.map-ending, .settings-links a, .settings-links button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  background: none; border: 0; color: #eee3c6; text-decoration: none; font: inherit;
}
.map-ending { width: 100%; justify-content: center; margin-top: 12px; border: 1px solid #b2996c; border-radius: 5px; font-size: 14px; }
.map-ending .icon, .settings-links .icon { width: 17px; height: 17px; color: #d6bb82; }
.settings-scroll { padding: 15px 20px 7px; }
.how-play h3 { margin: 0; font: 700 18px/1.3 "Songti SC",STSong,SimSun,serif; color: #f4e6bf; }
.how-play p { margin: 6px 0; font-size: 14px; line-height: 1.65; color: #e2e7d4; }
.how-play .keyboard-help { color: #bacab9; font-size: 12px; }
.setting-options { margin: 15px 0 6px; background: #234341; border: 1px solid #708676; border-radius: 6px; }
.setting-options > div { display: flex; justify-content: space-between; align-items: center; padding: 5px 7px 5px 12px; gap: 10px; font-size: 14px; }
.setting-options > div + div { border-top: 1px solid #788b744f; }
.setting-options .setting { min-width: 92px; min-height: 33px; justify-content: center; }
.setting-options .setting .icon { width: 16px; height: 16px; }
.settings-links { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.settings-links a:focus-visible { outline: 3px solid #ffe5a0; outline-offset: 2px; }
.settings-links button:disabled { opacity: .54; }
.settings-links a:hover, .settings-links button:hover:not(:disabled), .map-ending:hover { color: #fff0c5; text-decoration: underline; }
.ending-art { background: radial-gradient(ellipse at 48% 2%,#dfd4a2,#9bb09a 55%,#72938d 100%); border-bottom: 1px solid #b59965; }
.ending-scene { width: 100%; height: auto; max-height: 220px; display: block;}
.ending-echo,.ending-seed { opacity: 0; }
.ending-art:is([data-beat="root"],[data-beat="bloom"]) .ending-echo,
.ending-art[data-beat="bloom"] .ending-seed { opacity: 1; }
.ending-art:is([data-beat="root"],[data-beat="bloom"]) .ending-root { filter: drop-shadow(0 0 3px #b3e894); }
.ending-art:is([data-beat="copper"],[data-beat="root"],[data-beat="bloom"]) .ending-bell { filter: drop-shadow(0 0 3px #ffeda8); }
.ending-copy { padding: 12px 18px 17px; }
.ending-copy p { min-height: 3.25em; margin: 0 0 10px; color: #e5ead5; font-size: 15px; line-height: 1.65; }
.ending-controls { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.ending-sound[aria-pressed="true"] { border-color: #cede9d; }
@media (prefers-reduced-motion: no-preference) {
  .ending-art .ending-root, .ending-art .ending-bell, .ending-art .ending-echo, .ending-art .ending-seed { transition: filter .32s,opacity .5s; }
  .ending-art[data-beat="copper"] .ending-striker { transform-origin: 64px 104px; animation: ending-ring .52s ease-out; }
  .ending-art[data-beat="copper"] .ending-bell { transform-origin: 84px 39px; animation: ending-swing .6s ease-out; }
  .ending-art[data-beat="root"] .ending-echo { stroke-dasharray: 60; animation: ending-ripple .72s ease-out; }
  @keyframes ending-ring { 32% { transform: translate(13px,-9px) rotate(-21deg); } }
  @keyframes ending-swing { 25% { transform: rotate(-5deg); } 60% { transform: rotate(3deg); } }
  @keyframes ending-ripple { from { stroke-dashoffset: 62; opacity: .1; } to { stroke-dashoffset: 0; opacity: 1; } }
}
@media (min-width: 681px) and (min-height: 511px) {
  .shell { width: min(100%,1440px,calc((100svh - 204px) * 1.88 + 36px)); }
}
@media(max-width:680px) {
  .campaign-current { gap: 7px; }
  .campaign-current strong { font-size: 14px; }
  #chapter-count { font-size: 12px; }
  .campaign-actions { grid-column: 2; grid-row: 1; margin: 0; }
  .direct-route { padding: 4px 7px; min-height: 30px; font-size: 11px; }
  #campaign-tip { min-height: 33px; gap: 4px; font-size: 11px; }
  .console[data-outcome="win"] .readout { display: none; }
  .console[data-outcome="win"] .campaign-actions { grid-column: 1/-1; justify-content: space-between; }
  .console[data-outcome="win"] #fire { min-height: 37px; }
  .campaign-advance { min-height: 39px; padding: 7px 13px; }
  .campaign-dialog-head { min-height: 51px; padding: 6px 8px 6px 13px; }
  .campaign-dialog h2 { font-size: 21px; }
  .campaign-map-scroll { padding: 10px; }
  #campaign-levels { gap: 7px; }
  .campaign-card { grid-template-columns: 32px minmax(0,1fr) auto; gap: 4px; padding: 4px; min-height: 61px; }
  .card-label strong { font-size: 13px; }
  .card-label small { font-size: 10px; }
  .card-vista { min-height: 44px; }
  .card-vista > .icon { width: 22px; height: 22px; }
  .card-marker span { writing-mode: vertical-rl; font-size: 9px; letter-spacing: .06em; }
  .settings-scroll { padding: 12px 13px 6px; }
  .ending-copy p { font-size: 14px; }
}
@media (orientation:portrait) and (max-width:680px) and (max-height:680px) {
  .field { aspect-ratio: .93; }
}
@media (orientation:landscape) and (max-height:510px) {
  #campaign-tip { min-height: 19px; padding: 0 2px; font-size: 10px; }
  #campaign-tip button { width: 25px; height: 20px; }
  .shell { width:min(100%,calc((100svh - 114px)*2.04 + 8px)); }
  .mast { gap: 9px; }
  .battle-settings { gap: 6px; padding-left: 0; border: 0; }
  .campaign-current { gap: 4px; }
  .campaign-current strong { font-size: 12px; }
  #chapter-count { font-size: 10px; }
  .direct-route { min-height: 24px; padding: 3px 5px; font-size: 10px; }
  .campaign-actions { margin-left: auto; }
  .console[data-outcome="win"] .campaign-actions { gap: 4px; }
  .console[data-outcome="win"] .campaign-actions button, .campaign-actions #campaign-finale { min-height: 29px; font-size: 12px; padding: 4px 7px; }
  .campaign-dialog-head { min-height: 42px; padding: 3px 8px 3px 13px; }
  .campaign-dialog h2 { font-size: 19px; }
  .campaign-close { width: 32px; height: 32px; }
  #campaign-ending { width: min(670px,calc(100vw - 20px)); }
  .ending-scroll { display: grid; grid-template-columns: 46% 1fr; align-items: center; }
  .ending-art { align-self: stretch; display: grid; align-items: center; border: 0; }
  .ending-copy { padding: 13px; }
  .ending-copy p { font-size: 13px; }
}

/* One five-stop chart at a time, with its own chapter landscape. */
.screen-reader-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; margin: -1px;
}
.atlas-progress { display: flex; align-items: center; justify-content: space-between; min-height: 31px; margin: 0 0 4px; gap: 6px; }
.atlas-progress .campaign-summary { margin: 0; font-size: 12px; }
.atlas-progress {flex-wrap:wrap}
#map-frontier {min-height:32px;padding:4px 9px;border:1px solid #887d54;border-radius:5px;background:#334d45;color:#ffe5a4;font:600 12px system-ui;white-space:nowrap}
#map-current { min-height: 30px; padding: 2px 5px; border: 0; border-radius: 4px; color: #f8db98; background: none; font-size: 12px; white-space: nowrap; }
#map-current:hover { text-decoration: underline; }
.atlas-nav { display: grid; grid-template-columns: 39px minmax(0,1fr) 39px; gap: 5px; }
.atlas-nav > button, .atlas-chapter {
  display: grid; place-items: center; color: #eddfbc; background: linear-gradient(130deg,#3d5c53,#2d4946);
  border: 1px solid #9b9875; border-radius: 5px; min-height: 39px;
}
.atlas-nav > button:hover:not(:disabled), .atlas-chapter:focus-within { border-color: #e8c788; background: #45675b; }
.atlas-nav > button:disabled { opacity: .45; }
.atlas-nav > button .icon, .atlas-chapter .icon { width: 15px; height: 15px; }
#chapter-prev .icon { transform: rotate(180deg); }
.atlas-chapter { position: relative; overflow: hidden; }
.atlas-chapter .icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%) rotate(90deg); pointer-events: none; }
#chapter-select {
  appearance: none; display: block; width: 100%; min-width: 0; height: 100%; padding: 6px 29px 6px 11px;
  font: 700 16px/1.35 "Songti SC",STSong,SimSun,serif; text-align: center;
  background: transparent; color: #faebc6; border: 0; cursor: pointer; text-overflow: ellipsis;
}
#chapter-select option { color: #ede7d2; background: #1b393a; }
#chapter-select:focus-visible { outline: 2px solid #ffda85; outline-offset: -3px; }
.atlas-story {
  isolation: isolate; position: relative; display: flex; align-items: flex-end; gap: 8px; overflow: hidden;
  min-height: 112px; padding: 14px; margin: 9px 0 10px; color: #fff4d2;
  border: 1px solid #a79e71; border-radius: 5px; background: #345856;
}
.atlas-story > img, .atlas-story::before { z-index: -1; position: absolute; inset: 0; width: 100%; height: 100%; }
.atlas-story > img { object-fit: cover; object-position: center 54%; }
.atlas-story::before { z-index: 0; content: ""; background: linear-gradient(0deg,#122a29f5,transparent 75%),linear-gradient(90deg,#203c36a8,transparent 80%); }
.atlas-story > .icon, .atlas-story > div { z-index: 1; }
.atlas-story > .icon { flex: none; align-self: flex-end; color: #f1cd86; width: 28px; height: 28px; margin-bottom: 2px; filter: drop-shadow(0 1px 1px #233933); }
.atlas-story h3 { font: 750 18px/1.3 "Songti SC",STSong,SimSun,serif; margin: 0; text-shadow: 0 1px 2px #254239; }
.atlas-story p { margin: 3px 0 0; font-size: 13px; line-height: 1.45; text-shadow: 0 1px 2px #142c26; }
#map-legacy { border-style: dashed; border-color: #8b997a; color: #d2d7ba; }
.how-play #settings-rule { color: #f4dba3; font-size: 13px; border-left: 2px solid #bca577; padding-left: 8px; margin: 9px 0; }
@media (max-width:680px) {
  .atlas-story { margin: 6px 0; min-height: 88px; padding: 9px; gap: 6px; }
  .atlas-story h3 { font-size: 16px; }
  .atlas-story p { font-size: 12px; }
  .atlas-story > .icon { width: 23px; height: 23px; }
  .atlas-progress .campaign-summary, #map-current { font-size: 11px; }
  #chapter-select { font-size: 15px; }
}
@media (orientation:landscape) and (max-height:510px) {
  #campaign-map { width: min(720px,calc(100vw - 18px)); }
  #campaign-map .campaign-map-scroll { display: grid; grid-template-columns: minmax(155px,.74fr) minmax(0,1.26fr); gap: 6px 10px; }
  .atlas-progress { grid-column: 1/-1; min-height: 22px; margin: 0; }
  .atlas-nav { grid-column: 1; align-self: start; grid-template-columns: 29px minmax(0,1fr) 29px; gap: 3px; }
  .atlas-nav > button, .atlas-chapter { min-height: 30px; }
  #chapter-select { padding: 2px 14px 2px 3px; font-size: 12px; }
  .atlas-chapter .icon { right: 3px; width: 10px; }
  .atlas-story { grid-column: 1; align-self: stretch; margin: 0; padding: 6px; gap: 4px; }
  .atlas-story p { font-size: 11px; }
  #campaign-levels { grid-column: 2; grid-row: 2 / span 2; gap: 4px; }
  #campaign-map .campaign-card { min-height: 43px; grid-template-columns: 25px minmax(0,1fr) auto; gap: 3px; padding: 3px; }
  #campaign-map .card-vista { min-height: 35px; }
  #campaign-map .card-vista > .icon { width: 17px; height: 17px; }
  #campaign-map .card-label strong { font-size: 12px; }
  #campaign-map .card-label small { margin-top: 2px; font-size: 9px; }
  #campaign-map .map-ending { grid-column: 1/-1; margin: 0; min-height: 30px; }
}

#atlas-log { margin: 8px 0 0; border-top: 1px solid #8a96734a; }
#atlas-log summary { color: #e7d5a5; cursor: pointer; padding: 8px 2px 3px; font-size: 12px; }
#atlas-log summary:focus-visible { outline: 2px solid #f4d697; }
#atlas-log p { font-size: 13px; line-height: 1.7; color: #e9e7ce; margin: 4px 2px 0; }
.lore-pages .lore-chapter { border: 1px solid #ac9c72; padding: 9px 12px; background: #ddd8b87a; border-radius: 4px; }
#campaign-next[data-handoff="true"] { padding-block: 5px; }
.advance-copy { display: grid; gap: 2px; }
#advance-rule { font-size: 11px; line-height: 1.25; font-weight: 600; }
@media (orientation:landscape) and (max-height:510px) {
  #atlas-log { grid-column: 1/-1; margin: 0; }
  #atlas-log summary { padding: 4px 2px; }
  #advance-rule { font-size: 9px; }
}
