:root {
  --ink: #121212;
  --muted: #5a594e;
  --line: #dcdcdc;
  --bg: #ffffff;
  --page: #f6f5f0;
  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; color: inherit; }

/* ---------- Top bar shared by the games ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar .home {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}
.topbar .home svg { width: 20px; height: 20px; }
.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.pill {
  border: 1px solid var(--ink);
  background: var(--bg);
  border-radius: 999px;
  padding: 0 18px;
  height: 44px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.pill:hover:not(:disabled) { background: #f3f3f3; }
.pill.solid { background: var(--ink); color: #fff; }
.pill.solid:hover:not(:disabled) { background: #333; }
.pill:disabled { opacity: 0.35; cursor: default; }
.pill.small { height: 34px; padding: 0 14px; font-size: 14px; }

/* ---------- Difficulty bar (Sudoku, Pips) ---------- */
.sub-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
}
.levels { display: inline-flex; background: #f0efe9; border-radius: 999px; padding: 3px; }
.levels button {
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.levels button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 6px;
  animation: toast-in 0.15s ease-out;
  text-align: center;
}
.toast.out { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}
.modal-backdrop.open { display: flex; animation: fade 0.2s; }
.modal {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 23px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 480px;
  padding: 40px 24px 32px;
  text-align: center;
  animation: rise 0.25s ease-out;
}
.modal .close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.modal h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0 0 8px; }
.modal p { margin: 0 0 16px; font-size: 17px; }
.modal .buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.stats { display: flex; justify-content: center; gap: 22px; margin: 20px 0 8px; }
.stats div { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.stats b { font-size: 30px; font-weight: 500; }
.stats span { font-size: 12px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
