/* TIMEEXIST games — 3D contemplative play */

.page-games .games-hero {
  padding-top: calc(var(--header-h) + 3rem);
  padding-bottom: 2.5rem;
}

.nav a.is-current {
  color: var(--text);
}

.nav a.is-current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: var(--accent);
  opacity: 0.8;
}

.games-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: -1.5rem auto 2.25rem;
}

.games-group {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.48rem 1.05rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.games-group:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.games-group.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(107, 140, 255, 0.2);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  text-align: left;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  transition: transform 0.3s var(--ease), border-color 0.25s, box-shadow 0.3s;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38), 0 0 28px rgba(100, 140, 255, 0.12);
  outline: none;
}

.game-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-elevated);
}

.game-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.game-card:hover .game-card-media img {
  transform: scale(1.05);
}

.game-card-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(5, 8, 22, 0.62);
  border: 1px solid rgba(160, 190, 255, 0.28);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}

.game-card-done {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(103, 232, 249, 0.2);
  border: 1px solid rgba(103, 232, 249, 0.55);
  color: var(--cyan);
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}

.game-card-body {
  padding: 1.15rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.game-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1.25;
}

.game-card-body p {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}

.game-card-cta {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ---------- Play chrome ---------- */

body.playing {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
  height: 100dvh;
}

body.playing .site-footer {
  display: none;
}

body.playing .nebula {
  opacity: 0.45;
}

.game-play-section {
  padding-top: calc(var(--header-h) + 1.25rem);
  min-height: 100vh;
  min-height: 100dvh;
}

body.playing .game-play-section {
  padding: 0;
  min-height: 100dvh;
}

.game-play-wrap {
  max-width: 1080px;
}

body.playing .game-play-wrap {
  max-width: none;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(var(--header-h) + 0.4rem)
    max(0.65rem, env(safe-area-inset-right))
    max(0.45rem, env(safe-area-inset-bottom))
    max(0.65rem, env(safe-area-inset-left));
}

.game-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 0.65rem;
  flex: 0 0 auto;
}

.game-topbar-copy {
  text-align: center;
  min-width: 0;
}

.game-topbar-copy .eyebrow {
  margin-bottom: 0.15rem;
}

.game-topbar-copy h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-topbar-end {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
}

.mute-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 16, 36, 0.55);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}

.mute-btn:hover,
.mute-btn:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.mute-btn .icon-muted { display: none; }
.mute-btn.is-muted .icon-sound { display: none; }
.mute-btn.is-muted .icon-muted { display: block; }

.game-progress {
  font-size: 0.78rem;
  color: var(--text-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 4.2rem;
  text-align: right;
}

.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: min(72vh, 760px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(80, 70, 180, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(10, 16, 36, 0.55), rgba(6, 8, 22, 0.82));
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  perspective: 1400px;
  touch-action: none;
}

body.playing .game-stage {
  min-height: 0;
}

.game-world {
  position: absolute;
  inset: 0;
  min-height: 0;
  transform-style: preserve-3d;
}

.fx-depth {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 28%;
  bottom: -25%;
  pointer-events: none;
  z-index: 1;
  transform: perspective(700px) rotateX(64deg);
  transform-origin: 50% 0%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 46px,
      rgba(142, 180, 255, 0.13) 46px 47px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 46px,
      rgba(103, 232, 249, 0.1) 46px 47px
    );
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 78%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 78%);
  animation: grid-drift 22s linear infinite;
  opacity: 0.7;
}

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 92px, 92px 0; }
}

.fx-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.fx-orb {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  border-radius: 50%;
  filter: blur(2px);
  animation: orb-float 9s ease-in-out infinite;
}

.fx-orb.a {
  width: 160px;
  height: 160px;
  left: 8%;
  top: 18%;
  background: radial-gradient(circle at 40% 40%, rgba(103, 232, 249, 0.28), transparent 68%);
}

.fx-orb.b {
  width: 200px;
  height: 200px;
  right: 6%;
  top: 8%;
  background: radial-gradient(circle at 40% 40%, rgba(167, 139, 250, 0.26), transparent 68%);
  animation-delay: -3s;
}

.fx-orb.c {
  width: 120px;
  height: 120px;
  left: 42%;
  bottom: 22%;
  background: radial-gradient(circle at 40% 40%, rgba(240, 215, 140, 0.2), transparent 68%);
  animation-delay: -6s;
}

@keyframes orb-float {
  0%, 100% { transform: translate3d(0, 0, 40px) scale(1); }
  50% { transform: translate3d(12px, -18px, 80px) scale(1.08); }
}

.game-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.game-canvas-wrap canvas,
.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-hud {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  top: 0.7rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 3;
}

.game-chip {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(5, 8, 22, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.game-caption {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  top: 2.7rem;
  z-index: 3;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(5, 8, 22, 0.9);
}

.game-caption .eyebrow {
  margin-bottom: 0.25rem;
}

.game-caption h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 3.4vw, 1.7rem);
  line-height: 1.3;
}

.game-caption p {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 34em;
  margin-left: auto;
  margin-right: auto;
}

.game-hotspots {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  min-width: 76px;
  min-height: 92px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.hotspot-core {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--accent) 45%, transparent 72%);
  box-shadow: 0 0 18px rgba(142, 180, 255, 0.7), 0 0 42px rgba(167, 139, 250, 0.4);
  animation: hotspot-pulse 2.4s ease-in-out infinite;
}

.hotspot.gold .hotspot-core {
  box-shadow: 0 0 18px rgba(240, 215, 140, 0.8), 0 0 42px rgba(240, 215, 140, 0.35);
  background: radial-gradient(circle at 35% 30%, #fff, #f0d78c 50%, transparent 72%);
}

.hotspot.cyan .hotspot-core {
  box-shadow: 0 0 18px rgba(103, 232, 249, 0.8), 0 0 42px rgba(103, 232, 249, 0.35);
  background: radial-gradient(circle at 35% 30%, #fff, #67e8f9 50%, transparent 72%);
}

.hotspot.violet .hotspot-core {
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.8), 0 0 42px rgba(167, 139, 250, 0.35);
  background: radial-gradient(circle at 35% 30%, #fff, #a78bfa 50%, transparent 72%);
}

.hotspot-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(5, 8, 22, 0.62);
  border: 1px solid rgba(160, 190, 255, 0.28);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  backdrop-filter: blur(8px);
  max-width: 10.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hotspot-sub {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--text);
  background: rgba(5, 8, 22, 0.55);
  border-radius: 10px;
  padding: 0.3rem 0.45rem;
  max-width: 10.5rem;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hotspot.door {
  min-width: 88px;
  min-height: 110px;
}

.hotspot.door .hotspot-arch {
  width: 54px;
  height: 86px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom: 0;
  border-radius: 54px 54px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 70%);
  box-shadow: 0 0 24px rgba(103, 232, 249, 0.25);
}

.hotspot.door.notmine .hotspot-arch {
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.3);
}

@keyframes hotspot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.18); opacity: 1; }
}

.game-sheet {
  display: none !important;
}

.game-sheet > * {
  pointer-events: auto;
}

.game-float {
  display: none !important;
}

.game-float > * {
  pointer-events: auto;
}

.game-float .game-choice,
.game-float .btn {
  flex: 1;
  min-height: 48px;
  max-width: 14rem;
  background: rgba(8, 12, 28, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.game-ending-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.game-ending {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(92%, 440px);
  max-height: 72%;
  overflow-y: auto;
  pointer-events: auto;
  background: rgba(8, 12, 28, 0.78);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.2rem 1.15rem 1.1rem;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.game-ending h3 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.game-ending p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.game-sheet[hidden] {
  display: none !important;
}

.game-sheet .game-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0.15rem 0 0;
  text-align: center;
}

.game-sheet .game-panel h3 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 500;
  margin-bottom: 0.45rem;
}

.game-sheet .game-panel p {
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.choice-row .game-choice {
  text-align: center;
  padding: 0.7rem 0.4rem;
  min-height: 52px;
}

.choice-row .game-choice .choice-kicker {
  margin-bottom: 0.3rem;
}

.choice-row .choice-text {
  display: block;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text-muted);
}

.game-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-choice {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  background: rgba(14, 22, 48, 0.65);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 48px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.game-choice:hover,
.game-choice:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  outline: none;
}

.game-choice .choice-kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.18rem;
}

.game-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.game-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.game-zone {
  font-family: inherit;
  color: var(--text);
  background: rgba(14, 22, 48, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 0.85rem 0.7rem;
  cursor: pointer;
  min-height: 4.4rem;
  touch-action: manipulation;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.game-zone:hover,
.game-zone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.game-zone h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.game-zone p {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin: 0;
}

.game-zone.mine { border-color: rgba(103, 232, 249, 0.4); }
.game-zone.notmine { border-color: rgba(167, 139, 250, 0.45); }

.game-feedback {
  min-height: 1.3em;
  font-size: 0.9rem;
  color: var(--cyan);
  margin: 0.35rem 0 0.55rem;
}

.game-feedback.is-miss {
  color: var(--gold);
}

.meters {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.meter {
  display: grid;
  grid-template-columns: 5.2rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meter-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 40%;
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}

.meter-fill.presence { background: linear-gradient(90deg, #67e8f9, #8eb4ff); }
.meter-fill.power { background: linear-gradient(90deg, #f0d78c, #e8b86d); }
.meter-fill.warmth { background: linear-gradient(90deg, #c4b5fd, #a78bfa); }

.meter-val { min-width: 2.2rem; text-align: right; color: var(--text-soft); }

.game-ending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin-top: 0.25rem;
}

.toast-insight {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%) translateY(8px);
  width: min(92%, 440px);
  text-align: center;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(5, 8, 22, 0.78);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}

.toast-insight.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Home teaser */
.play-teaser {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.75rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.play-teaser h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.play-teaser p {
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.play-teaser-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.play-teaser-mosaic a {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

.play-teaser-mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-teaser-mosaic span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.55rem 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(to top, rgba(5, 8, 22, 0.9), transparent);
  text-align: center;
}

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

  .play-teaser {
    grid-template-columns: 1fr;
  }
}

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

  .game-topbar {
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
  }

  .mute-btn {
    width: 36px;
    height: 36px;
  }

  .game-topbar-copy .eyebrow {
    display: none;
  }

  .game-topbar-copy h2 {
    font-size: 1.05rem;
  }

  .game-progress {
    min-width: 0;
    font-size: 0.7rem;
  }

  .nav a.is-current::after {
    display: none;
  }

  .game-stage {
    min-height: min(70vh, 720px);
    border-radius: 16px;
  }

  .game-sheet {
    max-height: 46%;
  }

  .meter {
    grid-template-columns: 4.4rem 1fr auto;
  }

  .hotspot-label {
    font-size: 0.62rem;
    max-width: 7.2rem;
  }

  .game-caption {
    top: 4.1rem;
  }
}

@media (max-width: 420px) {
  body.playing .game-play-wrap {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .game-choice {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card,
  .game-card-media img,
  .meter-fill,
  .hotspot-core,
  .fx-depth,
  .fx-orb {
    transition: none;
    animation: none;
  }
}
