/* =====================
   Design tokens & base
   ===================== */
:root {
  --bg: #f8f7f4;
  --bg-muted: #f2efe9;
  --card: #ffffff;
  --muted: #596072;
  --text: #1e2334;
  --accent: #3558d0;
  --accent-strong: #1f3ea6;
  --hot: #dc4c4c;
  --warm: #d98b2b;
  --cool: #0ea5e9;
  --ok: #16a34a;
  --border: #d9deeb;
  --surface-muted: #e9ecf6;
  --surface-hover: #e1e4f1;
  --surface-strong: #eef8f1;
  --success-surface: #eef8f1;
  --success-text: #155e32;
  --shadow-soft: 0 10px 32px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --shadow: var(--shadow-soft);
  --font-body: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-heading: "Charter", "Georgia", "Times New Roman", serif;
  --sidebar-width: 260px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1124;
    --bg-muted: rgba(18, 24, 52, 0.75);
    --card: rgba(20, 25, 54, 0.9);
    --muted: #bac3f3;
    --text: #f2f4ff;
    --accent: #7ea9ff;
    --accent-strong: #5a7cff;
    --border: rgba(112, 125, 173, 0.32);
    --surface-muted: rgba(14, 18, 38, 0.86);
    --surface-hover: rgba(26, 32, 64, 0.92);
    --surface-strong: rgba(24, 30, 62, 0.95);
    --success-surface: rgba(26, 52, 40, 0.88);
    --success-text: #d0ffe6;
    --shadow-soft: 0 20px 44px rgba(4, 7, 18, 0.55);
    --shadow: var(--shadow-soft);
  }

  body {
    background: radial-gradient(1200px 900px at 70% -20%, rgba(62, 76, 144, 0.25), transparent),
                radial-gradient(900px 700px at 20% -10%, rgba(103, 119, 212, 0.18), transparent),
                linear-gradient(180deg, #0f142a 0%, #070a18 60%, #060812 100%);
  }

  #guess::placeholder {
    color: rgba(186, 195, 243, 0.65);
  }
}

main {
  flex: 1 0 auto;
}

.site-shell {
  display: grid;
  grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, 1fr);
  align-items: flex-start;
  gap: 32px;
  min-height: 100vh;
  padding: 24px;
}

.site-sidebar {
  position: sticky;
  top: 24px;
  align-self: flex-start;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}

.sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar .brand {
  margin-bottom: 12px;
}

.sidebar .brand .brand-name {
  font: 600 18px/1.2 "Inter", sans-serif;
  margin: 0;
  color: var(--text);
}

.sidebar .brand small {
  color: var(--muted);
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
}

.nav-simple {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

.sidebar-day-counter {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.sidebar-day-counter strong {
  color: var(--accent-strong);
  font-weight: 700;
}

@media (max-width: 600px) {
  .sidebar-day-counter {
    margin-top: 6px;
    font-size: 0.85rem;
  }
}

.sidebar-contact a {
  color: inherit;
  text-decoration: none;
}

.sidebar-contact a:hover,
.sidebar-contact a:focus-visible {
  text-decoration: underline;
  color: var(--text);
}

.sidebar-link {
  color: inherit;
  text-decoration: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  background: #fbfbfd;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.03s ease, box-shadow 0.2s ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: #f4f7ff;
  border-color: #dfe6ff;
  text-decoration: none;
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.18);
  border-radius: 12px;
  outline: none;
}

.nav-item.active {
  background: #eef3ff;
  border-color: #d9e5ff;
  box-shadow: inset 0 0 0 1px #d9e5ff;
}

.nav-item.active:focus-visible {
  box-shadow: inset 0 0 0 1px #d9e5ff, 0 0 0 3px rgba(53, 88, 208, 0.18);
  border-radius: 12px;
  outline: none;
}

.nav-item .emoji {
  width: 1.25em;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .nav-item {
    background: #151b25;
  }

  .nav-item:hover,
  .nav-item:focus-visible {
    background: #1b2230;
    border-color: #2b3445;
    box-shadow: 0 0 0 3px rgba(126, 148, 255, 0.18);
    border-radius: 12px;
    outline: none;
  }

  .nav-item.active {
    background: #1b2a44;
    border-color: #2b3a55;
    box-shadow: inset 0 0 0 1px #2b3a55;
  }

  .nav-item.active:focus-visible {
    box-shadow: inset 0 0 0 1px #2b3a55, 0 0 0 3px rgba(126, 148, 255, 0.18);
    border-radius: 12px;
    outline: none;
  }

  .sidebar-menu-toggle {
    background: #151b25;
    border-color: #2b3445;
  }

  .sidebar-menu-toggle:hover,
  .sidebar-menu-toggle:focus-visible {
    background: #1b2230;
    border-color: #2b3445;
  }
}

.sidebar-menu-toggle {
  position: sticky;
  top: 16px;
  align-self: flex-start;
  margin: 16px 16px 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  display: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 25;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-menu-toggle:hover,
.sidebar-menu-toggle:focus-visible {
  background: #f4f7ff;
  border-color: #dfe6ff;
  text-decoration: none;
}

.sidebar-nav {
  margin: 0;
}






.site-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20;
  display: none;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.sidebar-overlay[aria-hidden="false"] {
  display: block;
}

.with-sidebar .site-header,
.with-sidebar main,
.with-sidebar footer,
.with-sidebar .site-footer {
  padding-left: 24px;
  padding-right: 24px;
}

.with-sidebar .site-header {
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .info-button {
    left: calc(var(--sidebar-width) + 56px);
  }
}

@media (max-width: 820px) {
  .site-shell {
    display: block;
    padding: 0;
  }

  .site-sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    right: auto;
    bottom: 16px;
    width: min(calc(100vw - 32px), var(--sidebar-width));
    max-width: min(calc(100vw - 32px), var(--sidebar-width));
    transform: translateX(calc(-100% - 32px));
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 30;
  }

  body.sidebar-open .site-sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .site-content {
    margin-left: 0;
  }

  .info-button {
    left: auto;
    right: 24px;
  }

  .sidebar-overlay {
    display: none;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .with-sidebar .site-header,
  .with-sidebar main,
  .with-sidebar footer,
  .with-sidebar .site-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.3);
  border-radius: 6px;
}

strong {
  color: var(--accent-strong);
}

/* =====================
   Header
   ===================== */
.site-header {
  text-align: center;
  margin: 18px auto 20px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-title {
  margin: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.site-title__main {
  margin: 0;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

.site-title__brand {
  line-height: 1;
}

.info-button {
  position: fixed;
  top: 24px;
  left: calc(var(--sidebar-width) + 56px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  z-index: 40;
}

.info-button:hover,
.info-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.32);
  filter: brightness(1.05);
}

.info-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.35), 0 16px 30px rgba(37, 99, 235, 0.32);
}

.info-button span[aria-hidden="true"] {
  font-family: var(--font-heading);
}

.info-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 32px);
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

.info-backdrop[hidden] {
  display: none;
}

.info-modal {
  position: relative;
  width: min(440px, 92vw);
  padding: clamp(20px, 4vw, 28px);
  border-radius: 20px;
  background: rgba(248, 249, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #0f172a;
}

@media (prefers-color-scheme: dark) {
  .info-modal {
    background: rgba(22, 28, 45, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #e2e8f0;
  }
}

.info-modal:focus {
  outline: none;
}

.info-modal-title {
  margin: 0 0 14px;
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 700;
  text-align: left;
}

.info-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: inherit;
}

.info-modal-body p {
  margin: 0;
  text-align: left;
}

.info-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.info-close:hover,
.info-close:focus-visible {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(1.05);
}

.info-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.info-dismiss {
  margin: 18px auto 0;
  width: min(220px, 100%);
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.info-dismiss:hover,
.info-dismiss:focus-visible {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(53, 88, 208, 0.28);
}

.info-dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35), 0 12px 24px rgba(53, 88, 208, 0.28);
}

.logo {
  margin: 0;
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 800;
  letter-spacing: 0.4px;
  background-image: linear-gradient(90deg, #38bdf8, #6ee7b7);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.baseline {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
  margin-top: 0;
}

/* =====================
   Layout & cards
   ===================== */
.layout {
  width: 100%;
  margin: 0;
}

.card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: clamp(18px, 3vw, 26px);
  box-shadow: var(--shadow-soft);
}

.card-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-card {
  position: relative;
}

.game-card > .card-section {
  position: relative;
  z-index: 1;
}

.game-card.has-victory > .card-section {
  padding-top: 44px;
}

.info-card {
  color: var(--muted);
  gap: 10px;
  background: var(--bg-muted);
  box-shadow: none;
}

.info-card .note {
  margin: 0;
}

/* =====================
   Form controls
   ===================== */
.guess-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-slot-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.daily-slot-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.daily-slot-btn:hover {
  color: var(--text);
  background: var(--bg-muted);
  border-color: var(--accent);
}

.daily-slot-btn:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
}

.daily-slot-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.field-label {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent-strong);
}

.guess-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

#guess {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#guess::placeholder {
  color: rgba(89, 96, 114, 0.6);
}

#guess:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.18);
  background: var(--surface-strong);
}

/* =====================
   Buttons
   ===================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  color: var(--text);
  background: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
}

.btn:active {
  transform: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(53, 88, 208, 0.2);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 10px 20px rgba(53, 88, 208, 0.24);
}

.btn-secondary {
  background: var(--bg-muted);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-muted);
  border-color: var(--accent);
}

.btn-ghost:focus-visible {
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
}

.btn-hint {
  padding-inline: 14px;
}

.stats-toggle {
  font-size: 0.9rem;
  font-weight: 600;
  gap: 8px;
  padding-inline: 14px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.action-buttons .btn {
  flex: 1 1 200px;
}

@media (max-width: 640px) {
  .guess-controls {
    grid-template-columns: 1fr;
  }

  .guess-controls .btn {
    width: 100%;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

/* =====================
   Feedback ribbon
   ===================== */
.feedback-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.feedback-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.feedback-item:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.feedback-item.temp.hot {
  border-color: rgba(220, 76, 76, 0.35);
}

.feedback-item.temp.warm {
  border-color: rgba(217, 139, 43, 0.35);
}

.feedback-item.temp.cold {
  border-color: rgba(14, 165, 233, 0.35);
}

.feedback-icon {
  font-size: 1.35rem;
}

.feedback-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.feedback-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.feedback-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.feedback-item.temp.hot .feedback-value {
  color: var(--hot);
}

.feedback-item.temp.warm .feedback-value {
  color: var(--warm);
}

.feedback-item.temp.cold .feedback-value {
  color: var(--cool);
}

/* =====================
   Status pills
   ===================== */
.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.82rem;
}

.status-pill .pill-icon {
  font-size: 1rem;
}

.status-pill .pill-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.64rem;
  color: var(--muted);
}

.status-pill .pill-value,
.status-pill .temp,
.status-pill .rank,
.status-pill #score {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.status-pill .temp.cold {
  color: var(--cool);
}

.status-pill .temp.warm {
  color: var(--warm);
}

.status-pill .temp.hot {
  color: var(--hot);
}

.status-pill .rank {
  color: var(--accent);
}

/* =====================
   Temperature bar
   ===================== */
.temperature-module {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.temperature-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.temperature-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.temperature-track.is-found {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.temperature-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 25%, #facc15 55%, #fb923c 75%, #ef4444 100%);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left center;
}

.temperature-fill.is-pulsing {
  animation: temperaturePulse 0.45s ease-in-out 1;
}

.temperature-markers {
  display: flex;
  justify-content: space-between;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes temperaturePulse {
  0% {
    transform: scaleX(1);
  }
  40% {
    transform: scaleX(1.03);
  }
  70% {
    transform: scaleX(0.99);
  }
  100% {
    transform: scaleX(1);
  }
}

@media (max-width: 520px) {
  .temperature-label {
    font-size: 0.8rem;
  }

  .temperature-markers {
    font-size: 0.62rem;
    letter-spacing: 0.01em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .temperature-fill {
    transition-duration: 0.01ms;
  }

  .temperature-fill.is-pulsing {
    animation: none;
  }
}

/* =====================
   Hint & chips
   ===================== */
.hint-area {
  min-height: 36px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.88rem;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.hint-area:not(:empty) {
  border-color: var(--accent);
  background: var(--surface-strong);
  color: var(--text);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}

button.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

button.chip:hover {
  color: var(--text);
  background: var(--bg-muted);
  border-color: var(--accent);
}

button.chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
  color: var(--text);
  border-color: var(--accent);
}

/* =====================
   Historique des essais
   ===================== */
.history-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
}


.history-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(64px, 0.5fr) minmax(70px, 0.4fr) minmax(140px, 1fr);
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.history-entry:nth-child(odd) {
  background: var(--surface-muted);
}

.history-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.history-word {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
}

.history-word span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-temp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(217, 222, 235, 0.7);
  text-transform: uppercase;
  color: var(--muted);
}

.history-temp span[aria-hidden="true"] {
  font-size: 0.82rem;
  line-height: 1;
}

.history-temp.hot {
  border-color: rgba(220, 76, 76, 0.45);
  color: var(--hot);
}

.history-temp.warm {
  border-color: rgba(217, 139, 43, 0.45);
  color: var(--warm);
}

.history-temp.cold {
  border-color: rgba(14, 165, 233, 0.45);
  color: var(--cool);
}

.history-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

.history-rank {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
}


.history-progress {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.history-progress-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 42px;
  text-align: right;
}

.history-progress-track {
  position: relative;
  width: 100%;
  max-width: 220px;
  height: 4px;
  border-radius: 999px;
  background: rgba(53, 88, 208, 0.1);
  overflow: hidden;
}

.history-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 40%, #facc15 70%, #ef4444 100%);
  transition: width 0.28s ease;
}

@media (max-width: 640px) {
  .history-entry {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    padding: 8px 10px;
    gap: 6px 10px;
  }

  .history-score {
    justify-self: end;
  }

  .history-rank {
    justify-self: start;
  }

  .history-progress {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .history-progress-value {
    order: 2;
  }
}

/* =====================
   Panneau de stats
   ===================== */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: stretch;
  min-width: 0;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stats-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.stats-close {
  appearance: none;
  border: none;
  background: var(--bg-muted);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.stats-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.stats-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
}

.stats-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stats-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
}

.stats-item dt {
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-item dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stats-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
}

.stats-progress-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-panel {
  position: sticky;
  top: 18px;
}

@media (max-width: 1023px) {
  .stats-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    max-width: min(100vw, 320px);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    border-radius: 0;
    border-left: 1px solid var(--border);
    padding-block: clamp(20px, 6vw, 32px);
    padding-inline: clamp(20px, 6vw, 28px);
  }

  .stats-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .stats-panel .stats-body {
    overflow-y: auto;
  }
}

@media (min-width: 1024px) {
  .stats-panel {
    max-width: 280px;
  }
}

.stats-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.stats-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

body.is-stats-open {
  overflow: hidden;
}

/* =====================
   FAQ accordéon
   ===================== */
.faq-shell {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--card);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.faq-question {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  padding: 16px 20px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.faq-question::after {
  content: '';
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.faq-question[aria-expanded='true']::after {
  transform: rotate(225deg);
}

.faq-question:hover,
.faq-question:focus-visible {
  background: var(--surface-muted);
  color: var(--accent-strong);
  outline: none;
}

.faq-answer {
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(53, 88, 208, 0.03), transparent);
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 220ms ease, padding 220ms ease, opacity 220ms ease;
}

.faq-answer.is-open {
  max-height: var(--faq-answer-height, 480px);
  padding-block: 12px 20px;
  opacity: 1;
}

.faq-answer p {
  margin: 0;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .faq-answer {
    transition: none;
  }

  .faq-question {
    transition: none;
  }
}

/* =====================
   Notes & footer
   ===================== */
.note {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

code.small {
  background: var(--bg-muted);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
}

.app-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 24px 16px 32px;
  font-size: 0.85rem;
  color: var(--muted);
}

.app-footer .separator,
.site-footer .separator {
  margin: 0 6px;
  color: var(--border);
}

@media (max-width: 768px) {
  /* Liste des mots testés : occuper 40% de la hauteur écran max + scroll */
  .word-list {
    max-height: 40vh;
    overflow-y: auto;
  }

  /* Réorganisation mobile : rapprocher l'historique du champ de saisie */
  .game-layout-stack {
    gap: 1.5rem;
  }

  .game-layout-stack > .primary-section {
    order: 1;
  }

  .game-layout-stack > .history-card {
    order: 2;
  }

  .game-layout-stack > .action-buttons {
    order: 3;
  }

  .game-layout-stack > .hint-area {
    order: 4;
  }

  .game-layout-stack > #historyLive {
    order: 5;
  }

  .game-layout-stack > .note {
    order: 6;
  }

  .game-layout-stack > .chips {
    order: 7;
  }

  /* Champ de saisie : largeur pleine et texte lisible */
  input[type="text"],
  .guess-input {
    width: 100%;
    font-size: 1.1rem;
  }

  #guess {
    font-size: 1.1rem;
  }

  /* Boutons : taille tactile confortable */
  .btn,
  button {
    min-height: 44px;
  }

  /* Footer : centré et lisible */
  footer {
    text-align: center;
    padding: 1em;
    font-size: 0.95rem;
  }

  /* Petites optimisations d’espacement */
  .stats {
    gap: 6px;
    order: 1;
  }

  .guess-shell {
    order: 2;
  }

  .pill {
    font-size: 0.85rem;
  }
}

/* =====================
   Toast
   ===================== */
.toast-notification {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 16px);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  max-width: calc(100% - 48px);
  text-align: center;
  font-size: 0.88rem;
}

.toast-notification.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-notification.is-leaving {
  opacity: 0;
  transform: translate(-50%, 8px);
}

/* =====================
   Tutorial modal
   ===================== */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.tutorial-overlay.is-closing {
  opacity: 0;
}

.tutorial-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  width: min(100%, 320px);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.tutorial-box h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.tutorial-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tutorial-box button {
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.tutorial-box button:hover,
.tutorial-box button:focus-visible {
  outline: none;
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.25);
}

.tutorial-box button:active {
  transform: none;
}

.victory-banner {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(22, 163, 74, 0.4);
  background: var(--success-surface);
  color: var(--success-text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 3;
}

.victory-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.victory-banner .victory-icon {
  font-size: 1.3rem;
}

.victory-banner .victory-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.victory-banner .victory-text strong {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.confetti-container.is-active {
  opacity: 1;
}

.success-message {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  z-index: 70;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.success-message.is-visible {
  opacity: 1;
}

.success-card {
  position: relative;
  width: min(480px, 100%);
  padding: 48px 36px 40px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(168, 85, 247, 0.95), rgba(249, 115, 22, 0.95));
  color: #ffffff;
  text-align: center;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.success-message.is-visible .success-card {
  opacity: 1;
  transform: scale(1);
}

.success-card::before,
.success-card::after {
  content: '';
  position: absolute;
  inset: -30%;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.35), transparent 55%);
  opacity: 0;
  transform: rotate(0deg) scale(0.95);
  transition: opacity 0.35s ease;
  animation: success-glow 3.4s ease-in-out infinite;
}

.success-card::after {
  inset: -18%;
  background: radial-gradient(circle at 20% 20%, rgba(250, 204, 21, 0.6), transparent 60%);
  animation-delay: 1.2s;
}

.success-message.is-visible .success-card::before,
.success-message.is-visible .success-card::after {
  opacity: 1;
}

.success-emoji {
  font-size: clamp(3.2rem, 6vw, 4.6rem);
  margin-bottom: 14px;
  animation: success-bounce 1.4s ease-in-out infinite;
}

.success-title {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
  margin-bottom: 12px;
}

.success-subtitle {
  font-size: clamp(1.1rem, 2.6vw, 1.3rem);
  margin: 0 auto;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.92);
}

.success-close {
  margin-top: 28px;
  min-width: 200px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.35);
}

.success-close:focus-visible {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45), 0 16px 36px rgba(15, 23, 42, 0.35);
}

.success-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.success-particles span {
  position: absolute;
  font-size: 1.6rem;
  opacity: 0;
  filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.25));
  animation: success-confetti 3.2s ease-in-out infinite;
}

.success-particles span:nth-child(1) {
  top: 12%;
  left: 18%;
  animation-delay: 0s;
}

.success-particles span:nth-child(2) {
  top: 8%;
  right: 12%;
  animation-delay: 0.4s;
}

.success-particles span:nth-child(3) {
  bottom: 12%;
  left: 10%;
  animation-delay: 0.8s;
}

.success-particles span:nth-child(4) {
  bottom: 18%;
  right: 18%;
  animation-delay: 1.2s;
}

.success-particles span:nth-child(5) {
  top: 38%;
  left: 6%;
  animation-delay: 1.6s;
}

.success-particles span:nth-child(6) {
  top: 30%;
  right: 6%;
  animation-delay: 2s;
}

@keyframes success-bounce {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-14px) rotate(-6deg);
  }
}

@keyframes success-confetti {
  0% {
    transform: translateY(0) scale(0.85) rotate(-15deg);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translateY(28px) scale(1.1) rotate(12deg);
    opacity: 0;
  }
}

@keyframes success-glow {
  0%,
  100% {
    transform: rotate(0deg) scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: rotate(18deg) scale(1);
    opacity: 0.95;
  }
}

@media (max-width: 640px) {
  .success-message {
    padding: 16px;
  }

  .success-card {
    padding: 40px 24px 32px;
    border-radius: 24px;
  }

  .success-close {
    min-width: 0;
    width: 100%;
  }
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 3px;
  opacity: 0;
  animation: confettiFall var(--duration, 2.2s) ease-in forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(320px) rotate(180deg);
    opacity: 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 900px) {
  .layout {
    width: min(720px, 100% - 36px);
  }
}

@media (max-width: 720px) {
  .info-button {
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .layout {
    gap: 24px;
    width: min(680px, 100% - 28px);
  }

  .card {
    padding: 24px;
  }

  .guess-controls {
    grid-template-columns: 1fr;
  }

  .guess-controls .btn {
    width: 100%;
  }

  #guess {
    font-size: 1.05rem;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .action-buttons .btn {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .site-header {
    margin: 24px auto 18px;
    padding: 0 12px;
  }

  .logo {
    font-size: clamp(30px, 10vw, 38px);
  }

  .baseline {
    font-size: 0.88rem;
  }

  .layout {
    width: 100%;
    margin: 0 auto 64px;
    padding: 0 16px 60px;
  }

  input[type="text"] {
    font-size: 1rem;
    padding: 12px 14px;
  }

  button {
    padding: 10px 14px;
    font-size: 0.95rem;
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .guess-controls {
    gap: 10px;
  }

  .daily-slot-bar {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    padding: 0 4px 6px;
  }

  .daily-slot-bar::-webkit-scrollbar {
    height: 6px;
  }

  .daily-slot-btn {
    flex: 0 0 auto;
    margin-right: 0;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 22px 16px;
  }

  .guess-form {
    gap: 10px;
  }

  .status-pills {
    gap: 10px;
  }

  .toast-notification {
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 360px) {
  .status-pill {
    width: 100%;
    justify-content: space-between;
  }
}

/* =====================
   Sudoku page
   ===================== */
.sudoku-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(48px, 8vh, 96px);
}

.sudoku-main > .sudoku-shell {
  width: 100%;
}

.sudoku-shell {
  min-height: clamp(640px, 100vh, 880px);
  min-height: clamp(640px, 100svh, 880px);
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 4vw, 36px);
  padding: clamp(20px, 4vw, 36px);
  background: var(--bg);
}

.sudoku-card {
  width: min(96vw, 720px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.sudoku-sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
  min-width: 160px;
  max-width: 220px;
}

.sudoku-timer {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vw, 18px);
  width: 100%;
}

.sudoku-timer__header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sudoku-timer__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--accent-strong);
  font-size: 1.6rem;
}

.sudoku-timer__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sudoku-timer__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.sudoku-timer__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.sudoku-timer__value {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-strong);
  text-align: center;
}

.sudoku-card > p:not(.sudoku-feedback) {
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 1rem;
}

.sudoku-grid {
  width: min(92vw, 560px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.sudoku-grid .sudoku-cell {
  width: 100%;
  height: 100%;
  border: 1px solid #eef1f6;
  background: transparent;
  color: #1f2430;
  font: 600 clamp(1.1rem, 3vw, 1.6rem) / 1 "Inter", "Helvetica Neue", Arial, sans-serif;
  text-align: center;
  outline: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  caret-color: #5a8cff;
  position: relative;
}

.sudoku-grid .sudoku-cell:focus,
.sudoku-grid .sudoku-cell:focus-visible {
  outline: 3px solid rgba(90, 140, 255, 0.2);
  outline-offset: -3px;
  border-color: #b7c6ef;
}

.sudoku-grid .sudoku-cell[readonly] {
  color: #9aa3b1;
}

.sudoku-grid .sudoku-cell.given {
  background: rgba(90, 140, 255, 0.08);
  color: #2e3c5d;
}

.sudoku-grid .sudoku-cell.error {
  background: rgba(220, 76, 76, 0.12);
  border-color: #f0a5a5;
  box-shadow: inset 0 0 0 1px rgba(220, 76, 76, 0.3);
}

.sudoku-grid .sudoku-cell.solved {
  background: rgba(90, 140, 255, 0.12);
  color: #365fda;
  border-color: rgba(90, 140, 255, 0.4);
}

.sudoku-grid .sudoku-cell:nth-child(9n + 1),
.sudoku-grid .sudoku-cell:nth-child(9n + 4),
.sudoku-grid .sudoku-cell:nth-child(9n + 7) {
  border-left-width: 2px;
  border-left-color: #cfd7e6;
}

.sudoku-grid .sudoku-cell:nth-child(9n + 3),
.sudoku-grid .sudoku-cell:nth-child(9n + 6) {
  border-right-width: 0;
}

.sudoku-grid .sudoku-cell:nth-child(9n) {
  border-right-width: 2px;
  border-right-color: #cfd7e6;
}

.sudoku-grid .sudoku-cell:nth-child(-n + 9) {
  border-top-width: 2px;
  border-top-color: #cfd7e6;
}

.sudoku-grid .sudoku-cell:nth-child(n + 28):nth-child(-n + 36),
.sudoku-grid .sudoku-cell:nth-child(n + 55):nth-child(-n + 63) {
  border-top-width: 2px;
  border-top-color: #cfd7e6;
}

.sudoku-grid .sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-grid .sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-width: 0;
}

.sudoku-grid .sudoku-cell:nth-child(n + 73) {
  border-bottom-width: 2px;
  border-bottom-color: #cfd7e6;
}

.toolbar {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.sudoku-feedback {
  min-height: 1.5em;
  margin: 14px 0 0;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s ease;
}

.sudoku-feedback.is-success {
  color: var(--ok);
}

.sudoku-feedback.is-error {
  color: var(--hot);
}

.sudoku-insights {
  width: min(1080px, 100%);
  margin: 0 auto clamp(64px, 10vw, 120px);
  padding: clamp(32px, 6vw, 48px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: clamp(20px, 3vw, 28px);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: clamp(28px, 5vw, 40px);
}

.insights-header {
  display: grid;
  gap: 12px;
  text-align: center;
}

.insights-header h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  color: var(--text);
}

.insights-lede {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--muted);
}

.insights-grid {
  display: grid;
  gap: clamp(20px, 4vw, 28px);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.insights-block {
  background: var(--bg);
  border-radius: 20px;
  padding: clamp(20px, 3vw, 26px);
  border: 1px solid rgba(53, 88, 208, 0.12);
  display: grid;
  gap: 12px;
}

.insights-block h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3.8vw, 1.45rem);
  color: var(--accent-strong);
}

.insights-block p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text);
}

.insights-link {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.insights-link:hover,
.insights-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.sudoku-notes {
  margin-top: clamp(32px, 6vw, 52px);
  display: grid;
  gap: 18px;
}

.sudoku-notes h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  color: var(--text);
}

.sudoku-notes p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--muted);
}

.sudoku-notes strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-weight: 600;
}

@media (max-width: 720px) {
  .sudoku-insights {
    border-radius: 20px;
    padding: clamp(24px, 8vw, 36px);
  }

  .insights-header {
    text-align: left;
  }
}

@media (prefers-color-scheme: dark) {
  .sudoku-insights {
    background: rgba(15, 18, 34, 0.92);
    border-color: rgba(112, 125, 173, 0.36);
  }

  .insights-block {
    background: rgba(26, 32, 64, 0.65);
    border-color: rgba(126, 148, 255, 0.18);
  }

}

@media (max-width: 600px) {
  .sudoku-shell {
    flex-direction: column;
    align-items: center;
    min-height: auto;
    padding: clamp(24px, 6vw, 32px);
  }

  .sudoku-card {
    width: min(96vw, 680px);
    padding: 20px;
  }

  .sudoku-sidebar {
    width: 100%;
    max-width: none;
    align-items: center;
  }

  .sudoku-timer {
    width: min(240px, 100%);
  }

  .sudoku-grid {
    width: min(94vw, 520px);
  }

  .sudoku-main {
    gap: clamp(40px, 12vw, 72px);
  }

  .sudoku-insights {
    margin: 0 auto clamp(48px, 12vw, 80px);
    padding: clamp(24px, 8vw, 36px);
  }
}

@media (max-width: 420px) {
  .toolbar {
    width: 100%;
  }

  .toolbar .btn {
    flex: 1 1 calc(50% - 10px);
  }
}

/* =====================
   Admin page
   ===================== */
.admin-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: clamp(36px, 6vw, 72px) clamp(16px, 6vw, 72px) 72px;
}

.admin-card {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  border: 1px solid rgba(209, 213, 230, 0.55);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
  padding: clamp(24px, 5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-card h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 720px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-label {
  font-weight: 600;
  color: var(--muted);
}

.admin-help {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(30, 35, 52, 0.7);
}

.admin-input {
  border: 1px solid rgba(30, 35, 52, 0.1);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 -3px 0 rgba(53, 88, 208, 0.08);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.admin-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 88, 208, 0.22);
}

.admin-output {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(53, 88, 208, 0.08);
  border: 1px solid rgba(53, 88, 208, 0.15);
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 600px) {
  .admin-wrapper {
    padding: clamp(24px, 8vw, 48px) clamp(16px, 6vw, 36px) 56px;
  }

  .admin-card {
    border-radius: 22px;
  }
}
