/* Device frames, platform toggle, walkthrough and playable demo */

/* ---------- device frame ---------- */
.device {
  --ar: 780 / 1695;
  position: relative;
  width: min(100%, 21.5rem);
  margin: 0 auto;
  padding: 0.6rem;
  border-radius: 2.8rem;
  background: linear-gradient(145deg, #1a2336, #05070c);
  border: 1px solid #2c3956;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.5), inset 0 0 0 2px #0a0f1b;
}

.device-screen {
  position: relative;
  overflow: hidden;
  border-radius: 2.2rem;
  background: var(--navy);
  aspect-ratio: var(--ar);
}

.device-android {
  --ar: 780 / 1733;
  border-radius: 2.1rem;
}

.device-android .device-screen {
  border-radius: 1.6rem;
}

.device-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* iOS dynamic island / Android punch hole, drawn over the screenshots */
.device-ios .device-screen::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  left: 50%;
  width: 28%;
  height: 1.3rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #02040a;
  z-index: 5;
  pointer-events: none;
}

.device-android .device-screen::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #02040a;
  z-index: 5;
  pointer-events: none;
}

.device-tablet {
  width: 100%;
  max-width: 34rem;
  border-radius: 1.6rem;
  padding: 0.7rem;
}

.device-tablet .device-screen {
  border-radius: 1rem;
}

.device-tablet .device-screen::after {
  display: none;
}

/* ---------- platform toggle ---------- */
.plat-toggle {
  display: inline-flex;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  margin: 0 0 1.25rem;
}

.plat-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 700 0.9rem var(--font-body);
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
}

.plat-btn[aria-pressed="true"] {
  background: var(--pink);
  color: #190812;
}

.plat-btn:focus-visible,
.step-btn:focus-visible,
.demo-app button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- walkthrough ---------- */
.walk {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 860px) {
  .walk {
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  }
}

.screen-pane {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.screen-pane.active {
  opacity: 1;
  visibility: visible;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.step-btn {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.2rem 0.8rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.step-btn:hover {
  border-color: rgba(255, 91, 138, 0.5);
}

.step-btn[aria-current="step"] {
  border-color: var(--pink);
  background: rgba(255, 91, 138, 0.1);
}

.step-btn .n {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--panel-2);
  font-weight: 800;
  font-size: 0.85rem;
}

.step-btn[aria-current="step"] .n {
  background: var(--pink);
  color: #190812;
}

.step-btn strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.step-btn span.d {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.walk-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.walk-caption {
  margin: 0.9rem 0 0;
  min-height: 3.2em;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
}

.walk-stage {
  min-width: 0;
}

.tablets {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  align-items: start;
  margin-top: 2.5rem;
}

.tablets figure {
  margin: 0;
}

.tablets figcaption {
  margin-top: 0.7rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.tablets .ipad-wrap {
  max-width: 24rem;
  margin: 0 auto;
}

/* ---------- playable demo ---------- */
.demo-banner {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(245, 197, 66, 0.14);
  color: #f9deb0;
  border: 1px solid rgba(245, 197, 66, 0.4);
}

.play-layout {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 860px) {
  .play-layout {
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  }
}

.play-side {
  display: grid;
  gap: 1.2rem;
}

.side-card {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel);
}

.side-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.side-card p,
.side-card li {
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.side-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.ad-status {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
}

.ad-status b {
  color: var(--ink);
}

.legend {
  display: grid;
  gap: 0.4rem;
}

.legend li {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.legend {
  padding-left: 0 !important;
}

/* orbs */
.orb {
  position: relative;
  display: block;
  border-radius: 50%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 38%),
    var(--orb, #888);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.4);
}

.orb.sm {
  width: 1.1rem;
}

.orb-0 { --orb: #e85a7a; }
.orb-1 { --orb: #f5c542; }
.orb-2 { --orb: #4caf7a; }
.orb-3 { --orb: #4a90d9; }
.orb-4 { --orb: #8b6bcf; }
.orb-5 { --orb: #e8954a; }
.orb-lock { --orb: #6b7280; }

/* demo app (both skins) */
.demo-device {
  --ar: 390 / 800;
}

.demo-app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #eef2f9;
  padding: 2.4rem 0.8rem 0.9rem;
  gap: 0.6rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.demo-app button {
  font-family: inherit;
  cursor: pointer;
}

.app-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.app-sub {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8794ad;
  margin-top: 0.1rem;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.9rem;
  background: var(--panel);
}

.hud .lbl {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: #8794ad;
  font-weight: 700;
}

.hud .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.hud .of {
  font-size: 0.85rem;
  color: #b9c4d8;
  margin-left: 0.15rem;
}

.hud .par {
  display: block;
  font-size: 0.72rem;
  color: #b9c4d8;
}

.hud-target {
  text-align: right;
}

.hud-target .orb {
  width: 1.6rem;
  margin: 0.15rem 0 0 auto;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.board-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.board {
  --cols: 6;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 3px;
  width: 100%;
  max-width: 100%;
  padding: 0.35rem;
  border-radius: 0.9rem;
  background: var(--panel);
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
}

.tile .orb {
  width: 100%;
  transition: background-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.tile.owned .orb {
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.28), 0 0 0 1.5px rgba(255, 255, 255, 0.85);
  transform: scale(0.94);
}

.tile .glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.tile .glyph svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}

.tile.locked .orb {
  opacity: 0.92;
}

.palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
  padding: 0.55rem 0.5rem 0.4rem;
  border-radius: 0.9rem;
  background: var(--panel);
}

.pal-btn {
  position: relative;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
}

.pal-btn .orb {
  width: 100%;
  max-width: 2.4rem;
  transition: transform 0.12s;
}

.pal-btn:active .orb {
  transform: scale(0.9);
}

.pal-btn[disabled] {
  cursor: default;
}

.pal-btn[disabled]:not(.is-target) .orb {
  opacity: 0.28;
}

.pal-btn .badge {
  position: absolute;
  bottom: -0.35rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--pink);
  color: #190812;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.pal-btn.is-target .orb {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 91, 138, 0.6);
}

.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.act-btn {
  appearance: none;
  border: 0;
  color: #eef2f9;
  background: var(--panel-2);
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.act-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.act-btn b {
  margin-left: 0.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.72rem;
}

/* iOS skin: rounded capsule buttons, centered title */
.demo-app[data-platform="ios"] .act-btn {
  border-radius: 999px;
  flex: 1;
}

.demo-app[data-platform="ios"] .act-btn.primary {
  background: var(--pink);
  color: #190812;
}

.demo-app[data-platform="ios"] .app-title {
  font-weight: 600;
}

/* Android skin: Material-ish, left title, squarer shapes */
.demo-app[data-platform="android"] {
  padding-top: 2.2rem;
}

.demo-app[data-platform="android"] .app-head {
  text-align: left;
  padding-left: 0.4rem;
}

.demo-app[data-platform="android"] .app-title,
.demo-app[data-platform="android"] .app-sub {
  text-align: left;
}

.demo-app[data-platform="android"] .app-title {
  font-size: 1.15rem;
}

.demo-app[data-platform="android"] .hud,
.demo-app[data-platform="android"] .palette,
.demo-app[data-platform="android"] .board {
  border-radius: 0.55rem;
}

.demo-app[data-platform="android"] .act-btn {
  border-radius: 0.5rem;
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.demo-app[data-platform="android"] .act-btn.primary {
  background: var(--pink);
  color: #190812;
}

.demo-app[data-platform="android"] .tile .orb {
  border-radius: 40%;
}

/* result card + ad */
.layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 12, 22, 0.78);
  backdrop-filter: blur(3px);
}

.layer[hidden] {
  display: none;
}

.card {
  width: 100%;
  padding: 1.2rem 1rem 1rem;
  border-radius: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
}

.demo-app[data-platform="android"] .card {
  border-radius: 0.75rem;
}

.card h4 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.card p {
  margin: 0.15rem 0;
  font-size: 0.85rem;
  color: #b9c4d8;
}

.card .stars {
  font-size: 1.8rem;
  letter-spacing: 0.2rem;
  color: #f5c542;
  margin: 0.2rem 0;
}

.card .stars .off {
  color: rgba(255, 255, 255, 0.2);
}

.card .btns {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.card .btns .act-btn {
  flex: none;
  width: 100%;
}

.ad-card {
  background: #fff;
  color: #1b2230;
  border: 0;
  position: relative;
  padding-top: 2.2rem;
}

.ad-card p {
  color: #4a5568;
}

.ad-tag {
  position: absolute;
  top: 0.6rem;
  left: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.3rem;
  background: #fbbf24;
  color: #3b2a00;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ad-art {
  height: 7rem;
  margin: 0.5rem 0;
  border-radius: 0.6rem;
  background:
    repeating-linear-gradient(45deg, #e5e9f2 0 10px, #eef1f8 10px 20px);
  display: grid;
  place-items: center;
  color: #5b6577;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
}

.ad-card .act-btn.close {
  background: #e5e9f2;
  color: #1b2230;
}

.ad-card .act-btn.rm {
  background: var(--pink);
  color: #190812;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  z-index: 3;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0b1220;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.toast[hidden] {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .tile .orb,
  .screen-pane,
  .pal-btn .orb {
    transition: none;
  }
}
