* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --card: #161b22;
  --line: #232b36;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #ffd23f;
  --red: #e03e3e;
  --gold: #f5a623;
  --green: #2ea043;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2333 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  /* respect iOS notch / status bar / home indicator when launched as a PWA */
  padding:
    calc(24px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(44px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

.app { max-width: 680px; margin: 0 auto; }

header { text-align: center; margin-bottom: 20px; }
h1 { font-size: 1.9rem; letter-spacing: -0.5px; }
.sub { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }
.sub a { color: var(--accent); text-decoration: none; }
.sub a:hover { text-decoration: underline; }

/* game tabs */
.game-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.game-tab {
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  padding: 10px 20px; border-radius: 999px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.game-tab.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; margin-bottom: 16px;
}

/* strategy buttons */
.strategy-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.strat {
  background: #0d1117; color: var(--muted); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 10px; font-size: 0.85rem; cursor: pointer;
  transition: all .15s;
}
.strat:hover { border-color: var(--accent); color: var(--text); }
.strat.active { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.strat-desc { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 12px 0 4px; min-height: 2.4em; }

/* result balls */
.result {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px; min-height: 84px; margin: 18px 0 8px;
}
.ball {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: #1a1a1a;
  box-shadow: 0 6px 16px rgba(0,0,0,.4), inset 0 -6px 12px rgba(0,0,0,.15);
  animation: pop .4s cubic-bezier(.2,1.4,.4,1) both;
}
.ball.white { background: radial-gradient(circle at 35% 30%, #fff, #d5dbe2); }
.ball.red { background: radial-gradient(circle at 35% 30%, #ff6a6a, var(--red)); color: #fff; }
.ball.gold { background: radial-gradient(circle at 35% 30%, #ffcf6a, var(--gold)); color: #1a1a1a; }
.plus { font-size: 1.6rem; color: var(--muted); font-weight: 700; }

@keyframes pop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.insight { text-align: center; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; margin-bottom: 14px; }

.generate {
  display: block; width: 100%; padding: 16px; margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #1a1a1a; border: none; border-radius: 12px;
  font-size: 1.15rem; font-weight: 800; cursor: pointer;
  transition: transform .1s, filter .15s;
}
.generate:hover { filter: brightness(1.05); }
.generate:active { transform: scale(.98); }
.generate:disabled { opacity: .6; cursor: default; }
.special-note { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 10px; }

/* stats */
.stats { display: flex; flex-direction: column; gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.stat-label.hot { color: #ff8a5c; }
.stat-label.cold { color: #6ab7ff; }
.stat-label.overdue { color: var(--accent); }
.chip-row {
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.05rem; letter-spacing: 2px; color: var(--text);
}

/* footer */
footer { text-align: center; }
.status { color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.status b { color: var(--text); }
.refresh {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 8px; font-size: 0.8rem; cursor: pointer;
}
.refresh:hover { color: var(--text); border-color: var(--muted); }
.disclaimer { color: #5b6570; font-size: 0.72rem; margin-top: 18px; line-height: 1.5; max-width: 460px; margin-inline: auto; }

@media (max-width: 480px) {
  .ball { width: 48px; height: 48px; font-size: 1.25rem; }
  h1 { font-size: 1.55rem; }
}
