:root {
  --fg: #111; --muted: #666; --bg: #fff; --accent: #2563eb; --guide: #c7d2fe; --err: #b91c1c;
}
html, body { margin: 0; height: 100%; font-family: system-ui, sans-serif; color: var(--fg); background: var(--bg); }
body { overscroll-behavior: none; }   /* no pull-to-refresh while drawing */

section { height: 100%; box-sizing: border-box; }
.card-screen {
  padding: 1.5rem; max-width: 30rem; margin: 0 auto; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: center; gap: .75rem;
}
h1 { font-size: 1.6rem; margin: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.lead { font-size: 1.05rem; margin: 0; }
.muted, .consent { color: var(--muted); font-size: .85rem; }
.error { color: var(--err); }

form { display: flex; flex-direction: column; gap: .6rem; }
input { font-size: 1.1rem; padding: .7rem .8rem; border: 1px solid #bbb; border-radius: 8px; width: 100%; box-sizing: border-box; }
details summary { color: var(--muted); cursor: pointer; font-size: .9rem; }
details input { margin-top: .4rem; }
button {
  font-size: 1.05rem; padding: .75rem 1rem; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; cursor: pointer; touch-action: manipulation;
}
button.secondary { background: #e5e7eb; color: var(--fg); }
button:disabled { opacity: .5; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* drawing screen */
#screen-draw { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; }
#pad { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; background: var(--bg); display: block; }
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .3rem .75rem;
  padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; background: rgba(255,255,255,.92);
}
#prompt { font-size: 1.3rem; }
#prompt strong { font-size: 2rem; color: var(--accent); vertical-align: -.15em; }
#progress-text { justify-self: end; color: var(--muted); font-variant-numeric: tabular-nums; }
.hud-buttons { grid-column: 1 / -1; display: flex; gap: .5rem; }
.hud-buttons button { padding: .45rem .8rem; font-size: .95rem; }
#progress-bar { grid-column: 1 / -1; height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#hint {
  position: absolute; bottom: calc(1rem + env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; color: var(--muted); font-size: .9rem; pointer-events: none;
}
#pad.flash { animation: flash .25s ease-out; }
@keyframes flash { from { background: #dbeafe; } to { background: var(--bg); } }

/* stats */
#digit-bars { display: grid; grid-template-columns: 1.2rem 1fr 3rem; gap: .25rem .5rem; align-items: center; font-size: .9rem; }
.bar { height: .7rem; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
#leaderboard { margin: 0; padding-left: 1.4rem; }
#leaderboard li { padding: .1rem 0; }

[hidden] { display: none !important; }
