:root {
  --ink: #071323;
  --soft: #17324d;
  --paper: #fffaf0;
  --coral: #d9563f;
  --gold: #f8c35a;
  --cyan: #52c7d8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: #dbe6ef;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
}

body.hg-game-active {
  overflow: hidden;
}

.game-shell {
  width: min(1180px, 100%);
  margin: auto;
  padding-bottom: 34px;
}

.intro {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
}

.hero-stage {
  margin: 24px 0 24px 24px;
  align-self: start;
}

.hero-stage > img {
  display: block;
  width: 100%;
}

.hero-tag {
  position: absolute;
  left: 18px;
  bottom: 16px;
  max-width: calc(100% - 36px);
  padding: 5px 8px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.05em;
}

.intro-copy {
  padding: 24px;
}

.eyebrow {
  color: var(--coral);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.1em;
}

.intro h1 {
  margin: 4px 0 8px;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.dek {
  margin: 0 0 12px;
  font-size: clamp(18px, 2.3vw, 26px);
  font-weight: 850;
}

.source-note {
  color: #3f5264;
  font-size: 13px;
}

.intro button {
  margin-top: 4px;
}

.play {
  width: min(500px, calc(100% - 14px));
  margin: 6px auto 18px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.hud > div {
  min-width: 0;
  padding: 4px 3px;
  border: 1px solid #a9b8c5;
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.hud span {
  display: block;
  color: #526477;
  font-size: 10px;
  font-weight: 850;
}

.hud b {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.1;
}

.game-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 100 / 126;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 7px 8px 0 #07132326;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--paper);
  cursor: crosshair;
  touch-action: manipulation;
  outline: none;
}

#game-canvas:focus-visible {
  outline: 4px solid var(--cyan);
  outline-offset: -7px;
}

.tap-hint {
  position: absolute;
  z-index: 4;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fffaf0ed;
  box-shadow: 3px 3px 0 #07132330;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.16s ease-out, transform 0.16s ease-out;
}

.game-stage.engaged .tap-hint {
  opacity: 0;
  transform: translate(-50%, -8px);
}

.feedback {
  position: relative;
  min-height: 42px;
  margin: 7px 0 0;
  padding: 7px 9px 7px 36px;
  border: 0;
  border-left: 7px solid #526477;
  border-radius: 7px;
  background: #fffffff2;
  color: var(--ink);
  box-shadow: 0 3px 7px #0713231a;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  pointer-events: none;
}

.feedback::before {
  content: attr(data-cue);
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  font-size: 17px;
}

.feedback.success {
  border-left-color: var(--cyan);
}

.feedback.warning {
  border-left-color: var(--coral);
}

.tap-strip {
  display: block;
  min-height: 42px;
  margin-top: 7px;
  padding: 8px 10px 8px 38px;
  border-left: 6px solid var(--cyan);
  border-radius: 4px;
  background: #fff;
  color: #41556a;
  font-size: 10px;
  font-weight: 900;
}

.result {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) 1.05fr;
  gap: 24px;
  align-items: center;
  width: min(100% - 28px, 980px);
  margin: 16px auto;
  padding: 24px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #fff;
}

.result > img {
  display: block;
  width: 100%;
  border: 4px solid var(--ink);
  border-radius: 16px;
}

.result h2 {
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.05;
}

.score-line strong {
  font-size: 72px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions .share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 11px 16px;
  border: 3px solid var(--ink);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.next-target {
  padding: 10px 12px;
  border-left: 6px solid var(--cyan);
  background: #eafcff;
  font-weight: 850;
}

.news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.editorial-info {
  width: min(100% - 28px, 980px);
  margin: 18px auto;
  padding: 18px;
  border-left: 7px solid var(--coral);
  background: #fff;
  line-height: 1.7;
}

.editorial-info h2 {
  margin-top: 0;
}

.play,
.actions {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (min-width: 761px) {
  html:lang(ja) body.hg-game-page #intro .intro-copy h1 {
    overflow-wrap: normal !important;
    font-size: clamp(34px, 3.6vw, 48px) !important;
    word-break: keep-all !important;
  }
}

@media (max-width: 760px) {
  .intro {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    margin: 12px 12px 0;
  }

  .intro-copy {
    padding: 16px;
  }

  .intro h1 {
    font-size: 38px;
  }

  .hero-tag {
    bottom: 9px;
    left: 10px;
    max-width: calc(100% - 20px);
    font-size: 9px;
  }

  .result {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .actions > * {
    width: 100%;
  }

  .score-line strong {
    font-size: 58px;
  }

  .news-links {
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .game-shell {
    width: 100%;
  }

  .play {
    display: grid;
    grid-template-rows: auto auto auto;
    align-content: start;
    gap: 5px;
    width: calc(100% - 12px);
    height: max(
      510px,
      calc(
        var(--hg-visual-viewport-height, 100dvh) -
          var(--hg-game-header-block, 64px) - 8px
      )
    );
    overflow: hidden;
  }

  .hud {
    gap: 3px;
    margin: 0;
  }

  .hud > div {
    padding: 3px 1px;
  }

  .hud b {
    font-size: 14px;
  }

  .game-stage {
    height: auto;
    min-height: 0;
    border-width: 3px;
    border-radius: 14px;
    box-shadow: 4px 5px 0 #07132320;
    aspect-ratio: 100 / 126;
  }

  .feedback {
    min-height: 38px;
    padding: 6px 7px 6px 32px;
    font-size: 9px;
  }

  .feedback::before {
    left: 9px;
  }

  .tap-strip {
    margin: 0;
    min-height: 38px;
    padding: 6px 7px 6px 32px;
    font-size: 9px;
  }

  .tap-hint {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
