:root {
  --navy: #101522;
  --navy-light: #1c2638;
  --orange: #ff8f2c;
  --orange-dark: #df6816;
  --cream: #fff6ea;
  --rose: #ffd9c6;
  --mint: #c0f2e9;
  --text-muted: #f2dcc8;
  --surface: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--cream);
  background:
    radial-gradient(circle at top, rgba(255, 210, 145, 0.48), transparent 24%),
    linear-gradient(180deg, #ffd08c 0%, #ff9a3a 22%, #e97b2e 48%, #f6b96d 74%, #ffe2b1 100%);
}

body[data-dir="rtl"] {
  direction: rtl;
}

body[data-dir="ltr"] {
  direction: ltr;
}

.shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 26px;
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 22px;
}

.info-card,
.game-card {
  background: linear-gradient(180deg, rgba(43, 18, 8, 0.78), rgba(87, 32, 10, 0.58));
  border: 1px solid var(--hairline);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.info-card {
  padding: 26px 22px 24px;
}

.eyebrow,
.overlay-kicker {
  margin: 0 0 10px;
  color: #ffb15f;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
}

.title,
.overlay-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.title {
  font-size: clamp(2.9rem, 7vw, 4.3rem);
  line-height: 0.92;
}

.subtitle,
.helper,
.download-note,
.overlay-text {
  color: var(--text-muted);
  line-height: 1.6;
}

.subtitle {
  margin: 14px 0 0;
  font-size: 1rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.hud-item {
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(255, 248, 240, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
}

.hud-item span {
  display: block;
  font-size: 0.74rem;
  color: #ffe4c6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

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

.primary-btn,
.secondary-btn,
.lang-btn,
.control-btn {
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.primary-btn {
  border: 0;
  color: var(--navy);
  background: linear-gradient(180deg, #ffc36f 0%, var(--orange) 100%);
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(243, 112, 33, 0.34);
}

.primary-btn:hover {
  background: linear-gradient(180deg, #ffad73 0%, var(--orange-dark) 100%);
}

.secondary-btn,
.lang-btn,
.control-btn {
  color: var(--cream);
  background: rgba(255, 250, 246, 0.08);
  border: 1px solid var(--hairline);
}

.secondary-btn:hover,
.lang-btn:hover,
.control-btn:hover {
  border-color: rgba(243, 112, 33, 0.6);
  background: rgba(255, 255, 255, 0.09);
}

.lang-switch {
  display: inline-flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.lang-btn.active {
  color: var(--navy);
  background: #ffb15f;
  border-color: transparent;
}

.helper {
  margin: 18px 0 0;
  font-size: 0.96rem;
}

.download-note {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.game-card {
  padding: 18px;
}

.stage-shell {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

#game-canvas {
  width: 100%;
  aspect-ratio: 21 / 34;
  display: block;
  border-radius: 22px;
  border: 1px solid rgba(255, 248, 231, 0.24);
  background:
    radial-gradient(circle at top, rgba(255, 244, 219, 0.16), transparent 28%),
    linear-gradient(180deg, #ffd18a 0%, #f28e36 30%, #e07a2d 56%, #f9c07e 80%, #fff0cf 100%);
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 26px 22px;
  border-radius: 20px;
  background: rgba(34, 12, 4, 0.84);
  border: 1px solid rgba(255, 238, 215, 0.18);
}

.overlay.hidden {
  display: none;
}

.overlay-title {
  font-size: clamp(2.3rem, 8vw, 3.4rem);
}

.touch-controls {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 18px;
}

.control-btn[hidden] {
  display: none !important;
}

#debug-actions {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.control-btn {
  width: 88px;
  font-size: 1.35rem;
  font-weight: 700;
}

.control-btn-shoot.active {
  color: var(--navy);
  background: linear-gradient(180deg, #ffe386 0%, #ffc23f 100%);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(255, 194, 63, 0.28);
}

button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

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

  .game-card {
    order: 1;
  }

  .info-card {
    order: 2;
  }
}

@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }

  .shell {
    width: min(100%, calc(100% - 8px));
    padding-top: 6px;
    gap: 8px;
  }

  .info-card,
  .game-card {
    border-radius: 18px;
  }

  .info-card {
    padding: 14px 12px 16px;
  }

  .game-card {
    padding: 8px 8px 10px;
  }

  .stage-shell {
    max-width: min(100vw - 18px, 390px);
  }

  #game-canvas {
    max-height: calc(100svh - 88px);
    aspect-ratio: auto;
    height: calc(100svh - 88px);
  }

  .title {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }

  .subtitle,
  .helper,
  .download-note {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .hud {
    gap: 8px;
    margin-top: 14px;
  }

  .hud-item {
    padding: 9px 8px;
  }

  .actions {
    margin-top: 14px;
    gap: 8px;
  }

  .actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .control-btn {
    flex: 1;
    max-width: 124px;
    min-height: 42px;
  }
}
