:root {
  color-scheme: light;
  --ink: #2e3131;
  --muted: #6e7473;
  --mint: #62ad98;
  --mint-dark: #347a68;
  --mint-soft: #e9f6f1;
  --coral: #e68b78;
  --coral-soft: #fff0eb;
  --amber: #e8b94f;
  --amber-soft: #fff8e7;
  --line: #e4e9df;
  --surface: #ffffff;
  --page: #fffefd;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header,
.site-footer,
.game-page {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  letter-spacing: 0;
}

.site-brand {
  color: var(--mint-dark);
  font-size: 13px;
  font-weight: 800;
}

.site-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a,
.site-footer a {
  transition: color 160ms ease;
}

.site-nav a:hover,
.site-footer a:hover {
  color: var(--mint-dark);
}

.game-page {
  margin-bottom: 64px;
}

.game-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  min-height: 340px;
  padding: 42px 0 38px;
}

.game-intro-copy {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--mint-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

.lead {
  max-width: 610px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.rhythm-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
}

.rhythm-line {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 50%;
  height: 5px;
  background: var(--mint-soft);
}

.rhythm-grid {
  --dodge-distance: 53px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(3, 46px);
  gap: 7px;
  padding: 14px;
  border: 3px solid var(--mint);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(57, 106, 91, 0.14);
}

.rhythm-grid span {
  display: block;
  width: 46px;
  height: 46px;
  background: #ffffff;
  border: 1px solid #dce4df;
}

.rhythm-grid .rhythm-danger-soft {
  background: #ffd8d0;
  border-color: #efa99b;
}

.rhythm-grid .rhythm-danger {
  background: var(--coral);
  border-color: #c96d5a;
}

.rhythm-grid .rhythm-danger-strong {
  background: #d84e45;
  border-color: #a82e29;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.rhythm-grid .rhythm-safe-target {
  background: var(--mint-soft);
  border-color: #8fc8b7;
  box-shadow: inset 0 0 0 3px rgba(98, 173, 152, 0.16);
}

.rhythm-player {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 27px;
  height: 27px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #10aee8;
  box-shadow: 0 4px 10px rgba(0, 85, 120, 0.3);
  animation: player-dodge 1.8s ease-in-out infinite;
}

.dodge-arrow {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 102px;
  color: var(--mint-dark);
  font-size: 25px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
  animation: dodge-arrow 1.8s ease-in-out infinite;
}

.rhythm-pulse {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 9%;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  color: #ffffff;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 14px 30px rgba(180, 89, 69, 0.2);
  font-size: 28px;
  font-weight: 800;
  animation: rhythm-beat 1.2s ease-in-out infinite;
}

@keyframes rhythm-beat {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.08); }
}

@keyframes player-dodge {
  0%, 30%, 100% { transform: translate(-50%, -50%) translateY(0); }
  55%, 85% { transform: translate(-50%, -50%) translateY(var(--dodge-distance)); }
}

@keyframes dodge-arrow {
  0%, 28%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(-3px); }
  48%, 82% { opacity: 1; transform: translateX(-50%) translateY(3px); }
}

.game-shell {
  padding: 24px 32px 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(83, 75, 34, 0.12);
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 960px;
  margin: 0 auto 14px;
}

.game-toolbar p,
.game-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.device-label {
  margin-right: 0.7em;
  color: #b84f42;
  font-weight: 800;
}

.fullscreen-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 17px;
  border: 1px solid #b8ddd2;
  border-radius: 8px;
  color: var(--mint-dark);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.fullscreen-button:hover:not(:disabled) {
  border-color: var(--mint);
  background: var(--mint-soft);
}

.fullscreen-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.fullscreen-icon {
  font-size: 18px;
  line-height: 1;
}

.unity-container {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 8 / 5;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid #1e2222;
  border-radius: 4px;
  background: #000000;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
  outline: none;
}

#unity-canvas:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: -3px;
}

.unity-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  color: #ffffff;
  background: #111515;
}

.unity-loading[hidden] {
  display: none;
}

.loading-title {
  margin: 0 0 18px;
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
}

.loading-track {
  width: min(340px, 72%);
  height: 8px;
  overflow: hidden;
  border: 1px solid #5f6b68;
  border-radius: 4px;
  background: #28302e;
}

.loading-progress {
  width: 0;
  height: 100%;
  background: var(--mint);
  transition: width 120ms linear;
}

.loading-text {
  margin: 12px 0 0;
  color: #d9e3df;
  font-size: 13px;
}

.unity-warning {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 5;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.unity-warning p {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #dfbb5a;
  border-radius: 4px;
  color: #493a16;
  background: #fff5cf;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

.unity-warning p.error {
  border-color: #c55b50;
  color: #5d1914;
  background: #ffe2dd;
}

.game-note {
  max-width: 960px;
  margin: 14px auto 0;
}

.description-section {
  padding: 64px 0 12px;
}

.description-section h2 {
  margin: 0 0 22px;
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: 0;
}

.description-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  min-height: 170px;
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--mint);
  border-radius: 8px;
  background: var(--surface);
}

.description-panel p {
  margin: 0;
  color: #545d5b;
}

.description-panel p + p {
  margin-top: 16px;
}

.description-block + .description-block {
  margin-top: 0;
  padding-top: 0;
  padding-left: 30px;
  border-top: 0;
  border-left: 1px solid var(--line);
}

.description-block h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: 0;
}

.description-block ol,
.description-block ul {
  margin: 0;
  padding-left: 1.5em;
  color: #545d5b;
}

.description-block li + li {
  margin-top: 8px;
}

.description-block strong {
  color: var(--ink);
}

.guide-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.guide-list > div {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0eb;
}

.guide-list > div:last-child {
  border-bottom: 0;
}

.guide-list dt {
  color: var(--mint-dark);
  font-weight: 800;
}

.guide-list dd {
  margin: 0;
  color: #545d5b;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 0 38px;
  border-top: 1px solid #eef0ec;
  color: var(--muted);
  font-size: 14px;
}

.footer-brand {
  color: var(--ink);
  font-weight: 700;
}

.game-comment-section {
  padding: 64px 0 12px;
}

.game-comment-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.comments-stub {
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--mint);
  border-radius: 8px;
  background: var(--surface);
}

.comments-stub h2,
.comments-stub p {
  margin: 0;
}

.comments-stub h2 {
  font-size: 26px;
  line-height: 1.35;
}

.comments-stub p {
  margin-top: 8px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .site-header,
  .site-footer,
  .game-page {
    width: min(100% - 32px, 1120px);
  }

  .game-intro {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 40px 0 34px;
  }

  .game-intro-copy {
    max-width: 680px;
  }

  h1 {
    font-size: 34px;
  }

  .rhythm-visual {
    min-height: 220px;
  }

  .game-shell {
    padding: 18px;
  }

  .description-panel {
    grid-template-columns: 1fr;
  }

  .description-block + .description-block {
    margin-top: 24px;
    padding-top: 24px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .site-footer {
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .site-header {
    align-items: flex-start;
    padding: 17px 0;
  }

  .site-nav {
    gap: 14px;
    font-size: 12px;
  }

  .game-intro {
    padding-top: 30px;
  }

  h1 {
    font-size: 28px;
  }

  .lead {
    font-size: 15px;
  }

  .rhythm-visual {
    min-height: 200px;
  }

  .rhythm-grid {
    --dodge-distance: 45px;
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
  }

  .rhythm-grid span {
    width: 38px;
    height: 38px;
  }

  .rhythm-player {
    width: 23px;
    height: 23px;
  }

  .dodge-arrow {
    top: 91px;
    font-size: 22px;
  }

  .game-toolbar {
    align-items: flex-start;
  }

  .game-toolbar p {
    max-width: 220px;
  }

  .fullscreen-button {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
  }

  .fullscreen-button span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .game-shell {
    width: calc(100% + 32px);
    margin-left: -16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .description-section {
    padding-top: 54px;
  }

  .description-section h2 {
    font-size: 27px;
  }

  .description-panel {
    padding: 22px 20px;
  }

  .game-comment-section {
    padding-top: 54px;
  }

  .comments-stub {
    padding: 22px 20px;
  }

  .guide-list > div {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 0;
  }

  .site-footer,
  .site-footer nav {
    flex-direction: column;
    gap: 10px;
  }

  .site-footer nav {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
