:root {
  --ink: #f3ead3;
  --ink-soft: rgba(243, 234, 211, 0.78);
  --jade: #75bcae;
  --jade-deep: #184f4a;
  --lacquer: #5d231d;
  --night: #0f1716;
  --night-soft: rgba(15, 23, 22, 0.82);
  --panel: rgba(18, 38, 36, 0.82);
  --panel-border: rgba(121, 188, 174, 0.34);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Iowan Old Style", Baskerville, "Palatino Linotype", "Songti SC", serif;
  background:
    radial-gradient(circle at top, rgba(117, 188, 174, 0.22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(93, 35, 29, 0.35), transparent 28%),
    linear-gradient(135deg, #091211, #0f1716 45%, #1d2424);
  background-attachment: fixed;
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1000px) minmax(260px, 320px);
  gap: 24px;
  padding: 28px;
  min-height: 100vh;
  width: min(100%, 1400px);
  margin: 0 auto;
}

.stage-panel,
.notes-panel {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(17, 30, 29, 0.92), rgba(10, 18, 18, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.stage-panel {
  padding: 28px;
  overflow: hidden;
}

.notes-panel {
  padding: 20px;
  display: grid;
  gap: 16px;
  align-self: start;
}

.masthead {
  max-width: 68ch;
}

.eyebrow {
  margin: 0 0 10px;
  color: #8fd4c6;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.73rem;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.04;
}

h2 {
  font-size: 1.55rem;
}

.lede,
.status-line,
.stage-tip,
.flat-list {
  color: var(--ink-soft);
}

.lede {
  margin: 14px 0 0;
  line-height: 1.6;
  font-size: 1rem;
}

.edition-links{display:flex;gap:18px;flex-wrap:wrap;align-items:center;margin-top:18px;font-size:.85rem;letter-spacing:.08em}
.edition-links span{color:#d7c28d}.edition-links a{color:#a9d6c6;text-decoration:none;border-bottom:1px solid #a9d6c633;padding-bottom:3px}
.edition-links a:hover,.edition-links a:focus-visible{color:#f3ead3;border-color:currentColor}
kbd{padding:1px 5px;border:1px solid #9aa99555;border-radius:4px;font:inherit;font-size:.9em;color:#ede1bb;white-space:nowrap}
.load-retry{padding:12px 20px;margin:12px 4px 0;color:#f3ead3;background:#21413a;border:1px solid #bca56e;border-radius:8px;font:inherit;cursor:pointer}
.load-retry[hidden]{display:none}.load-retry:focus-visible{outline:2px solid #f3d48c;outline-offset:4px}
.stage-frame:fullscreen{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:12px;margin:0;border:0;border-radius:0;background:#080f10;overflow:auto}
.stage-frame:fullscreen #game{width:auto;max-width:100%;height:calc(100dvh - 86px);max-height:calc((100vw - 24px)*.75);flex:none;border-radius:3px}
.stage-frame:fullscreen .game-toolbar{margin:0;justify-content:center}.stage-frame:fullscreen .stage-tip{display:none}
@media (hover:none),(pointer:coarse),(max-width:720px){
 .stage-frame:fullscreen #game{height:calc(100dvh - 245px)}
 .stage-frame:fullscreen .touch-controls{width:min(700px,100%);margin:0;grid-template-columns:minmax(144px,1fr) minmax(160px,1fr);gap:10px}
 .stage-frame:fullscreen .touch-dpad{width:auto;justify-self:stretch;grid-template-rows:repeat(2,40px)}
 .stage-frame:fullscreen .volume-control{width:auto;order:0}.stage-frame:fullscreen .volume-control input{width:74px}
}
@media (max-height:500px) and (pointer:coarse){
 .stage-frame:fullscreen #game{height:calc(100dvh - 74px)}
 .stage-frame:fullscreen .touch-controls{position:absolute;inset:auto 12px 72px;pointer-events:none;width:auto;grid-template-columns:140px 150px;justify-content:space-between;opacity:.86}
 .stage-frame:fullscreen .touch-controls button{pointer-events:auto;min-height:38px}
}

.stage-frame {
  min-width: 0;
  margin-top: 22px;
  padding: 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(117, 188, 174, 0.07), rgba(117, 188, 174, 0)),
    linear-gradient(135deg, rgba(93, 35, 29, 0.22), rgba(14, 29, 28, 0.88));
  border: 1px solid rgba(143, 212, 198, 0.2);
}

#game {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  border: 1px solid rgba(143, 212, 198, 0.26);
  background: #050808;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 18px 34px rgba(0, 0, 0, 0.34);
  cursor: url("../image/others/mouse/huaimilanse.cur"), pointer;
  touch-action: none;
}

#game:focus {
  outline: none;
}

#game:focus-visible {
  outline: 3px solid rgba(143, 212, 198, 0.9);
  outline-offset: 6px;
}

.stage-tip {
  margin: 12px 4px 0;
  font-size: 0.93rem;
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.game-toolbar button,
.touch-controls button {
  min-height: 40px;
  border: 1px solid rgba(143, 212, 198, 0.36);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(13, 34, 32, 0.9);
  font: 600 0.9rem/1 "Iowan Old Style", Baskerville, "Songti SC", serif;
  cursor: pointer;
}

.game-toolbar button {
  padding: 0 14px;
}

.game-toolbar button:hover,
.game-toolbar button:focus-visible,
.touch-controls button:focus-visible {
  border-color: rgba(143, 212, 198, 0.9);
  background: rgba(28, 77, 70, 0.94);
  outline: 2px solid rgba(143, 212, 198, 0.34);
  outline-offset: 2px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(143, 212, 198, 0.2);
  border-radius: 12px;
  color: var(--ink-soft);
  background: rgba(7, 19, 18, 0.62);
  font-size: 0.9rem;
}

.volume-control input {
  width: 112px;
  accent-color: var(--jade);
}

.touch-controls {
  display: none;
  grid-template-columns: minmax(144px, 0.9fr) minmax(180px, 1.1fr);
  gap: 18px;
  margin-top: 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(44px, 1fr));
  grid-template-rows: repeat(2, 48px);
  gap: 6px;
}

.touch-dpad .touch-up {
  grid-column: 2;
  grid-row: 1;
}

.touch-dpad .touch-left {
  grid-column: 1;
  grid-row: 2;
}

.touch-dpad .touch-down {
  grid-column: 2;
  grid-row: 2;
}

.touch-dpad .touch-right {
  grid-column: 3;
  grid-row: 2;
}

.touch-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 6px;
}

.touch-controls button {
  min-width: 44px;
  padding: 0 10px;
  touch-action: none;
}

.touch-controls button.is-held {
  border-color: #b7f6e5;
  color: #071512;
  background: #86cfbd;
  box-shadow: 0 0 0 3px rgba(117, 188, 174, 0.2);
  transform: translateY(1px);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.status-card,
.note-card {
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(19, 40, 38, 0.92), rgba(14, 24, 24, 0.88));
  border: 1px solid rgba(143, 212, 198, 0.14);
}

.status-line {
  margin: 10px 0 0;
  font-size: 0.97rem;
}

.status-line strong {
  color: var(--ink);
  font-weight: 600;
}

.note-card summary {
  color: #8fd4c6;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.note-card summary::marker {
  color: rgba(143, 212, 198, 0.7);
}

.flat-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .stage-panel {
    padding: 20px;
  }

  .notes-panel {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 720px) {
  .touch-controls {
    display: grid;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 8px;
  }

  .stage-panel {
    padding: 10px;
    border-radius: 16px;
  }

  .masthead .lede {
    display: none;
  }

  h1 {
    font-size: 1.7rem;
  }

  .stage-frame {
    margin-top: 12px;
    padding: 8px;
    border-radius: 16px;
  }

  #game {
    border-radius: 10px;
  }

  .touch-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .touch-dpad {
    width: min(100%, 230px);
    justify-self: center;
  }

  .touch-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-toolbar {
    gap: 6px;
  }

  .volume-control {
    order: 3;
    width: 100%;
  }

  .volume-control input {
    flex: 1;
  }

  .notes-panel {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.classic-dialogue{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.classic-dialogue[hidden]{display:none}
.classic-dialogue button{display:none}
@media(max-width:600px),(max-height:500px) and (pointer:coarse){
 .classic-dialogue:not([hidden]){display:block;position:relative;width:auto;height:auto;overflow:visible;clip-path:none;padding:14px;margin-top:8px;background:#111e20;border:1px solid #70988d;border-radius:8px;color:#f6f0df}
 .stage-frame:has(.classic-dialogue:not([hidden])) .touch-controls{display:none}
 .stage-frame:fullscreen .classic-dialogue{width:min(800px,100%);flex:none}
 .classic-dialogue-copy{min-width:0}
 .classic-dialogue strong{display:block;min-height:34px;padding-right:94px;font-size:18px;color:#eedaa9}
 .classic-dialogue p{margin:8px 0 0;font-size:18px;line-height:1.6;overflow-wrap:anywhere}
 .classic-dialogue button{display:block;position:absolute;top:10px;right:12px;min-height:44px;min-width:54px;padding:8px;font-size:15px;background:#142b2b;border:1px solid #70988d;border-radius:8px;color:#f6f0df;cursor:pointer}
 .classic-dialogue button:focus-visible{outline:2px solid #efd58b;outline-offset:2px}
}

@media(max-height:500px) and (pointer:coarse){
 .stage-frame:fullscreen:has(.classic-dialogue:not([hidden])){justify-content:flex-start}
 .stage-frame:fullscreen:has(.classic-dialogue:not([hidden])) #game{height:max(80px,calc(100dvh - 230px))}
}
