/* Chronicle 01 expanded edition: gameplay clarity, touch reach and quiet typography. */
:root {
  color-scheme: dark;
}
/* Suppress iOS text selection and callouts only on virtual gameplay controls. */
#hud .touch-controls button,
#hud .touch-controls button *,
#hud #extract,
#hud #extract *,
#hud #restore,
#hud #restore * {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button:disabled {
  cursor: default;
  opacity: 0.35;
}
.landing-copy {
  top: 20%;
}
.landing-copy h1 {
  font-size: clamp(30px, 3.1vw, 48px);
  line-height: 1.45;
  margin: 20px 0 16px;
}
.intro {
  margin: 0;
  font-size: 12px;
  line-height: 2;
}
.landing-copy .primary-button {
  margin-top: 20px;
}
.landing-copy .start-note {
  margin-top: 14px;
}
.difficulty-picker {
  padding: 0;
  margin: 22px 0 0;
  border: 0;
  width: 305px;
}
.difficulty-picker legend {
  padding: 0;
  color: #8fa999;
  font-size: 9px;
  letter-spacing: 2px;
  margin-bottom: 9px;
}
.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.difficulty-options button {
  min-height: 49px;
  padding: 9px 10px;
  color: #99b19e;
  background: #11241fc9;
  border: 1px solid #a8c5a52b;
  font-size: 12px;
  letter-spacing: 2px;
  text-align: left;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.difficulty-options button small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #7d9b85;
  margin-top: 5px;
}
.difficulty-options button.selected {
  color: #d6e8cc;
  background: #acc59412;
  border-color: #b0c9978a;
}
.difficulty-options button.selected small {
  color: #b3c9a1;
}
.local-best {
  font-size: 9px;
  color: #91a98e;
  letter-spacing: 0.7px;
  margin: 12px 0 0;
}
.objective .eyebrow > span {
  width: auto;
  height: auto;
  background: none;
}
.objective p {
  font-size: 11px;
  line-height: 1.8;
  color: #a5bda9;
}
.objective .compass-note {
  font-size: 9px;
  line-height: 1.7;
}
.anchor-progress > span.partial {
  color: var(--gold);
  border-color: #dec18a80;
  background: linear-gradient(
    0deg,
    #dec18a24 var(--progress),
    transparent var(--progress)
  );
}
.status-panel > p {
  font-size: 9px;
}
.target-card {
  width: max-content;
  max-width: 410px;
  border-color: #9fb68a66;
}
.target-card div {
  line-height: 1.7;
}
.target-card small {
  display: block;
  font-size: 10px;
  line-height: 1.7;
  max-width: 360px;
}
#interaction-hint {
  font-size: 9px;
  line-height: 1.6;
  height: 28px;
  margin-top: 10px;
}
.ability-dock {
  width: 360px;
}
.boss-panel {
  position: absolute;
  top: 113px;
  left: 50%;
  transform: translateX(-50%);
  width: 330px;
  padding: 14px 17px 13px;
  background: linear-gradient(90deg, #17292322, #13251ecc, #17292322);
  border-top: 1px solid #d4bd7d60;
  text-align: center;
}
.boss-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.boss-heading > span {
  color: #bdad80;
  font-size: 8px;
  letter-spacing: 2px;
}
.boss-heading > strong {
  color: #e1d7b4;
  font-size: 15px;
  letter-spacing: 3px;
  font-weight: 400;
}
.boss-core-pips {
  display: flex;
  gap: 4px;
  margin: 13px 0 9px;
}
.boss-core-pips i {
  flex: 1;
  height: 4px;
  background: #bea67b22;
  transition: background 0.3s;
}
.boss-core-pips i.filled {
  background: linear-gradient(90deg, #b5955c, #e4c78a);
  box-shadow: 0 0 7px #e4bd6e25;
}
.boss-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #bdc7a5;
  font-size: 9px;
  letter-spacing: 0.5px;
}
.tutorial-card {
  position: absolute;
  bottom: 167px;
  left: 40px;
  width: 255px;
  padding: 16px 17px 12px;
  border-left: 1px solid #a7caa06e;
  background: linear-gradient(90deg, #0e211ee6, #10241e55);
}
.tutorial-card > span {
  font-size: 8px;
  color: #9fba8d;
  letter-spacing: 2px;
}
.tutorial-card > strong {
  display: block;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: #d7e6c6;
  margin: 10px 0 7px;
}
.tutorial-card p {
  font-size: 11px;
  line-height: 1.9;
  color: #afc3a8;
  margin: 0;
}
.tutorial-card button {
  font-size: 9px;
  color: #8ba684;
  min-height: 32px;
}
.phase-banner {
  position: absolute;
  top: 39%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 80vw);
  padding: 24px 30px;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(ellipse, #0c201dce, transparent 73%);
}
.phase-banner > small {
  display: block;
  font-size: 9px;
  letter-spacing: 4px;
  color: #b3c395;
}
.phase-banner > strong {
  display: block;
  font-family: STSong, "Songti SC", serif;
  font-size: 35px;
  font-weight: 400;
  letter-spacing: 6px;
  color: #e1e9cf;
  margin: 16px 0 12px;
  text-shadow: 0 2px 18px #000;
}
.phase-banner > p {
  font-size: 11px;
  line-height: 1.8;
  color: #b7caa9;
  letter-spacing: 1.5px;
  margin: 0;
}
.low-health {
  position: absolute;
  top: 91px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 80vw;
  padding: 8px 14px;
  background: #301d17b8;
  border-top: 1px solid #c6947855;
  color: #e4b998;
  font-size: 10px;
  letter-spacing: 1px;
  text-align: center;
}
.modal-secondary {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 24px;
  row-gap: 5px;
  margin-top: 15px;
}
.modal-secondary .text-button {
  min-height: 40px;
  padding: 8px 3px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid #b2cba02b;
}
.setting-row > span {
  flex: 1;
}
.setting-row strong {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
}
.setting-row small {
  display: block;
  font-size: 10px;
  line-height: 1.7;
  color: #91a78a;
  margin-top: 5px;
}
.setting-row select {
  font: inherit;
  min-width: 75px;
  min-height: 44px;
  padding: 8px 12px;
  background: #1b3329;
  color: #d7e4c7;
  border: 1px solid #9eb58a60;
  border-radius: 0;
}
.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.volume-control input {
  width: 110px;
  min-height: 44px;
  margin: 0;
  accent-color: #b6d5a3;
}
.volume-control output {
  min-width: 32px;
  font-family: monospace;
  font-size: 11px;
  color: #b8cfa1;
}
.small-button {
  min-height: 44px;
  padding: 10px 14px;
  color: #c5dcad;
  background: #244032;
  border: 1px solid #a5c18b50;
  font-size: 11px;
}
.modal .fine-print {
  color: #829d81;
  font-size: 10px;
  line-height: 1.9;
  margin-top: 22px;
}
.run-result {
  display: flex;
  gap: 24px;
  align-items: center;
  padding-bottom: 24px;
}
.rank-badge {
  width: 95px;
  height: 108px;
  border: 1px solid #b8bf836b;
  background: #d9d4970c;
  flex-shrink: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rank-badge > span {
  font-family: Georgia, serif;
  font-size: 57px;
  line-height: 1;
  color: #d7d6a0;
}
.rank-badge > small {
  font-size: 8px;
  letter-spacing: 2px;
  color: #99ae83;
  margin-top: 10px;
}
.rank-S {
  box-shadow: 0 0 25px #c7c78b12;
  border-color: #d9d5a1a0;
}
.run-score {
  min-width: 0;
}
.run-score > small {
  font-size: 9px;
  color: #a7bc8f;
  letter-spacing: 2px;
}
.run-score > strong {
  display: block;
  font-family: monospace;
  font-size: 38px;
  font-weight: 400;
  color: #d5e5bc;
  letter-spacing: 2px;
  margin: 7px 0 8px;
}
.run-score > span {
  display: block;
  font-size: 10px;
  line-height: 1.8;
  color: #8da886;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.result-grid strong {
  display: block;
  font-family: monospace;
  font-size: 19px;
  font-weight: 400;
  color: #c1dbac;
}
.result-grid span {
  display: block;
  font-size: 9px;
  letter-spacing: 1px;
  color: #8da981;
  margin-top: 7px;
}

@media (min-width: 1700px) {
  .landing-copy {
    top: 23%;
  }
  .tutorial-card {
    left: 55px;
  }
}
@media (max-width: 1000px) {
  .landing-copy {
    top: 21%;
  }
  .landing-copy h1 {
    font-size: 35px;
  }
  .tutorial-card {
    left: 24px;
    width: 220px;
  }
  .ability-dock {
    width: 320px;
  }
  .boss-panel {
    width: 290px;
    top: 100px;
  }
}
@media (max-width: 650px) {
  .topbar {
    top: calc(15px + env(safe-area-inset-top));
    left: max(18px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
  }
  .top-actions {
    gap: 0;
  }
  .icon-button {
    min-width: 39px;
    min-height: 44px;
    padding: 7px;
  }
  .landing-copy {
    top: 20%;
    left: 8%;
    right: 7%;
  }
  .landing-copy h1 {
    font-size: clamp(25px, 6.2vw, 35px);
    margin-top: 18px;
  }
  .landing-copy .intro {
    font-size: 11px;
  }
  .difficulty-picker {
    width: min(305px, 100%);
    margin-top: 19px;
  }
  .difficulty-options button {
    padding: 9px 10px;
    min-height: 49px;
    font-size: 11px;
  }
  .difficulty-options button small {
    font-size: 9px;
  }
  .landing-copy .primary-button {
    margin-top: 18px;
  }
  .local-best {
    font-size: 8px;
    margin-top: 10px;
    line-height: 1.6;
  }
  .landing-footer {
    bottom: calc(6% + env(safe-area-inset-bottom));
  }
  .prototype-tag {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .objective {
    top: calc(88px + env(safe-area-inset-top));
    width: min(190px, calc(100vw - 150px));
  }
  .objective p,
  .objective .compass-note {
    display: none;
  }
  .objective h2 {
    margin: 9px 0;
  }
  .objective p {
    font-size: 10px;
    line-height: 1.7;
  }
  .objective .compass-note {
    font-size: 8px;
  }
  .status-panel {
    top: calc(100px + env(safe-area-inset-top));
  }
  .status-line {
    font-size: 9px;
  }
  .status-panel > p {
    font-size: 8px;
    line-height: 1.5;
  }
  .boss-panel {
    top: calc(196px + env(safe-area-inset-top));
    width: min(315px, 86vw);
    padding: 11px 13px;
  }
  .hud:has(#boss-panel:not(.hidden)) .mini-map {
    display: none;
  }
  .boss-heading {
    gap: 6px;
  }
  .boss-heading > span {
    font-size: 7px;
  }
  .boss-heading > strong {
    font-size: 13px;
    letter-spacing: 2px;
  }
  .boss-caption {
    font-size: 9px;
  }
  .boss-core-pips {
    margin-top: 10px;
  }
  .tutorial-card {
    bottom: calc(355px + env(safe-area-inset-bottom));
    left: 22px;
    width: min(220px, calc(100vw - 145px));
    padding: 11px 13px 5px;
  }
  .tutorial-card > strong {
    font-size: 13px;
    margin: 7px 0 5px;
  }
  .tutorial-card p {
    font-size: 10px;
    line-height: 1.8;
  }
  .tutorial-card button {
    min-height: 34px;
  }
  .target-card {
    bottom: calc(265px + env(safe-area-inset-bottom));
    min-width: 180px;
    max-width: 85vw;
  }
  .target-card small {
    font-size: 9px;
    max-width: 75vw;
  }
  .bottom-hud {
    bottom: calc(17px + env(safe-area-inset-bottom));
  }
  .ability-dock {
    width: 290px;
  }
  .ability {
    min-height: 55px;
  }
  .ability small {
    font-size: 8px;
  }
  #interaction-hint {
    font-size: 9px;
    height: 30px;
    max-width: 260px;
    margin: 10px auto 0;
  }
  .phase-banner {
    top: 43%;
    width: 90vw;
    padding: 20px;
  }
  .phase-banner > strong {
    font-size: 26px;
    letter-spacing: 3px;
  }
  .phase-banner > p {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .low-health {
    top: calc(220px + env(safe-area-inset-top));
    font-size: 9px;
    max-width: 86vw;
    line-height: 1.8;
  }
  .storm-warning {
    top: 37%;
    font-size: 9px;
  }
  .toast {
    top: 43%;
    line-height: 1.8;
    font-size: 11px;
  }
  .modal-panel {
    max-height: 88dvh;
    padding: 34px 24px 24px;
  }
  .modal h2 {
    font-size: 25px;
    line-height: 1.5;
    letter-spacing: 2px;
  }
  .instruction {
    grid-template-columns: 82px 1fr;
    gap: 12px;
    font-size: 11px;
  }
  .setting-row {
    gap: 12px;
  }
  .setting-row small {
    font-size: 9px;
  }
  .volume-control {
    gap: 7px;
  }
  .volume-control input {
    width: 78px;
  }
  .run-result {
    gap: 18px;
  }
  .rank-badge {
    width: 78px;
    height: 92px;
  }
  .rank-badge > span {
    font-size: 46px;
  }
  .run-score > strong {
    font-size: 31px;
  }
  .run-score > span {
    font-size: 9px;
  }
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 19px;
  }
}
@media (pointer: coarse), (max-width: 650px) {
  .touch-controls {
    display: flex;
    position: absolute;
    left: max(20px, env(safe-area-inset-left));
    right: max(20px, env(safe-area-inset-right));
    bottom: calc(154px + env(safe-area-inset-bottom));
    justify-content: space-between;
    align-items: end;
    gap: 10px;
  }
  .dpad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
    gap: 4px;
  }
  .dpad button {
    min-width: 44px;
    min-height: 44px;
    background: #142c25d1;
    border: 1px solid #a5bd955e;
    border-radius: 3px;
    font-size: 20px;
    touch-action: none;
    user-select: none;
  }
  .dpad button[data-move="up"] {
    grid-column: 2;
  }
  .dpad button[data-move="left"] {
    grid-column: 1;
    grid-row: 2;
  }
  .dpad button[data-move="down"] {
    grid-column: 2;
    grid-row: 2;
  }
  .dpad button[data-move="right"] {
    grid-column: 3;
    grid-row: 2;
  }
  #touch-dash,
  #touch-cast {
    display: grid;
    place-items: center;
    width: 55px;
    height: 55px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #b1c99d7a;
    background: #173526dc;
    border-radius: 50%;
    font-size: 11px;
    letter-spacing: 1px;
    touch-action: none;
  }
  #touch-dash {
    margin-left: auto;
    width: 44px;
    height: 44px;
    font-size: 10px;
  }
  #touch-cast {
    border-color: var(--gold);
    color: var(--gold);
  }
  .tutorial-card button,
  .modal-secondary .text-button {
    min-height: 44px;
  }
}
@media (max-height: 700px) and (max-width: 650px) {
  .landing-copy {
    top: 17%;
  }
  .landing-copy h1 {
    font-size: 25px;
  }
  .difficulty-picker {
    margin-top: 14px;
  }
  .landing-footer p {
    display: none;
  }
  .landing-footer {
    bottom: 8%;
  }
  .tutorial-card {
    bottom: 345px;
  }
  .tutorial-card > strong {
    font-size: 12px;
  }
  .tutorial-card p {
    font-size: 10px;
    line-height: 1.6;
  }
}
@media (max-height: 600px) and (min-width: 651px) {
  .landing-copy {
    top: 24%;
  }
  .landing-copy h1 {
    font-size: 29px;
  }
  .landing-copy {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 230px;
    column-gap: 30px;
    max-width: 760px;
    right: 7%;
  }
  .landing-copy > .eyebrow {
    grid-column: 1;
    grid-row: 1;
  }
  .landing-copy h1 {
    grid-column: 1;
    grid-row: 2 / 4;
    margin: 17px 0;
  }
  .landing-copy .intro {
    display: none;
  }
  .difficulty-picker {
    grid-column: 2;
    grid-row: 2;
    width: 230px;
    margin-top: 0;
  }
  .difficulty-options button {
    padding: 8px;
  }
  .difficulty-options button small {
    font-size: 8px;
    letter-spacing: 0;
  }
  .landing-copy .primary-button {
    grid-column: 2;
    grid-row: 3;
    min-height: 45px;
    margin-top: 14px;
  }
  .landing-copy .start-note {
    grid-column: 1;
    grid-row: 4;
    margin-top: 0;
  }
  .local-best {
    grid-column: 2;
    grid-row: 4;
    margin-top: 8px;
    font-size: 8px;
  }
  .boss-panel {
    top: 85px;
    padding: 10px 15px;
  }
  .boss-heading > span {
    display: none;
  }
  .tutorial-card {
    bottom: 150px;
    width: 215px;
  }
  .objective {
    top: 83px;
  }
  .low-health {
    top: 71px;
    padding: 5px 10px;
  }
}
@media (max-height: 520px) and (pointer: coarse) {
  .touch-controls {
    bottom: calc(130px + env(safe-area-inset-bottom));
  }
  .objective {
    top: 76px;
    padding-top: 7px;
    padding-bottom: 7px;
    width: 220px;
  }
  .objective h2 {
    font-size: 14px;
    margin: 7px 0 0;
  }
  .objective p,
  .objective .anchor-progress,
  .objective .compass-note {
    display: none;
  }
  .status-panel {
    top: 82px;
    width: 110px;
  }
  .mini-map {
    display: none;
  }
  .status-panel > p {
    display: none;
  }
  .status-panel .debt-line {
    margin-top: 12px;
  }
  .target-card {
    bottom: 150px;
    padding: 9px 16px;
    max-width: 310px;
  }
  .target-card > span {
    display: none;
  }
  .target-card div {
    margin: 4px 0;
  }
  .target-card small {
    font-size: 9px;
  }
  .tutorial-card {
    left: 50%;
    transform: translateX(-50%);
    bottom: 145px;
    width: 260px;
    padding: 9px 13px;
  }
  .tutorial-card > span,
  .tutorial-card button {
    display: none;
  }
  .tutorial-card > strong {
    font-size: 12px;
    margin-top: 0;
  }
  .tutorial-card p {
    font-size: 10px;
    line-height: 1.6;
  }
  .tutorial-card:not(.hidden) ~ .target-card {
    display: none;
  }
  .boss-panel {
    top: 77px;
    width: 270px;
  }
  .boss-caption {
    font-size: 8px;
  }
  .bottom-hud {
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .player-status,
  .controls-note {
    display: none;
  }
  .bottom-hud {
    justify-content: center;
  }
  .ability-dock {
    width: 285px;
  }
  .ability {
    min-height: 48px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  #interaction-hint {
    height: 18px;
    font-size: 8px;
    margin-top: 6px;
  }
  .low-health,
  .storm-warning {
    top: 61%;
    font-size: 8px;
  }
  .phase-banner {
    top: 46%;
  }
  .phase-banner > strong {
    font-size: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .phase-banner,
  .low-health,
  .boss-panel,
  .difficulty-options button {
    animation: none;
    transition: none;
  }
}

/* P0: keep status readable and leave the moving playfield clear. */
#stage-label {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  border: 0;
  background: transparent;
  padding: 4px 0;
  min-height: 32px;
  text-align: left;
}
#stage-label::after {
  content: " ＋";
  color: #9fba8d;
}
.objective.expanded #stage-label::after {
  content: " −";
}
.objective:not(.expanded) {
  padding-top: 8px;
  padding-bottom: 10px;
}
.objective:not(.expanded) .anchor-progress {
  margin-top: 5px;
}
.objective.expanded #objective-copy,
.objective.expanded #checkpoint-note {
  display: block;
}
.phase-banner {
  top: auto;
  bottom: 180px;
  left: 40px;
  transform: none;
  width: min(310px, calc(100vw - 80px));
  padding: 10px 14px;
  text-align: left;
  border-left: 1px solid #a7caa06e;
  background: linear-gradient(90deg, #0e211edb, #10241e44);
}
.phase-banner > small {
  font-size: 8px;
  letter-spacing: 2px;
}
.phase-banner > strong {
  font-size: 18px;
  letter-spacing: 2px;
  margin: 6px 0;
}
.phase-banner > p {
  font-size: 10px;
  letter-spacing: 0.5px;
}
.toast {
  top: auto;
  bottom: calc(160px + env(safe-area-inset-bottom));
  max-width: min(440px, 85vw);
  padding: 7px 13px;
  font-size: 10px;
  letter-spacing: 0.5px;
  line-height: 1.6;
}
#hud > .combat-diagnostics {
  position: fixed;
  right: 20px;
  bottom: calc(340px + env(safe-area-inset-bottom));
  pointer-events: auto;
  min-height: 44px;
  padding: 7px 10px;
  font-size: 10px;
  color: #b7caa9;
  background: #0e211edb;
}
#diagnostics-output {
  box-sizing: border-box;
  width: 100%;
  min-height: 200px;
  padding: 10px;
  color: #c5d7b7;
  background: #0e211e;
  font: 11px/1.6 monospace;
  user-select: text;
  -webkit-user-select: text;
}
@media (pointer: coarse), (max-width: 650px) {
  #stage-label {
    min-height: 44px;
  }
  .toast {
    bottom: calc(260px + env(safe-area-inset-bottom));
  }
  .phase-banner {
    left: max(22px, env(safe-area-inset-left));
    bottom: calc(270px + env(safe-area-inset-bottom));
    width: min(260px, calc(100vw - 60px));
  }
  .tutorial-card button {
    display: inline-block;
    min-height: 44px;
  }
}
@media (max-height: 520px) and (pointer: coarse) {
  .objective .anchor-progress {
    display: flex;
    gap: 5px;
  }
  .toast {
    bottom: calc(230px + env(safe-area-inset-bottom));
  }
  .phase-banner {
    bottom: calc(235px + env(safe-area-inset-bottom));
  }
}
