/* Senior-friendly base: big type, big targets, high contrast, no clutter.
   Colors live in variables so dark mode follows the phone's system setting. */
:root {
  color-scheme: light dark;
  --bg: #fff; --text: #111; --border: #ddd; --muted: #666;
  --accent: #1a56b0;
  --btn-bg: #f2f2f2; --btn-border: #444; --btn-active: #ddd;
  --correct: #6aaa64; --present: #c9b458; --absent: #787c7e;
  --tile-border: #bbb; --tile-border-filled: #555;
  --key-bg: #e4e6eb; --key-text: #111; --key-border: #999;
  --gold: #f7da21; --gold-deep: #c9a200; --hex-bg: #e6e6e6;
  --menu-green: #d8f0d3; --menu-gold: #fdf3c0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121213; --text: #ececec; --border: #3a3a3c; --muted: #9d9d9d;
    --accent: #82aaf2;
    --btn-bg: #2b2b2d; --btn-border: #888; --btn-active: #444;
    --correct: #538d4e; --present: #b59f3b; --absent: #3a3a3c;
    --tile-border: #3a3a3c; --tile-border-filled: #565758;
    --key-bg: #818384; --key-text: #fff; --key-border: #818384;
    --hex-bg: #3a3a3c;
    --menu-green: #2e4d2b; --menu-gold: #4d431a;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 20px; }
body {
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  touch-action: manipulation;            /* no double-tap zoom delay */
  -webkit-text-size-adjust: 100%;
  user-select: none; -webkit-user-select: none;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.3rem 0.8rem; border-bottom: 2px solid var(--border);
}
header h1 { font-size: 1.25rem; }
.back {
  font-size: 1rem; text-decoration: none; color: var(--accent);
  padding: 0.4rem 0.7rem; border: 2px solid var(--accent); border-radius: 10px;
  min-height: 44px; display: inline-flex; align-items: center;
}
button {
  font: inherit; cursor: pointer; border-radius: 10px;
  border: 2px solid var(--btn-border); background: var(--btn-bg); color: var(--text);
  min-height: 48px;
}
button:active { background: var(--btn-active); }
.big-btn {
  display: block; width: 100%; max-width: 420px; margin: 0.8rem auto;
  font-size: 1.5rem; font-weight: 700; padding: 1.2rem;
  border: 3px solid var(--btn-border); border-radius: 16px; text-align: center;
  text-decoration: none; color: var(--text);
}
.message {
  text-align: center; font-size: 1.1rem; font-weight: 700;
  min-height: 1.8rem; padding: 0.2rem;
}
.note { text-align: center; color: var(--muted); font-size: 0.85rem; }
.hidden { display: none !important; }
.fatal {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  position: fixed; inset: 0; background: var(--bg); padding: 2rem;
  font-size: 1.4rem; text-align: center; line-height: 1.6; z-index: 99;
}
main { max-width: 520px; margin: 0 auto; padding: 0.4rem 0.6rem; }

/* Modal overlay: floats above the game, never pushes layout around. */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card {
  position: relative; background: var(--bg); color: var(--text);
  border-radius: 16px; padding: 1.2rem; width: 100%; max-width: 380px;
  max-height: 88vh; overflow: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px); } }
.modal-card h2 { font-size: 1.1rem; text-align: center; text-transform: uppercase; letter-spacing: 1px; }
.modal-card h3 { font-size: 0.95rem; text-align: center; text-transform: uppercase; letter-spacing: 1px; margin-top: 0.4rem; }
.modal-msg { text-align: center; font-size: 1.15rem; font-weight: 800; min-height: 1.4rem; margin-bottom: 0.4rem; }
.modal-close {
  position: absolute; top: 0.3rem; right: 0.3rem;
  border: none; background: none; font-size: 1.7rem; line-height: 1;
  min-width: 44px; min-height: 44px; color: var(--muted);
}
.stat-grid { display: flex; gap: 8px; text-align: center; margin: 0.6rem 0 0.4rem; }
.stat { flex: 1; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: 0.65rem; color: var(--muted); }
.icon-btn { border: none; background: none; font-size: 1.25rem; min-width: 44px; min-height: 44px; }
.head-right { display: flex; align-items: center; gap: 0.2rem; }

@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}
@keyframes pop { 50% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; }
}
