/* Target Puzzle — Game Anything
 * Shell: /play/shared/ga-casual-shell.css · Accent: --tp-accent + --ga-accent-game */
:root {
  --tp-bg0: #070b14;
  --tp-bg1: #111b2d;
  --tp-panel: rgba(15, 23, 42, 0.78);
  --tp-panel-border: rgba(56, 189, 248, 0.22);
  --tp-text: #f1f5f9;
  --tp-muted: #94a3b8;
  --tp-accent: #fb923c;
  --tp-accent2: #38bdf8;
  --tp-success: #4ade80;
  --tp-shadow: 0 24px 56px rgba(2, 6, 23, 0.55);
  --tp-radius: 20px;
  --tp-font: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.ga-casual-scope.tp-app {
  --tp-bg0: var(--ga-bg-abyss);
  --tp-bg1: var(--ga-bg-mid);
  --tp-panel: var(--ga-surface);
  --tp-panel-border: var(--ga-border);
  --tp-text: var(--ga-text);
  --tp-muted: var(--ga-muted);
  --tp-accent2: var(--ga-sky);
  --ga-accent-game: var(--tp-accent);
}

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

html,
body {
  height: 100%;
  margin: 0;
  background: #000000;
  color: var(--tp-text);
  font-family: var(--tp-font);
  -webkit-tap-highlight-color: transparent;
}

.tp-app {
  /* min-height: 100dvh; */
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 5vw, 32px) max(28px, env(safe-area-inset-bottom));
}

.tp-screen {
  width: min(1040px, 100%);
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
}

#tp-screen-menu.tp-screen {
  width: min(var(--ga-puzzle-menu-max), 100%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#tp-screen-menu .tp-panel {
  width: min(var(--ga-puzzle-menu-max), 100%);
}

.tp-screen.tp-screen-active {
  display: flex;
}

.tp-screen.tp-screen-active .tp-panel {
  animation: tp-panel-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tp-screen-play.tp-screen-active .tp-panel {
  animation: none;
}

.tp-screen-play {
  align-items: stretch;
}

@keyframes tp-panel-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tp-screen.tp-screen-active .tp-panel {
    animation: none;
  }
}

.tp-panel {
  width: min(520px, 100%);
  padding: clamp(24px, 5vw, 36px) clamp(22px, 4.5vw, 34px);
  border-radius: var(--tp-radius);
  background: var(--tp-panel);
  border: 1px solid var(--tp-panel-border);
  box-shadow: var(--tp-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  transition:
    border-color 0.3s ease,
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tp-panel-wide {
  width: min(920px, 100%);
}

.tp-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-accent2);
}

.tp-lead {
  margin: 0 0 22px;
  color: var(--tp-muted);
  line-height: 1.55;
  font-size: 1rem;
}

.tp-menu-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px;
  margin-bottom: 12px;
}

.tp-btn {
  appearance: none;
  border: 1px solid var(--tp-panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--tp-text);
  font: inherit;
  font-weight: 600;
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.18, 0.64, 1),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

.tp-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.3);
}

.tp-btn:active {
  transform: scale(0.98);
}

.tp-btn-primary {
  border-color: rgba(234, 88, 12, 0.55);
  background: linear-gradient(135deg, #ea580c, var(--tp-accent) 45%, var(--tp-accent2));
  color: #fff;
  box-shadow: 0 10px 32px rgba(234, 88, 12, 0.35);
}

.tp-btn-primary:hover {
  box-shadow: 0 14px 38px rgba(234, 88, 12, 0.45);
}

.tp-btn-ghost {
  background: transparent;
}

.tp-btn-small {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.tp-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.tp-cta {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px dashed rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.06);
  margin-bottom: 12px;
}

.tp-cta-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--tp-text);
}

.tp-cta-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--tp-muted);
  line-height: 1.5;
}

.tp-list {
  margin: 0 0 18px;
  padding-left: 1.1rem;
  color: var(--tp-muted);
  line-height: 1.55;
}

.tp-list li {
  margin-bottom: 8px;
}

.tp-muted {
  color: var(--tp-muted);
}

.tp-small {
  font-size: 0.85rem;
}

.tp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.tp-levels-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tp-levels-head h2 {
  margin: 0;
}

.tp-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.tp-level-card {
  border-radius: 14px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tp-level-card:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 146, 60, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.tp-level-card-locked {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.tp-level-card-index {
  font-size: 1.35rem;
  font-weight: 700;
}

.tp-level-card-meta {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--tp-muted);
}

.tp-play-shell {
  width: 100%;
  max-width: 1040px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.tp-phaser-host {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 10;
  max-height: min(72vh, 620px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(251, 146, 60, 0.06) inset;
  background: #101624;
  touch-action: none;
}

.tp-phaser-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Embed mode: keep everything within a fixed-height parent (e.g. h-[600px]). */
.tp-embed .tp-app {
  height: 100%;
  min-height: 0;
  padding: 12px;
}

.tp-embed .tp-screen {
  min-height: 0;
}

.tp-embed .tp-screen-play {
  align-items: stretch;
}

.tp-embed .tp-play-shell {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  gap: 10px;
}

.tp-embed .tp-phaser-host {
  max-height: none;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
}

/* Top HUD — puzzle-maze .pm-hud pattern: stats left, actions right, one glass row */
.tp-hud {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tp-hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tp-hud-pill {
  font-size: 12px;
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(125, 211, 252, 0.28);
}

.tp-hud-accent {
  border-color: rgba(251, 146, 60, 0.45);
  color: #fed7aa;
}

.tp-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tp-btn-hud {
  min-height: 0;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
}

.tp-hud-icon {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 0.95rem;
  border-radius: 10px;
}

.tp-overlay {
  position: fixed;
  inset: 0;
  padding: 20px;
  z-index: 50;
  animation: tp-fade-in 0.25s ease;
}

.tp-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-overlay[hidden] {
  display: none !important;
}

.tp-win-stars {
  font-size: 2rem;
  letter-spacing: 0.2em;
  margin: 8px 0 4px;
  color: #fde68a;
  text-shadow: 0 0 20px rgba(253, 230, 138, 0.35);
}

@media (max-width: 600px) {
  .tp-hud-actions {
    justify-content: flex-end;
    width: 100%;
  }
}

/*
 * Game Worlds: stretch app in flex shell (same height rule as block-puzzle shell).
 * .tp-embed play layout rules above apply to .game-worlds-play-shell.tp-embed.
 */
.game-worlds-body .game-worlds-play-shell.tp-embed #tp-app.tp-app {
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  align-items: stretch;
}

.game-worlds-body .game-worlds-play-shell.tp-embed .tp-screen.tp-screen-active {
  min-height: 0;
}

.game-worlds-body .game-worlds-play-shell.tp-embed .tp-screen-play.tp-screen-active {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
