:root {
  color-scheme: dark;
  --navy: #132633;
  --navy-2: #1d3540;
  --teal: #8dbcb6;
  --paper: #e9dec5;
  --gold: #efc87f;
  --ink: #f4eddb;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: #0d1d27; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, #234552 0, transparent 33%),
    radial-gradient(circle at 88% 85%, #1b3a43 0, transparent 35%),
    #0d1d27;
}
button { font: inherit; cursor: pointer; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }

.page-shell { max-width: 1180px; margin: 0 auto; padding: 0 24px 24px; }
.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(244,237,219,.15);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 40px; height: 40px; border: 1px solid rgba(141,188,182,.8); border-radius: 50%;
  display: grid; place-items: center; transform: rotate(-15deg); position: relative;
}
.brand-mark::before, .brand-mark::after, .brand-mark span {
  content: ""; position: absolute; border: 1px solid rgba(141,188,182,.7); border-radius: 50%;
}
.brand-mark::before { width: 27px; height: 17px; }
.brand-mark::after { width: 15px; height: 9px; }
.brand-mark span { width: 3px; height: 3px; background: var(--gold); border: 0; }
.brand-overline { font-size: 9px; letter-spacing: .24em; color: #a6c8c4; font-weight: 700; }
.brand-title { margin-top: 4px; font-size: 16px; letter-spacing: .08em; font-weight: 800; }
.sound-button, .quiet-button {
  border: 1px solid rgba(244,237,219,.22); color: #d8e5d9; background: rgba(18,39,48,.55);
  border-radius: 999px; padding: 9px 15px; transition: background .18s, border-color .18s;
}
.sound-button:hover, .quiet-button:hover { background: #294b53; border-color: #7fa9a6; }
.sound-button { font-size: 12px; min-width: 84px; min-height: 42px; }

.intro { padding-top: 30px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .72fr); align-items: stretch; }
.intro-art-wrap {
  min-height: 540px; position: relative; overflow: hidden; border: 1px solid #5b655e; border-radius: 18px 0 0 18px;
  background: #263b43; box-shadow: 0 25px 80px rgba(0,0,0,.22);
}
.intro-art { width: 100%; height: 100%; display: block; position: absolute; object-fit: cover; object-position: 42% center; }
.intro-art-vignette { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 70%, rgba(18,38,51,.55)); pointer-events: none; }
.intro-badge { position: absolute; left: 25px; bottom: 24px; width: 74px; height: 26px; border: 1px solid rgba(247,234,211,.8); border-radius: 999px; backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; gap: 7px; }
.intro-badge i { width: 5px; height: 5px; border-radius: 50%; background: #f6e2b7; }
.intro-badge i:nth-child(2) { opacity: .55; }
.intro-badge i:nth-child(3) { opacity: .28; }
.intro-panel {
  background: #e9dec5; color: #1a2f36; border-radius: 0 18px 18px 0; padding: 54px 45px 34px;
  border: 1px solid #d1c8ad; display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 25px 80px rgba(0,0,0,.22);
}
.intro-rule { display: flex; align-items: center; gap: 15px; color: #9e794e; font-size: 17px; }
.intro-rule span { height: 1px; width: 28px; background: #ad9673; }
h1 { font-size: clamp(31px, 3vw, 49px); line-height: 1.26; letter-spacing: -.04em; margin: 20px 0 16px; }
.intro-subtitle { font-size: 17px; font-weight: 800; letter-spacing: .035em; margin: 0 0 18px; }
.intro-description { font-size: 14px; line-height: 2; color: #46585a; margin: 0 0 32px; }
.primary-button {
  min-height: 55px; display: inline-flex; align-items: center; justify-content: space-between; gap: 20px;
  border: 1px solid #17424b; border-radius: 8px; padding: 11px 22px; background: #1b4851; color: #fff4da;
  font-weight: 800; box-shadow: 0 8px 0 #b6af94; transition: transform .15s, box-shadow .15s, background .15s;
}
.primary-button:hover { background: #27606b; transform: translateY(2px); box-shadow: 0 6px 0 #b6af94; }
.primary-button:active { transform: translateY(7px); box-shadow: 0 1px 0 #b6af94; }
.primary-button span:last-child { font-size: 21px; font-weight: 300; }
.intro-controls { margin: 26px 0 0; color: #6d7874; font-size: 11px; line-height: 1.7; }

.play-view { max-width: 1050px; margin: 22px auto 0; }
.hud { display: flex; gap: 8px; margin-bottom: 12px; }
.hud-main, .hud-stat {
  min-height: 63px; border: 1px solid rgba(227,232,218,.18); background: rgba(22,47,55,.9); border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center; padding: 9px 18px;
}
.hud-main { flex: 2; border-color: rgba(239,200,127,.5); background: #213e45; }
.hud-stat { flex: 1; }
.hud-caption { font-size: 10px; color: #a8c4be; letter-spacing: .12em; }
.hud strong { margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.board-frame { border: 1px solid #587775; border-radius: 15px; overflow: hidden; background: #dbcbaa; box-shadow: 0 25px 75px rgba(0,0,0,.25); }
.board-heading {
  height: 47px; background: #1b3942; display: flex; gap: 10px; align-items: center; padding: 0 20px;
  color: #e5e0cc; font-size: 12px; letter-spacing: .05em;
}
.board-heading-dot { width: 7px; height: 7px; border-radius: 50%; background: #efc87f; box-shadow: 0 0 10px #efc87f; }
.canvas-wrap { position: relative; display: flex; justify-content: center; align-items: center; overflow: hidden; }
canvas { display: block; width: 100%; max-width: 100%; height: auto; touch-action: none; user-select: none; }
.view-button { display: none; flex: 0 0 auto; margin-left: auto; min-height: 34px; padding: 5px 10px; border: 1px solid #e9d3a0; border-radius: 18px; background: rgba(24, 49, 61, .88); color: #fff1ce; font: 700 11px system-ui, sans-serif; box-shadow: 0 2px 8px rgba(8,26,30,.22); touch-action: manipulation; }
.view-button:focus-visible { outline: 3px solid #fff0bd; outline-offset: 2px; }
.board-message { min-height: 36px; padding: 9px 17px; background: #eee2c8; color: #34515a; font-size: 12px; text-align: center; }
.dev-overlay { position: absolute; top: 6px; left: 6px; color: white; background: #132633cf; padding: 4px 7px; font: 11px ui-monospace, monospace; border-radius: 4px; pointer-events: none; }
.action-strip { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 14px 2px; }
.utility-actions { display: flex; gap: 8px; }
.quiet-button { border-radius: 8px; min-height: 44px; font-size: 12px; }
.touch-controls { display: grid; grid-template-columns: repeat(3, 51px); grid-template-rows: repeat(3, 51px); gap: 3px; grid-template-areas: ". up ." "left center right" ". down ."; margin-bottom: 4px; }
.direction-button { width: 51px; height: 51px; border-radius: 10px; border: 1px solid #88aba6; background: #21444e; color: #efdfb9; font-size: 21px; touch-action: manipulation; }
.direction-button:active { background: #427276; }
.direction-button.up { grid-area: up; }
.direction-button.down { grid-area: down; }
.direction-button.left { grid-area: left; }
.direction-button.right { grid-area: right; }
.direction-center { grid-area: center; min-width: 49px; min-height: 49px; border: 1px solid #d9ba7b; border-radius: 50%; color: #fff1d0; background: #785e42; display: grid; place-items: center; font-size: 20px; box-shadow: 0 0 0 3px rgba(239,200,127,.12); touch-action: manipulation; }
.direction-center:active { background: #ad8050; }
.stage-panel { margin: 14px 0 5px; border: 1px solid #879d8f; border-radius: 14px; background: #e8dcc1; color: #1e3b43; text-align: center; padding: 24px; }
.stage-panel-symbol { font-size: 22px; color: #b98a50; }
.stage-panel h2 { font-size: 26px; margin: 8px 0; }
.stage-panel p { font-size: 13px; line-height: 1.7; margin-bottom: 25px; }
.stage-panel .primary-button { min-width: 210px; }
.site-footer { text-align: center; color: #72918f; font-size: 10px; letter-spacing: .1em; padding: 32px 0 4px; }

@media (max-width: 780px) {
  .page-shell { padding: 0 14px 20px; }
  .site-header { min-height: 74px; }
  .intro { padding-top: 15px; grid-template-columns: 1fr; }
  .intro-art-wrap { min-height: 0; aspect-ratio: 1.5; border-radius: 14px 14px 0 0; }
  .intro-art { object-position: center; }
  .intro-art-vignette { background: linear-gradient(0deg, rgba(18,38,51,.4), transparent 50%); }
  .intro-panel { border-radius: 0 0 14px 14px; padding: 28px 26px 24px; }
  h1 { font-size: 34px; margin: 12px 0; }
  .intro-description { margin-bottom: 22px; }
  .intro-controls { margin-top: 18px; }
}

@media (max-width: 700px) {
  .view-button { display: block; }
}

@media (max-width: 480px) {
  .brand-mark { width: 33px; height: 33px; }
  .brand-title { font-size: 13px; }
  .brand-overline { font-size: 7px; }
  .sound-button { padding: 6px 8px; min-width: 69px; font-size: 10px; }
  .intro-art-wrap { aspect-ratio: 1.35; }
  .intro-panel { padding: 23px 21px; }
  h1 { font-size: 32px; }
  .intro-subtitle { font-size: 14px; }
  .intro-description { font-size: 12px; }
  .play-view { margin-top: 12px; }
  .hud { gap: 4px; }
  .hud-main, .hud-stat { min-height: 55px; padding: 6px 8px; }
  .hud-caption { font-size: 9px; }
  .hud strong { font-size: 15px; }
  .board-heading { font-size: 10px; padding: 0 10px; height: 40px; }
  .board-message { min-height: 33px; font-size: 10px; }
  .action-strip { align-items: center; }
  .utility-actions { flex-direction: column; }
  .quiet-button { min-width: 90px; }
  .touch-controls { grid-template-columns: repeat(3, 49px); grid-template-rows: repeat(3, 49px); }
  .direction-button { width: 49px; height: 49px; }
  .site-footer { padding-top: 20px; }
}

@media (hover: hover) and (pointer: fine) and (min-width: 780px) {
  .touch-controls { opacity: .72; }
}
