:root {
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #1f6feb;
  --card: #161b22;
  --border: #30363d;
  --radius: 16px;
  --maxw: 720px;
}
[data-theme="light"] {
  --bg: #f6f8fa;
  --fg: #1f2328;
  --muted: #57606a;
  --accent: #0969da;
  --card: #ffffff;
  --border: #d0d7de;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  transition: background .2s, color .2s;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; color: var(--muted); }

.btn-icon {
  appearance: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--card); color: var(--fg);
  font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s;
}
.btn-icon:hover { background: var(--border); }

.screen {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-image {
  display: block;
  width: 100%;
  max-width: 520px;
  max-height: 55dvh;
  object-fit: contain;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  background: var(--card);
}

.page-text p {
  margin: 0 0 14px;
  text-align: center;
}

.choices { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

.btn-choice {
  appearance: none; cursor: pointer;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font: inherit; font-weight: 600;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn-choice:hover { border-color: var(--accent); }
.btn-choice:active { transform: scale(.98); }

.timerbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.loading { text-align: center; color: var(--muted); }

@media (min-width: 600px) {
  body { font-size: 18px; }
  .screen { padding-bottom: 64px; }
}

/* random dice */
.random-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}
.random-result {
  font-size: 56px;
  font-weight: 800;
  color: var(--accent);
  min-height: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}
.random-result.pop { animation: pop .18s ease-out; }
@keyframes pop {
  0% { transform: scale(.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
