:root {
  --ink: #050914;
  --ink-2: #081223;
  --panel: #0b1528;
  --panel-2: #101c35;
  --line: #1f7dff;
  --line-soft: #18436f;
  --cyan: #75e8ff;
  --cyan-bright: #bff9ff;
  --pink: #ff6d9f;
  --pink-soft: #ffb8cf;
  --gold: #ffd363;
  --green: #92f4a5;
  --text: #eaf6ff;
  --muted: #83a2be;
  --shadow: rgba(0, 0, 0, .5);
  --pixel-font: "DotGothic16", "MS Gothic", "Yu Gothic", monospace;
  color-scheme: dark;
  font-family: var(--pixel-font);
  background: var(--ink);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(16, 61, 112, .42), transparent 32rem),
    radial-gradient(circle at 90% 70%, rgba(90, 26, 80, .26), transparent 28rem),
    linear-gradient(180deg, #050a16 0%, #02040b 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }

.arcade-page {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.site-header {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  align-items: center;
  gap: 22px;
  min-height: 118px;
  padding: 18px 22px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(20, 73, 130, .2), transparent 45%, rgba(99, 24, 91, .2)),
    rgba(3, 8, 18, .9);
  box-shadow: 0 0 0 4px #02050c, 0 0 26px rgba(22, 117, 255, .17);
}

.brand-badge {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 12px 10px;
  color: var(--cyan-bright);
  border: 2px solid #275db0;
  background: #071329;
  text-align: center;
  box-shadow: inset 0 0 0 2px #091b3b;
  transform: rotate(-1deg);
}

.brand-badge span { font-size: clamp(10px, 1.2vw, 15px); font-weight: 700; letter-spacing: .06em; }
.brand-badge small { color: var(--gold); font-size: 12px; letter-spacing: .2em; }

.title-wrap { text-align: center; }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font-size: clamp(10px, 1.4vw, 16px); letter-spacing: .22em; }
h1 { margin: 0; color: var(--pink-soft); text-shadow: 3px 3px 0 #6a254c, 0 0 14px rgba(255, 67, 135, .4); font-size: clamp(31px, 5vw, 72px); letter-spacing: .06em; line-height: .92; }
h1 span { color: var(--cyan-bright); text-shadow: 3px 3px 0 #1b4d78, 0 0 14px rgba(64, 226, 255, .42); }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .25em; }

.header-note { color: #e4d8e5; font-size: 13px; line-height: 1.75; text-align: right; }

main { padding-top: 22px; }

.game-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 190px;
  align-items: start;
  gap: 16px;
}

.info-panel, .howto-panel, .score-panel, .ranking-panel {
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, rgba(14, 31, 59, .97), rgba(4, 11, 24, .96));
  box-shadow: inset 0 0 0 2px rgba(8, 22, 47, .75), 0 8px 24px var(--shadow);
}

.info-panel { padding: 14px 12px; min-height: 540px; }

.panel-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.panel-heading h2 { margin: 0; color: var(--cyan); font-size: 12px; letter-spacing: .08em; }
.diamond { width: 10px; height: 10px; display: inline-block; background: var(--cyan); border: 1px solid #d8fdff; transform: rotate(45deg); box-shadow: 0 0 8px rgba(117, 232, 255, .4); }

.stage-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.stage-list li {
  display: grid;
  grid-template-columns: 27px 1fr;
  grid-template-rows: auto auto;
  column-gap: 7px;
  padding: 8px 7px;
  color: #7089a8;
  border: 1px solid #163965;
  background: rgba(5, 12, 26, .82);
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.stage-list li b { grid-row: 1 / 3; color: #416995; font-size: 16px; }
.stage-list li span { color: #8ca8c9; font-weight: 700; font-size: 11px; letter-spacing: .03em; }
.stage-list li small { color: #4c6f93; font-size: 8px; margin-top: 3px; }
.stage-list li.active { border-color: var(--pink); color: var(--pink-soft); transform: translateX(3px); box-shadow: inset 3px 0 0 var(--pink), 0 0 9px rgba(255, 109, 159, .14); }
.stage-list li.active b, .stage-list li.active span { color: var(--pink-soft); }
.stage-list li.active small { color: var(--gold); }
.stage-list li[role="button"] { cursor: pointer; }
.stage-list li[role="button"]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.panel-note { margin: 15px 0 0; color: var(--muted); font-size: 10px; line-height: 1.75; }

.screen-column { min-width: 0; }
.screen-frame { padding: 9px; border: 1px solid #277fdc; background: #02050d; box-shadow: 0 0 0 3px #07152a, 0 0 25px rgba(40, 126, 244, .25); }
.screen-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 9px; color: var(--cyan); background: #06142a; font-size: 11px; letter-spacing: .1em; }
.screen-status-group { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pause-button { min-height: 26px; padding: 4px 8px; color: #fff0a6; border: 1px solid var(--gold); background: #342b13; box-shadow: 2px 2px 0 #110f08; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.pause-button:hover { color: #061020; background: var(--gold); }
.canvas-wrap { position: relative; width: 100%; overflow: hidden; background: #02040b; }
#game-canvas { display: block; width: 100%; height: auto; aspect-ratio: 40 / 27; image-rendering: pixelated; background: #030611; }
.scanlines { position: absolute; inset: 0; pointer-events: none; opacity: .16; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .05) 0, rgba(255, 255, 255, .05) 1px, transparent 1px, transparent 4px); mix-blend-mode: screen; }
.skip-ending-button { position: absolute; z-index: 4; top: 12px; right: 12px; min-width: 88px; min-height: 46px; padding: 8px 12px; color: #061020; border: 2px solid #ffd363; background: #fff0a6; box-shadow: 3px 3px 0 rgba(18, 13, 3, .8); font: 700 12px "DotGothic16", "MS Gothic", monospace; letter-spacing: .06em; touch-action: manipulation; }
.skip-ending-button:hover { filter: brightness(1.08); }
.skip-ending-button:focus-visible { outline: 3px solid #75e8ff; outline-offset: 3px; }
.skip-ending-button[hidden] { display: none; }

.screen-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 10px 12px; border: 1px solid #163965; background: #071226; }
#game-message { margin: 0; color: #a8c0d8; font-size: 12px; line-height: 1.5; }
.start-button, .secondary-button, .control-button {
  min-height: 38px;
  padding: 9px 14px;
  color: #061020;
  border: 2px solid var(--cyan-bright);
  background: var(--cyan);
  box-shadow: 3px 3px 0 #163f78;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
}
.start-button:hover, .secondary-button:hover, .control-button:hover { filter: brightness(1.15); transform: translate(-1px, -1px); }
.start-button:active, .secondary-button:active, .control-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #163f78; }
.secondary-button { color: var(--cyan-bright); border-color: var(--line); background: #0b2346; box-shadow: 3px 3px 0 #02050d; }

.mobile-controls { display: none; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.control-button { min-height: 56px; padding: 12px 6px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.control-button:focus-visible, .pause-button:focus-visible { outline: 2px solid var(--cyan-bright); outline-offset: 2px; }
.pause-control { color: var(--gold); border-color: var(--gold); background: #342b13; box-shadow: 3px 3px 0 #110f08; }
.shot-control { grid-column: 1 / -1; color: var(--pink-soft); border-color: var(--pink); background: #3b1630; box-shadow: 3px 3px 0 #160916; }

.item-panel { display: grid; align-content: start; gap: 9px; }
.item-card { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 7px; padding: 8px 5px; border: 1px solid #1a3d69; background: rgba(4, 12, 27, .85); }
.item-card strong { display: block; font-size: 10px; color: var(--text); }
.item-card strong b { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 3px; border: 1px solid currentColor; color: var(--cyan); }
.item-card span, .item-card small { display: block; font-size: 8px; line-height: 1.5; color: var(--muted); }
.item-card small { color: #557a9e; margin-top: 2px; }
.item-r strong { color: var(--pink-soft); }
.item-s strong { color: var(--cyan); }
.item-b strong { color: var(--gold); }
.item-r strong b { color: var(--pink-soft); }
.item-s strong b { color: var(--cyan); }
.item-b strong b { color: var(--gold); }

.item-icon { display: block; width: 42px; height: 31px; image-rendering: pixelated; }

.effect-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.effect-readout span { padding: 7px 4px; color: #7391b4; border: 1px solid #1a3d69; text-align: center; font-size: 9px; }
.effect-readout span:first-child b { color: var(--pink-soft); }
.effect-readout span:last-child b { color: var(--cyan); }

.lower-grid { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 16px; margin-top: 16px; }
.howto-panel, .score-panel, .ranking-panel { min-height: 170px; padding: 15px; }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.howto-grid div { padding: 8px; border: 1px solid #183b67; background: #071226; }
.howto-grid b, .howto-grid span, .howto-grid small { display: block; }
.howto-grid b { color: var(--gold); font-size: 10px; }
.howto-grid span { color: var(--cyan-bright); font-size: 12px; margin-top: 5px; }
.howto-grid small { color: var(--muted); font-size: 8px; margin-top: 4px; }
.score-grid { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 11px; }
.score-grid span { color: var(--muted); }
.score-grid b { color: var(--gold); }
.ranking-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.ranking-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 7px; padding: 5px 7px; color: #a8c0d8; border-bottom: 1px solid #143052; font-size: 10px; }
.ranking-list li::before { counter-increment: rank; content: counter(rank, decimal-leading-zero); color: var(--pink-soft); }
.ranking-list li strong { color: var(--cyan-bright); font-size: 11px; }
.ranking-list li span { color: var(--gold); }

.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 2px 0; color: #506f8e; font-size: 9px; letter-spacing: .08em; }

.result-modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0, 3, 10, .84); }
.result-modal[hidden] { display: none; }
.result-card { position: relative; width: min(420px, 100%); padding: 30px 24px 22px; border: 2px solid var(--line); background: linear-gradient(160deg, #101e3a, #050b19); box-shadow: 0 0 0 5px #071326, 0 0 35px rgba(44, 139, 255, .4); text-align: center; }
.modal-close { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; color: var(--muted); border: 0; background: transparent; font-size: 24px; }
.result-kicker { margin: 0 0 9px; color: var(--cyan); font-size: 10px; letter-spacing: .2em; }
.result-card h2 { margin: 0; color: var(--pink-soft); text-shadow: 2px 2px 0 #67254a; font-size: 29px; letter-spacing: .08em; }
.result-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.final-score { margin: 16px 0; padding: 10px; color: var(--gold); border: 1px solid #6b592a; background: #16130b; font-size: 11px; letter-spacing: .1em; }
.final-score strong { display: block; margin-top: 5px; color: #fff0a6; font-size: 25px; letter-spacing: .12em; }
.score-form { display: grid; gap: 9px; text-align: left; }
.score-form label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.score-form input { width: 100%; padding: 9px; color: var(--text); border: 1px solid #2a5989; outline: none; background: #050b18; }
.score-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(117, 232, 255, .15); }
.score-form .start-button { width: 100%; margin-top: 5px; }
.save-note { margin: 10px 0 13px !important; color: #6f91af !important; font-size: 9px !important; }
.result-card .secondary-button { width: 100%; }

@media (max-width: 1100px) {
  .game-layout { grid-template-columns: 160px minmax(0, 1fr) 160px; gap: 10px; }
  .info-panel { padding: 12px 9px; }
  .header-note { font-size: 10px; }
  .stage-list li span { font-size: 9px; }
}

@media (max-width: 820px) {
  .arcade-page { width: min(100% - 18px, 700px); padding-top: 10px; }
  .site-header { grid-template-columns: 1fr; gap: 12px; text-align: center; }
  .brand-badge { justify-self: center; }
  .header-note { text-align: center; }
  .game-layout { grid-template-columns: 1fr; }
  .info-panel { min-height: auto; }
  .stage-panel { order: 2; }
  .item-panel { order: 3; }
  .screen-column { order: 1; }
  .stage-list { grid-template-columns: repeat(3, 1fr); }
  .item-panel { grid-template-columns: repeat(3, 1fr); }
  .item-panel .panel-heading, .item-panel .effect-readout, .item-panel .panel-note { grid-column: 1 / -1; }
  .item-card { grid-template-columns: 34px 1fr; }
  .item-icon { width: 34px; height: 25px; }
  .lower-grid { grid-template-columns: 1fr 1fr; }
  .ranking-panel { grid-column: 1 / -1; }
  .mobile-controls { display: grid; }
  .panel-heading h2 { font-size: 15px; }
  .panel-note { font-size: 12px; line-height: 1.65; }
  .stage-list li { padding: 10px 9px; }
  .stage-list li b { font-size: 17px; }
  .stage-list li span { font-size: 13px; }
  .stage-list li small { font-size: 11px; }
  .item-card strong { font-size: 13px; }
  .item-card span, .item-card small { font-size: 11px; }
  .howto-grid b { font-size: 12px; }
  .howto-grid span { font-size: 14px; }
  .howto-grid small { font-size: 11px; }
  .score-grid { font-size: 13px; }
  .ranking-list li { font-size: 12px; }
  .ranking-list li strong { font-size: 13px; }
  #game-message { font-size: 14px; }
  .start-button, .secondary-button { min-height: 50px; font-size: 14px; }
  .screen-topbar { font-size: 11px; }
  .effect-readout span { font-size: 12px; }
}

@media (max-width: 520px) {
  .arcade-page { width: calc(100% - 12px); }
  .site-header { padding: 14px 10px; }
  h1 { font-size: 29px; }
  .tagline { font-size: 8px; }
  .screen-topbar { gap: 6px; font-size: 11px; }
  .screen-status-group { gap: 6px; }
  .pause-button { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .screen-actions { align-items: stretch; flex-direction: column; }
  .start-button { width: 100%; min-height: 54px; font-size: 15px; }
  .stage-list { grid-template-columns: repeat(2, 1fr); }
  .item-panel { grid-template-columns: 1fr; }
  .item-panel .panel-heading, .item-panel .effect-readout, .item-panel .panel-note { grid-column: auto; }
  .effect-readout { grid-column: 1 / -1 !important; }
  .item-card { grid-template-columns: 43px 1fr; }
  .item-icon { width: 42px; height: 31px; }
  .lower-grid { grid-template-columns: 1fr; }
  .ranking-panel { grid-column: auto; }
  .site-footer { flex-direction: column; line-height: 1.5; }
  .panel-heading h2 { font-size: 15px; }
  .stage-list li span { font-size: 13px; }
  .stage-list li small { font-size: 11px; }
  .item-card strong { font-size: 14px; }
  .item-card span, .item-card small { font-size: 11px; }
  .screen-actions #game-message { font-size: 14px; }
  .control-button { min-height: 60px; font-size: 15px; }
}
