:root {
  --ink: #22160f;
  --paper: #f6efe4;
  --wood: #3b1d14;
  --btn: #7a2e1e;
  --btn2: #2e4a3a;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Hiragino Sans", "Yu Gothic", sans-serif; }
img { max-width: 100%; height: auto; object-fit: contain; }

.gda-hero { padding: 24px 16px 8px; text-align: center; }
.gda-kicker { margin: 0; letter-spacing: .12em; font-size: 12px; color: #6d4c41; }
.gda-hero h1 { margin: 6px 0 4px; font-size: 28px; }
.gda-hero p { margin: 0; }

.gda-app {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 12px auto;
  width: min(100%, 1100px);
  min-height: 560px;
  background: #2a1a14 url("img/bg-shrine.jpg") center / cover no-repeat;
  color: #fff8e1;
  border-radius: 12px;
  overflow: hidden;
}
.gda-boot { padding: 24px; text-align: center; }

.gda-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 16px;
  background: rgba(24, 12, 8, .88);
  overflow: auto;
}
.gda-overlay-select {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background: #2a1a14 url("img/bg-shrine.jpg") center / cover no-repeat;
}
.gda-overlay-select::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12, 6, 4, .42) 0%, rgba(12, 6, 4, .08) 38%, rgba(12, 6, 4, .4) 100%);
}
.gda-overlay-select > * {
  position: relative;
  z-index: 1;
}
.gda-ov-head {
  flex: 0 0 auto;
  padding: 4px 8px 10px;
  text-align: center;
}
.gda-ov-kicker {
  margin: 0;
  letter-spacing: .16em;
  font-size: 14px;
  color: #ffcc80;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .85);
}
.gda-ov-game {
  margin: 4px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 204, 128, .45);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .85);
}
.gda-ov-lead {
  margin: 0 0 10px;
  color: #fff8e1;
  font-size: 18px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .85);
}
.gda-ov-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #ffe0b2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .85);
}
.gda-overlay-select .gda-ov-actions {
  justify-content: center;
  flex: 0 0 auto;
}
.gda-overlay-select .gda-how { flex: 0 0 auto; }
.gda-ov-sub { margin: 0 0 12px; color: #ffe0b2; }
.gda-chars {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.gda-char {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px 8px;
  border: 2px solid rgba(255, 204, 128, .28);
  background: linear-gradient(180deg, rgba(62, 39, 35, .28) 0%, rgba(32, 18, 14, .82) 100%);
  color: #fff8e1;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  min-height: 44px;
}
.gda-char.is-on { border-color: #ffcc80; background: linear-gradient(180deg, rgba(93, 64, 55, .55) 0%, rgba(62, 39, 35, .9) 100%); }
.gda-char-art {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 160px;
  margin-top: auto;
  overflow: hidden;
}
.gda-char-art img {
  height: 160px !important;
  width: auto !important;
  max-width: none !important;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
}
.gda-char strong { font-size: 17px; line-height: 1.3; }
.gda-char-skill { color: #ffcc80; font-size: 15px; line-height: 1.35; }
.gda-char small { color: #d7ccc8; font-size: 14px; line-height: 1.4; display: none; }
.gda-char.is-on small { display: block; }
.gda-ov-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gda-btn {
  min-height: 48px;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: #5d4037;
  color: #fff8e1;
  font-size: 18px;
}
.gda-btn:disabled { opacity: .45; pointer-events: none; }
.gda-btn-main { background: var(--btn); }
.gda-how { margin-top: 12px; background: #4e342e; padding: 10px 12px; border-radius: 8px; }
.gda-how p { margin: 0 0 6px; }

.gda-how kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  border-radius: 4px;
  background: #3e2723;
  color: #ffe0b2;
  font-family: inherit;
  font-weight: 700;
}

.gda-play {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.gda-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  background: #4e342e;
  font-size: 14px;
}
.gda-hud-lives {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.gda-hud-lives-label { color: #ffe0b2; }
.gda-lives { display: inline-flex; gap: 5px; }
.gda-life {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a80, #c62828 55%, #7f1515);
  box-shadow: 0 0 0 1px #4a1010;
}
.gda-life.is-off {
  background: #3e2723;
  box-shadow: inset 0 0 0 2px #6d4c41;
}
.gda-hud-skill small { color: #ffe0b2; margin-left: 4px; }
.gda-hud-gap { flex: 1; min-width: 8px; }
.gda-hud-btn {
  min-height: 36px;
  min-width: 44px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: #5d4037;
  color: #fff8e1;
  font-size: 14px;
  cursor: pointer;
}
.gda-stage-line {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 12px 8px;
  font-size: 13px;
  color: #ffe0b2;
}
.gda-stage-box {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: calc(100dvh - 200px);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #1a120e;
}
html.is-embed .gda-stage-box {
  max-width: none;
  max-height: none;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  aspect-ratio: unset;
}
#stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.gda-pad {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: #3e2723;
}
.gda-pad-btn {
  min-width: 56px;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: #6d4c41;
  color: #fff8e1;
  font-size: 18px;
  touch-action: none;
  user-select: none;
}
.gda-pad-jump { background: var(--btn); min-width: 88px; }
.gda-pad-skill { background: var(--btn2); min-width: 72px; }
.gda-pad-gap { flex: 1; }

.gda-seo { max-width: 720px; margin: 16px auto 40px; padding: 0 16px; color: #4e342e; }
.gda-seo p { line-height: 1.7; }

.is-embed .gda-hero,
.is-embed .gda-seo { display: none; }
html.is-embed,
html.is-embed body {
  height: 100%;
  min-height: 100%;
  background: #2a1a14;
}
html.is-embed body { position: relative; }
html.is-embed .gda-app {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  border-radius: 0;
}
html.is-embed .gda-play {
  flex: 1;
  min-height: 0;
}
html.is-embed .gda-overlay {
  display: flex;
  flex-direction: column;
}
.gda-overlay[hidden],
.gda-play[hidden],
.gda-how[hidden] {
  display: none !important;
}
.gda-overlay-select .gda-chars {
  flex: 0 1 auto;
  min-height: 0;
  align-items: end;
}
.gda-overlay-select .gda-char {
  min-height: 0;
}
html.is-embed .gda-char-art {
  height: clamp(220px, 38vh, 340px);
}
html.is-embed .gda-char-art img {
  height: clamp(220px, 38vh, 340px) !important;
}

.is-fullscreen,
.is-fullscreen body {
  height: 100%;
  background: #2a1a14;
}
.is-fullscreen .gda-hero { display: none; }
.is-fullscreen .gda-app,
.gda-app:fullscreen,
.gda-app:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
}
.is-fullscreen .gda-play,
.gda-app:fullscreen .gda-play,
.gda-app:-webkit-full-screen .gda-play {
  min-height: 0;
  flex: 1;
  height: 100%;
}
.is-fullscreen .gda-hud,
.gda-app:fullscreen .gda-hud,
.gda-app:-webkit-full-screen .gda-hud,
.is-fullscreen .gda-stage-line,
.gda-app:fullscreen .gda-stage-line,
.gda-app:-webkit-full-screen .gda-stage-line,
.is-fullscreen .gda-pad,
.gda-app:fullscreen .gda-pad,
.gda-app:-webkit-full-screen .gda-pad {
  flex: 0 0 auto;
}
.is-fullscreen .gda-stage-box,
.gda-app:fullscreen .gda-stage-box,
.gda-app:-webkit-full-screen .gda-stage-box,
html.is-embed.is-fullscreen .gda-stage-box {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  max-height: none;
  min-height: 0;
  margin: 0;
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a1a14;
}
.is-fullscreen #stage,
.gda-app:fullscreen #stage,
.gda-app:-webkit-full-screen #stage {
  position: relative;
  inset: auto;
  width: min(100vw, calc((100dvh - 160px) * 16 / 9));
  height: min(calc(100dvh - 160px), calc(100vw * 9 / 16));
}

@media (max-width: 720px) {
  .is-fullscreen #stage,
  .gda-app:fullscreen #stage,
  .gda-app:-webkit-full-screen #stage {
    width: min(100vw, calc((100dvh - 200px) * 16 / 9));
    height: min(calc(100dvh - 200px), calc(100vw * 9 / 16));
  }
}

@media (max-width: 720px) {
  .gda-chars { grid-template-columns: 1fr 1fr; }
  .gda-char-art,
  .gda-char-art img { height: 120px !important; }
  .gda-hero h1 { font-size: 22px; }
}

@media (max-height: 700px) {
  html:not(.is-embed) .gda-char-art,
  html:not(.is-embed) .gda-char-art img { height: 96px !important; }
  html:not(.is-embed) .gda-overlay { padding: 8px; }
  html:not(.is-embed) .gda-hero { padding: 8px 12px 4px; }
}

@media (min-aspect-ratio: 1.3 / 1) {
  .gda-app { min-height: 0; }
  html:not(.is-embed) .gda-stage-box { max-height: calc(100dvh - 160px); }
  .gda-pad { padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); }
}
