/* Shared look for the Tiltwick games: night-indigo world, bright glossy pieces, chunky display type. */
:root {
  color-scheme: dark;
  --night: #170f38;
  --night-2: #241657;
  --tray: #2a1d63;
  --ink: #fff8ec;
  --muted: #b9acec;
  --gold: #ffc93c;
  --gold-deep: #e8930c;
  --go: #2fd86f;
  --go-deep: #179c4b;
  --danger: #ff3d5f;
  --sky: #2f9bff;
  --glow-a: #3b1f8f;
  --glow-b: #0e6a8a;
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
}
html, body { height: 100%; touch-action: manipulation; }  /* no double-tap zoom */
body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--glow-a) 0%, transparent 70%),
    radial-gradient(90% 60% at 50% 110%, var(--glow-b) 0%, transparent 70%),
    var(--night);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
[hidden] { display: none !important; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* one-screen game layout */
.game { height: 100%; display: flex; flex-direction: column; overflow: hidden; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 12px 6px; }
.round-btn { width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.28); font-size: 1.3rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hud .title { font-family: var(--font-display); font-size: 1.3rem; text-align: center; line-height: 1.05; }
.hud .title small { display: block; font-family: var(--font-body); font-size: .72rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 10px; border-radius: 16px; background: rgba(0,0,0,.28); }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .65rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.stat.low b { color: var(--danger); animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding-block: 4px; }
.stage canvas { display: block; touch-action: none; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 6px 14px; color: var(--muted); font-size: .85rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.28); border-radius: 999px; padding: 6px 12px; font-variant-numeric: tabular-nums; }
.goals { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding-block: 4px 8px; }
.goal { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px; background: rgba(0,0,0,.28); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.goal canvas { width: 30px; height: 30px; }
.goal.done { background: rgba(47,216,111,.25); }
.goal.cheer { animation: cheer 1.6s ease-out; }
@keyframes cheer { 0%, 100% { transform: scale(1); } 12%, 40%, 68% { transform: scale(1.3); box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold); } 26%, 54% { transform: scale(1.1); } }
.goal.done .count::after { content: " \2713"; color: var(--go); }

.btn {
  font-family: var(--font-display); font-size: 1.25rem; letter-spacing: .02em;
  padding: 14px 22px; border-radius: 999px;
  background: linear-gradient(var(--go), var(--go-deep));
  box-shadow: 0 5px 0 #0f6b33, 0 10px 24px rgba(0,0,0,.35);
  /* Lilita One has one weight (400): without this the body's 800 makes the browser fake-bold it, so letters smear */
  font-weight: 400; font-synthesis: none;
  color: #fff; text-shadow: 0 2px 0 #0c5a2b, 0 0 1px #0c5a2b;  /* crisp dark-green edge, no grey blur */
  transition: transform 80ms; text-align: center;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #0f6b33; }
.btn.gold { background: linear-gradient(var(--gold), var(--gold-deep)); box-shadow: 0 5px 0 #a35f00, 0 10px 24px rgba(0,0,0,.35); text-shadow: 0 2px 0 #8f4a00, 0 0 1px #8f4a00; }
.btn.quiet { background: rgba(255,255,255,.1); box-shadow: none; color: var(--ink); text-shadow: 0 2px 0 rgba(0,0,0,.3); font-size: 1.05rem; padding: 12px 20px; }
.btn.small { font-size: .95rem; padding: 9px 14px; }
.btn[disabled] { opacity: .4; cursor: default; }

.word {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%);
  font-family: var(--font-display); font-size: clamp(2rem, 9vw, 3.4rem); white-space: nowrap;
  color: var(--gold); -webkit-text-stroke: 2px #6b2c00; text-shadow: 0 4px 0 #6b2c00, 0 10px 30px rgba(0,0,0,.4);
  pointer-events: none; opacity: 0; z-index: 5;
}
.word.show { animation: word 900ms ease-out forwards; }
@keyframes word {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.3) rotate(-8deg); }
  25% { opacity: 1; transform: translate(-50%,-50%) scale(1.15) rotate(3deg); }
  40% { transform: translate(-50%,-50%) scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-80%) scale(1); }
}

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,6,30,.72); backdrop-filter: blur(3px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.card {
  width: min(100%, 360px); text-align: center;
  background: linear-gradient(#3a2a86, #251a5c);
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 28px; padding: 24px 20px 22px;
  display: flex; flex-direction: column; gap: 14px; align-items: stretch;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: cardIn 380ms cubic-bezier(.3,1.5,.6,1);
}
@keyframes cardIn { from { transform: scale(.7); opacity: 0; } }
.card h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.05; text-wrap: balance; }
.card p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.4; }
.card p strong { color: var(--ink); }
.big-stars { display: flex; justify-content: center; gap: 6px; font-size: 3rem; line-height: 1; }
.big-stars span { color: rgba(255,255,255,.15); transform: scale(.4); opacity: 0; }
.big-stars span.on { color: var(--gold); text-shadow: 0 4px 0 var(--gold-deep); }
.big-stars span.in { animation: starIn 420ms cubic-bezier(.3,1.6,.6,1) forwards; }
.big-stars span:nth-child(2) { font-size: 3.8rem; margin-top: -10px; }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -.14em;
  background: radial-gradient(circle at 35% 30%, #fff6b8 0 18%, #ffc93c 45%, #d98a00 100%); box-shadow: inset 0 -.12em 0 #a35f00, 0 0 0 .06em #7a4300; }
.coin-line { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 1.3rem; color: var(--ink) !important; }
.coin-line b { font-family: var(--font-display); font-weight: 400; color: var(--gold); font-variant-numeric: tabular-nums; }
.coin-line small { font-size: .8rem; color: var(--muted); }
.ad-label { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.ad-ring { width: 96px; height: 96px; margin: 0 auto; }
.hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 360px; padding: 10px 14px; border-radius: 16px;
  background: rgba(255,248,236,.96); color: #2a1d63; font-size: .95rem; line-height: 1.35; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); pointer-events: none; z-index: 4;
  animation: hintIn 400ms cubic-bezier(.3,1.4,.6,1);
}
@keyframes hintIn { from { transform: translate(-50%, 20px); opacity: 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 20; width: min(calc(100% - 32px), 360px);
  background: var(--ink); color: #2a1d63; border-radius: 16px; padding: 12px 16px; font-size: .9rem; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* About a game: text below the one-screen game, reached by scrolling down. */
.about { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding-block: 28px calc(40px + env(safe-area-inset-bottom, 0px)); font-weight: 600; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.about h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; margin: 0 0 8px; }
.about h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; color: var(--gold); margin: 22px 0 6px; }
.about p, .about li, .about dd { color: var(--ink); }
.about p { margin: 0 0 10px; }
.about ul { margin: 0; padding-left: 22px; }
.about li { margin-bottom: 4px; }
.about dt { font-weight: 800; margin-top: 10px; }
.about dd { margin: 2px 0 0; color: var(--muted); }
.about a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
/* Win-card invite to make an account (TWK.accountHint): a quiet gold-edged line, not a popup. */
.acc-hint { display: flex; align-items: center; gap: 10px; text-align: left; font-size: .88rem; line-height: 1.35; color: var(--ink); text-decoration: none;
  background: rgba(255,201,60,.12); border: 1.5px solid rgba(255,201,60,.55); border-radius: 14px; padding: 9px 12px; }
.acc-hint > span:first-child { font-size: 1.4rem; line-height: 1; flex: none; }
.acc-hint:active { transform: scale(.98); }
