:root {
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --ink: #183747;
  --soft-ink: #486675;
  --cream: #fff8e7;
  --sky: #bfe9f2;
  --deep: #174a63;
  --leaf: #4e9b72;
  --sun: #ffd26a;
  --coral: #f38d73;
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 50px rgba(24, 55, 71, 0.16);
  --tap-size: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink); }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
button, select, input { font: inherit; }
button { color: inherit; }
button, [role="button"] { touch-action: manipulation; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 4px solid rgba(23, 74, 99, 0.28); outline-offset: 4px; }
img { display: block; max-width: 100%; }

.app-root { min-height: 100vh; min-height: 100dvh; }
.safe-screen { min-height: 100vh; min-height: 100dvh; padding: calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left)); }
.eyebrow { margin: 0 0 8px; font-size: clamp(0.8rem, 1.8vw, 1rem); font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--deep); }

.play-gate {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #9fe0ef 0 54%, #a9d982 54% 70%, #f4c979 70% 100%);
}
.play-sky span { position: absolute; border-radius: 999px; background: rgba(255,255,255,.72); filter: blur(.2px); animation: drift-cloud 18s linear infinite; }
.play-sky span:nth-child(1) { width: 120px; height: 44px; top: 12%; left: 8%; }
.play-sky span:nth-child(2) { width: 170px; height: 56px; top: 25%; right: 5%; animation-duration: 24s; }
.play-sky span:nth-child(3) { width: 90px; height: 34px; top: 42%; left: 32%; animation-duration: 21s; }
.play-card { width: min(620px, 93vw); padding: clamp(28px, 5vw, 54px); text-align: center; border-radius: 44px; background: rgba(255,255,255,.91); box-shadow: var(--shadow); backdrop-filter: blur(8px); position: relative; }
.gate-avatar { width: clamp(150px, 26vw, 230px); margin: 0 auto 10px; filter: drop-shadow(0 12px 15px rgba(24,55,71,.16)); animation: gentle-float 3.8s ease-in-out infinite; }
.play-card h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 5rem); line-height: .95; }
.gate-subtitle { margin: 18px 0 30px; font-size: clamp(1.2rem, 3vw, 1.6rem); color: var(--soft-ink); font-weight: 700; }
.play-button, .big-action-button { border: 0; border-radius: 999px; min-height: 86px; padding: 18px 54px; background: linear-gradient(180deg, #ffd96c, #f4b647); color: #253b3f; font-size: clamp(1.7rem, 5vw, 2.35rem); font-weight: 1000; letter-spacing: .03em; box-shadow: 0 10px 0 #c9832f, 0 18px 30px rgba(92,69,25,.18); cursor: pointer; }
.play-button:active, .big-action-button:active { transform: translateY(4px); box-shadow: 0 6px 0 #c9832f, 0 11px 20px rgba(92,69,25,.16); }
.play-button:disabled { opacity: .86; }

.home-screen { background: radial-gradient(circle at 90% 0%, rgba(255,210,106,.7), transparent 23%), linear-gradient(180deg, #d9f3f7, #fff6df); display: flex; flex-direction: column; gap: 28px; }
.home-header { max-width: 1180px; width: 100%; margin: 0 auto; min-height: 240px; display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: clamp(18px, 4vw, 40px); border-radius: 38px; background: rgba(255,255,255,.62); }
.home-hero-copy h1 { margin: 0; font-size: clamp(3rem, 8vw, 6rem); line-height: .94; }
.home-hero-copy > p:last-child { margin: 18px 0 0; font-size: clamp(1.25rem, 3vw, 2rem); font-weight: 750; color: var(--soft-ink); }
.home-avatar { width: clamp(170px, 28vw, 330px); max-height: 300px; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(24,55,71,.16)); animation: gentle-float 4.2s ease-in-out infinite; }
.game-grid { width: min(1180px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 24px; }
.game-card { min-height: 250px; width: 100%; border: 0; border-radius: 36px; background: white; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(130px, .8fr) 1.2fr auto; align-items: center; gap: 22px; padding: 22px; text-align: left; cursor: pointer; overflow: hidden; }
.game-card:hover { transform: translateY(-2px); }
.game-card-art { align-self: stretch; border-radius: 28px; overflow: hidden; background: #cde9d5; min-height: 190px; display: grid; place-items: center; }
.game-card-art img { width: 100%; height: 100%; object-fit: cover; }
.game-card-copy { display: flex; flex-direction: column; gap: 7px; }
.game-card-kicker { color: var(--leaf); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; }
.game-card-copy strong { font-size: clamp(1.65rem, 3.5vw, 2.35rem); line-height: 1.05; }
.game-card-copy > span:last-child { color: var(--soft-ink); font-size: 1.08rem; line-height: 1.35; font-weight: 650; }
.game-card-arrow { font-size: 3.5rem; color: var(--deep); font-weight: 300; }
.home-footer { width: min(1180px, 100%); margin: auto auto 0; display: flex; justify-content: flex-end; padding-top: 12px; }
.parent-hold-button { position: relative; overflow: hidden; min-height: 54px; min-width: 132px; border: 0; border-radius: 999px; padding: 0 18px; background: rgba(255,255,255,.72); color: #5f747c; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; cursor: pointer; }
.hold-progress { position: absolute; inset: 0; background: rgba(23,74,99,.12); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.parent-hold-button.is-holding .hold-progress { animation: hold-fill var(--hold-duration, 3000ms) linear forwards; }

.parent-screen { background: #f4f0e7; }
.parent-header { width: min(1080px, 100%); margin: 0 auto 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.parent-header h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); }
.parent-note { color: var(--soft-ink); margin: 8px 0 0; }
.parent-grid { width: min(1080px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.panel { border-radius: 28px; background: white; padding: clamp(20px, 4vw, 34px); box-shadow: 0 10px 28px rgba(24,55,71,.08); }
.panel h2 { margin-top: 0; font-size: 1.7rem; }
.setting-row { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid #e9e4da; font-weight: 750; }
.setting-row:last-child { border-bottom: 0; }
.setting-stack { align-items: stretch; flex-direction: column; }
.setting-row input[type="checkbox"] { width: 34px; height: 34px; accent-color: var(--deep); }
.setting-row select { width: 100%; min-height: 52px; border: 2px solid #d7ddd9; border-radius: 15px; padding: 0 14px; background: white; color: var(--ink); }
.secondary-button { min-height: 54px; border: 2px solid rgba(23,74,99,.18); background: white; border-radius: 999px; padding: 10px 22px; font-weight: 850; cursor: pointer; }
.session-stats { margin: 0; display: grid; gap: 3px; }
.session-stats > div { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 13px 0; border-bottom: 1px solid #ece8df; }
.session-stats dt { color: var(--soft-ink); }
.session-stats dd { margin: 0; font-weight: 900; text-align: right; }
.privacy-note, .empty-summary { color: var(--soft-ink); line-height: 1.5; }

.reward-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.reward-particle { position: absolute; left: var(--x); bottom: 18%; width: 22px; height: 22px; background: #ffd66c; border-radius: 50%; opacity: 0; animation: particle-rise 900ms ease-out var(--delay) forwards; }
.reward-shape-1 { border-radius: 6px; background: #77c8ba; transform: rotate(25deg); }
.reward-shape-2 { background: #f49a80; clip-path: polygon(50% 0%, 62% 36%, 100% 38%, 69% 60%, 80% 100%, 50% 75%, 20% 100%, 31% 60%, 0 38%, 38% 36%); }
.tap-pop { animation: tap-pop 340ms ease-out; }
.gentle-highlight { animation: gentle-highlight 1.1s ease-in-out 2; }
.celebrating { animation: celebrate-pulse 600ms ease-in-out 2; }

@keyframes hold-fill { to { transform: scaleX(1); } }
@keyframes gentle-float { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-9px) rotate(1deg); } }
@keyframes drift-cloud { 0%,100% { transform: translateX(0); } 50% { transform: translateX(28px); } }
@keyframes tap-pop { 50% { transform: scale(.96); } 75% { transform: scale(1.03); } }
@keyframes gentle-highlight { 50% { filter: drop-shadow(0 0 20px rgba(255,210,106,.9)); transform: scale(1.035); } }
@keyframes celebrate-pulse { 50% { transform: scale(1.035) rotate(.5deg); filter: brightness(1.06); } }
@keyframes particle-rise { 0% { transform: translate3d(0, 0, 0) scale(.4); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate3d(var(--drift), -58vh, 0) rotate(180deg) scale(1.1); opacity: 0; } }

@media (max-width: 760px) {
  .safe-screen { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  .home-header { min-height: 205px; padding: 18px; }
  .home-avatar { width: 150px; }
  .game-card { grid-template-columns: 124px 1fr; min-height: 205px; padding: 15px; }
  .game-card-arrow { display: none; }
  .game-card-art { min-height: 160px; }
  .parent-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .home-hero-copy h1 { font-size: 2.6rem; }
  .home-hero-copy > p:last-child { font-size: 1rem; margin-top: 10px; }
  .home-avatar { width: 110px; }
  .game-card { grid-template-columns: 1fr; text-align: center; }
  .game-card-art { min-height: 190px; }
  .parent-header { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
