:root {
  --page-bg: #f7fbfa;
  --ink: #243230;
  --muted: #63726f;
  --accent: #2d8c70;
  --accent-deep: #216f59;
  --line: #d7e3df;
  --game-bg: #10191b;
  --game-panel: #152124;
  --game-line: #263d42;
  --game-text: #e7f3f1;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  line-height: 1.75;
}

a {
  color: var(--accent-deep);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.site-header,
.page-shell,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  max-width: 1120px;
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 53px;
  padding: max(18px, env(safe-area-inset-top)) 0 10px;
  font-size: 0.84rem;
}

.site-brand {
  font-weight: 900;
  letter-spacing: 0.02em;
}

.site-header nav {
  display: flex;
  gap: 24px;
}

.site-header nav a {
  color: var(--muted);
}

.game-hero {
  padding: 28px 0 20px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent-deep);
  font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

.game-hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 1.2;
}

.game-hero h1 span {
  display: block;
}

.lede {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.game-shell {
  padding: 12px;
  background: var(--game-bg);
  border: 1px solid var(--game-line);
  border-radius: 8px;
  color: var(--game-text);
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: #63d7d8;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

#unity-fullscreen-button {
  padding: 8px 16px;
  border: 1px solid rgba(120, 207, 176, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-deep);
  cursor: pointer;
  font: inherit;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
}

#unity-fullscreen-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

#unity-fullscreen-button:focus-visible {
  outline: 3px solid #f3d35a;
  outline-offset: 2px;
}

.play-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 207, 176, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #47625d;
  font-size: 0.92rem;
  font-weight: 700;
}

.canvas-frame {
  position: relative;
  width: min(960px, 100%);
  margin-inline: auto;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--game-panel);
  border: 1px solid var(--game-line);
  border-radius: 6px;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--page-bg);
  outline: 0;
}

#unity-loading-bar {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--game-bg);
  text-align: center;
}

#unity-loading-bar[hidden] {
  display: none;
}

.loading-label {
  color: #63d7d8;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

#unity-progress-bar-empty {
  width: min(320px, 70vw);
  height: 10px;
  overflow: hidden;
  border: 1px solid #35545a;
  border-radius: 999px;
  background: #0b1315;
}

#unity-progress-bar-full {
  width: 0;
  height: 100%;
  background: #2e8f98;
  transition: width 120ms linear;
}

#loading-text {
  margin: 0;
  color: var(--game-text);
  font-size: 0.88rem;
}

#unity-warning {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 2;
}

.banner-warning,
.banner-error {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #10191b;
  font-weight: 700;
}

.banner-warning {
  background: #f3d35a;
}

.banner-error {
  background: #ff8f87;
}

.info-section {
  padding: 50px 0 30px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
  margin-top: 12px;
}

.info-grid article {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.info-grid h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.4;
}

.info-grid p {
  margin: 0;
  color: var(--muted);
}

.description-slot {
  min-height: 150px;
}

.site-footer {
  display: flex;
  gap: 20px;
  padding: 30px 0 max(40px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.site-footer a {
  color: inherit;
}

.game-shell:fullscreen,
.game-shell:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-right: max(10px, env(safe-area-inset-right));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  padding-left: max(10px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
}

.game-shell:fullscreen .canvas-frame,
.game-shell:-webkit-full-screen .canvas-frame {
  width: min(100%, calc((100vh - 112px) * 1.6));
  height: calc(100vh - 112px);
  aspect-ratio: auto;
}

@media (max-width: 700px) {
  .site-header,
  .page-shell,
  .site-footer {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    display: block;
  }

  .site-header nav {
    margin-top: 4px;
  }

  .game-hero {
    padding-top: 22px;
  }

  .game-hero h1 {
    font-size: 1.75rem;
  }

  .game-shell {
    padding: 8px;
  }

  .game-toolbar {
    align-items: flex-start;
  }

  .game-toolbar > span {
    max-width: 52%;
  }

  .play-note {
    font-size: 0.84rem;
    line-height: 1.65;
  }

  .canvas-frame {
    width: 100%;
    aspect-ratio: 9 / 16;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .info-section {
    padding-top: 38px;
  }

  .game-shell:fullscreen .game-toolbar,
  .game-shell:-webkit-full-screen .game-toolbar {
    margin-bottom: 6px;
  }

  .game-shell:fullscreen .play-note,
  .game-shell:-webkit-full-screen .play-note {
    display: none;
  }

  .game-shell:fullscreen .canvas-frame,
  .game-shell:-webkit-full-screen .canvas-frame {
    width: min(100%, calc((100vh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.5625));
    height: calc(100vh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  #unity-progress-bar-full {
    transition: none;
  }
}

/* Shared GAME LAB page conventions. */
.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

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

.site-nav a:hover,
.site-nav a:focus-visible,
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent-deep);
}

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

.game-note {
  max-width: 960px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.game-comment-section {
  padding: 44px 0 10px;
}

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

.comments-stub {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
}

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

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

@media (max-width: 700px) {
  .site-nav {
    gap: 14px;
    font-size: 0.78rem;
  }

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

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