/* ==========================================================================
   Kalimat web — Ink & Saffron design system
   One stylesheet for the whole site. Same palette, type, radii and component
   language as the mobile app (see the design canvas, boards W0–W5).

   Sections
     1. Fonts
     2. Tokens (light + dark)
     3. Base / reset
     4. Layout primitives
     5. Typography helpers
     6. Icons
     7. Buttons
     8. Forms
     9. Chips + segmented control
    10. Cards, badges, alerts, stats
    11. Site header, menus, footer
    12. Page sections (page head, prose, empty states, error)
    13. Daily calendar
    14. Home
    15. Puzzle lists (My puzzles)
    16. Play
    17. Auth shell
    18. Profile
    19. Dialogs (SweetAlert2 theme)
    20. Utilities
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face { font-family: "Plex Arabic"; src: url("../fonts/kalimat/IBMPlexSansArabic-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/kalimat/IBMPlexSansArabic-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/kalimat/IBMPlexSansArabic-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/kalimat/IBMPlexSansArabic-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Reem Kufi"; src: url("../fonts/kalimat/ReemKufi-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* 2. Tokens --------------------------------------------------------------- */
:root {
  /* Palette (fixed) */
  --ink-900: #0E2A2B;
  --ink-800: #17393A;
  --ink-700: #24494A;
  --ink-600: #3A5A5B;
  --teal-700: #13585A;
  --teal-300: #5FB8B0;
  --teal-50: #E6F0EE;
  --saffron-400: #F0A830;
  --saffron-300: #F0C46A;
  --saffron-100: #FCEBC8;
  --saffron-600: #B86E00;
  --saffron-ink: #7A4A00;
  --ember-600: #C2410C;
  --ember-100: #FDE4D8;
  --ember-ink: #9A3412;
  --on-ink: #FFFFFF;
  --on-ink-muted: #B9C9C7;
  --on-ink-line: #3A5A5B;

  /* Semantic (theme-aware) */
  --bg: #F5F6F3;
  --surface: #FFFFFF;
  --surface-2: #F0F2F1;
  --surface-3: #E8ECEA;
  --border: #DCE2DF;
  --border-soft: #E8ECEA;
  --field-border: #C9D1CE;
  --text: #0E2A2B;
  --text-2: #3D4F4E;
  --muted: #5B6B6A;
  --faint: #8A9695;
  --primary: #13585A;
  --primary-hover: #0F4749;
  --on-primary: #FFFFFF;
  --primary-soft: #E6F0EE;
  --accent: #F0A830;
  --accent-hover: #E39A1C;
  --on-accent: #0E2A2B;
  --accent-soft: #FCEBC8;
  --accent-text: #7A4A00;
  --danger: #C2410C;
  --danger-soft: #FDE4D8;
  --danger-text: #9A3412;
  --hero: #0E2A2B;
  --hero-2: #24494A;
  --focus: #F0A830;
  --shadow-sm: 0 1px 2px rgba(14, 42, 43, 0.08);
  --shadow-md: 0 8px 24px rgba(14, 42, 43, 0.08);
  --shadow-lg: 0 24px 60px rgba(14, 42, 43, 0.28);

  /* Board */
  --board-line: #0E2A2B;
  --cell: #FFFFFF;
  --cell-black: #0E2A2B;
  --cell-word: #FCEBC8;
  --cell-cursor: #F0A830;
  --cell-text: #0E2A2B;
  --cell-num: #5B6B6A;

  /* Type */
  --font-sans: "Plex Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Reem Kufi", "Plex Arabic", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Shape + space */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;
  --gutter: 24px;
  --container: 1200px;
  --container-wide: 1400px;
  --header-h: 72px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1516;
    --surface: #132223;
    --surface-2: #1A2C2D;
    --surface-3: #1D3132;
    --border: #24393A;
    --border-soft: #1D3132;
    --field-border: #345051;
    --text: #EEF3F1;
    --text-2: #C9D6D4;
    --muted: #9FB0AE;
    --faint: #7E908E;
    --primary: #5FB8B0;
    --primary-hover: #74C7BF;
    --on-primary: #0B1516;
    --primary-soft: #1D3132;
    --accent-soft: #3A3320;
    --accent-text: #F0C46A;
    --danger: #F07A4A;
    --danger-soft: #3A2219;
    --danger-text: #F5A27E;
    --hero: #132223;
    --hero-2: #24393A;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --board-line: #000000;
    --cell: #1D3132;
    --cell-black: #050B0B;
    --cell-word: #3A3320;
    --cell-text: #EEF3F1;
    --cell-num: #9FB0AE;
    color-scheme: dark;
  }
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { display: block; flex: 1 0 auto; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; }
img, svg { display: block; max-width: 100%; }
svg { flex: none; }
table { border-collapse: collapse; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--text); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--saffron-100); color: var(--ink-900); }

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.skip-link:focus { top: 12px; color: var(--on-accent); }

/* 4. Layout primitives ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: 820px; }

.page { padding-block: 40px 72px; }

.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }

/* Two-up row that stacks: main column + side column */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, 24px);
  align-items: var(--align, stretch);
}
.split > .split__main { flex: 999 1 560px; min-width: 0; }
.split > .split__side { flex: 1 1 320px; min-width: 0; }

.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 300px), 100%), 1fr));
  gap: var(--gap, 24px);
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .page { padding-block: 24px 48px; }
}

/* 5. Typography helpers --------------------------------------------------- */
.display { font-family: var(--font-display); font-weight: 700; line-height: 1.15; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent-text); letter-spacing: 0.02em; }
.title-xl { font-size: clamp(28px, 4vw, 34px); }
.title-lg { font-size: clamp(22px, 3vw, 26px); }
.title-md { font-size: 20px; }
.title-sm { font-size: 17px; }
.lead { font-size: 17px; color: var(--muted); line-height: 1.7; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.xsmall { font-size: 13px; }
.num-ltr { direction: ltr; unicode-bidi: isolate; }

/* 6. Icons ---------------------------------------------------------------- */
.icon {
  width: 1.15em;
  height: 1.15em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icon--fill { fill: currentColor; }
.icon--lg { width: 24px; height: 24px; }
[dir="rtl"] .icon--flip { transform: scaleX(-1); }

/* 7. Buttons -------------------------------------------------------------- */
.btn {
  --btn-h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); color: var(--on-primary); }

.btn--accent { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn--accent:hover { background: var(--accent-hover); color: var(--on-accent); }

.btn--outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn--outline:hover { background: var(--primary-soft); color: var(--primary); }

.btn--quiet { border-color: var(--border); background: var(--surface); }
.btn--quiet:hover { border-color: var(--field-border); background: var(--surface-2); color: var(--text); }

.btn--ghost { background: transparent; color: var(--primary); padding-inline: 12px; }
.btn--ghost:hover { background: var(--primary-soft); color: var(--primary); }

.btn--danger { background: var(--danger); color: #FFFFFF; }
.btn--danger:hover { filter: brightness(0.95); color: #FFFFFF; }
.btn--danger-text { color: var(--danger); }

/* On dark (ink) surfaces */
.btn--on-ink { border-color: var(--on-ink-line); color: var(--on-ink); background: transparent; }
.btn--on-ink:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-ink); }

.btn--sm { --btn-h: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn--lg { --btn-h: 56px; padding: 0 28px; font-size: 17px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--btn-h); }

.btn .spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-inline-end-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 8. Forms ---------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 220px), 100%), 1fr));
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 14px; font-weight: 600; color: var(--text); }
.field__hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.field__error, .field-validation-error { font-size: 13px; font-weight: 600; color: var(--danger); }
.field-validation-valid { display: none; }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* ≥16px: no iOS zoom on focus */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { padding: 12px 14px; min-height: 104px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6B6A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}
[dir="ltr"] .select { background-position: right 14px center; }

.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input.input-validation-error, .select.input-validation-error, .textarea.input-validation-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.input[readonly] { background: var(--surface-2); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  line-height: 1.6;
  cursor: pointer;
}
.check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 9. Chips + segmented ---------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.chip:hover > span { border-color: var(--faint); }
.chip > input:checked + span {
  border: 1.5px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.chip > input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip--sm > span { min-height: 40px; padding: 0 14px; font-size: 14px; }
.chip > input:checked + span .muted { color: inherit; opacity: 0.75; }

.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-3);
}
.segmented label { position: relative; display: flex; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented > label > span, .segmented > a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 15px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}
.segmented > label > input:checked + span, .segmented > a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.segmented > label > input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.segmented > a:hover { color: var(--text); }

/* 10. Cards, badges, alerts, stats --------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad, 28px);
  min-width: 0;
}
.card--lg { border-radius: var(--r-xl); }
.card--flush { padding: 0; overflow: hidden; }
.card--ink {
  background: var(--hero);
  border-color: transparent;
  color: var(--on-ink);
}
.card--ink .muted { color: var(--on-ink-muted); }
.card--sun { background: var(--accent-soft); border-color: transparent; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) { .card { --pad: 20px; } }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
}
.badge--done { background: var(--teal-700); color: #FFFFFF; }
.badge--star { background: var(--saffron-400); color: var(--ink-900); }
.badge--progress { background: var(--primary-soft); color: var(--primary); }
.badge--accent { background: var(--saffron-400); color: var(--ink-900); }
.badge--warn { background: var(--accent-soft); color: var(--accent-text); }
.badge--danger { background: var(--danger-soft); color: var(--danger-text); }
.badge--on-ink { background: rgba(255, 255, 255, 0.12); color: var(--on-ink); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.6;
  background: var(--surface-2);
  color: var(--text);
}
.alert .icon { margin-top: 2px; }
.alert--success { background: var(--primary-soft); color: var(--primary); }
.alert--error { background: var(--danger-soft); color: var(--danger-text); }
.alert--warn { background: var(--accent-soft); color: var(--accent-text); }

.stats { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  min-width: 0;
}
.stat__value { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat__label { font-size: 12px; color: var(--muted); }
.card--ink .stat { background: var(--hero-2); }
.card--ink .stat__label { color: var(--on-ink-muted); }

.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

/* 11. Site header, menus, footer ----------------------------------------- */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: inherit;
}
.brand:hover { color: inherit; }
.brand__dot {
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  border-radius: 2px;
  background: var(--saffron-400);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ink-900);
  color: var(--on-ink);
}
.site-header__bar {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  color: var(--on-ink-muted);
  font-size: 15px;
}
.site-nav__link:hover { color: var(--on-ink); background: rgba(255, 255, 255, 0.06); }
.site-nav__link[aria-current="page"] { color: var(--on-ink); background: rgba(255, 255, 255, 0.1); font-weight: 600; }
.site-nav__extra { display: none; }

.site-header__actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.site-header .btn--sm { --btn-h: 42px; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-ink);
  align-items: center;
  justify-content: center;
}

/* Account menu (details/summary) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 6px;
  padding-inline-end: 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.account-btn:hover { background: rgba(255, 255, 255, 0.14); }
.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-700);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 15px;
}
.avatar--accent { background: var(--saffron-400); color: var(--ink-900); }
.avatar--xl { width: 80px; height: 80px; font-size: 34px; }
.account-btn__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 15px;
}
.menu__item:hover { background: var(--surface-2); color: var(--text); }
.menu__item .icon { color: var(--muted); }
.menu__item--danger, .menu__item--danger .icon { color: var(--danger); }
.menu__sep { height: 1px; margin: 6px 4px; background: var(--border-soft); }
.menu__head { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
  .site-header__bar { gap: 12px; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    flex-direction: column;
    gap: 2px;
    padding: 8px var(--gutter) 16px;
    background: var(--ink-900);
    border-top: 1px solid var(--ink-700);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
  }
  .site-header.is-open .site-nav { display: flex; }
  .site-nav__link { min-height: 48px; font-size: 16px; }
  .site-nav__extra { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--ink-700); }
  .hide-mobile-nav { display: none !important; }
}
@media (max-width: 420px) {
  .brand { font-size: 26px; }
  .account-btn__name { display: none; }
  .account-btn { padding-inline-end: 6px; }
}

.site-footer { background: var(--ink-900); color: var(--on-ink-muted); margin-top: auto; }
.site-footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  padding-block: 36px;
}
.site-footer .brand { font-size: 24px; color: var(--on-ink); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; }
.site-footer__links a { color: #DCE6E4; display: inline-flex; min-height: 44px; align-items: center; }
.site-footer__links a:hover { color: #FFFFFF; }

/* 12. Page sections -------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.prose { font-size: 17px; line-height: 1.85; color: var(--text-2); }
.prose > * + * { margin-top: 14px; }
.prose h2 { margin-top: 36px; font-size: 20px; color: var(--text); }
.prose ul { padding-inline-start: 22px; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--saffron-600); }
.prose strong { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

.legal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.legal-head__icon {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--saffron-600);
}
.legal-head__icon .icon { width: 28px; height: 28px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 24px;
  text-align: center;
}
.empty__art {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.empty__art .icon { width: 34px; height: 34px; }

.error-page { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding-block: 72px; }
.error-page__art {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger-soft);
  color: var(--danger);
  transform: rotate(-6deg);
}
.error-page__art .icon { width: 42px; height: 42px; }
/* A row of equal-width actions (error / empty states); stacks full-width on phones */
.action-row {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  width: 100%;
  max-width: 560px;
}
.action-row > .btn { width: 100%; }
@media (max-width: 520px) { .action-row { grid-auto-flow: row; max-width: 360px; } }

.code { font-family: var(--font-mono); font-size: 13px; padding: 2px 8px; border-radius: var(--r-xs); background: var(--surface-3); }

/* Decorative letter grid (brand art): equal rows + columns → square cells */
.letter-grid {
  --n: 5;
  width: var(--size, 220px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-radius: 18px;
  background: var(--ink-700);
}
.letter-grid > span {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #FFFFFF;
  color: var(--ink-900);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--size, 220px) / var(--n) * 0.48);
  line-height: 1;
  overflow: hidden;
}
.letter-grid > .b { background: var(--ink-900); }
.letter-grid > .s { background: var(--saffron-400); }
.letter-grid > .e { background: #E8ECEA; }

/* 13. Daily calendar -------------------------------------------------------- */
.cal { display: flex; flex-direction: column; gap: 16px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cal__title { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.cal__month { font-size: 18px; }
.cal__summary { font-size: 13px; color: var(--muted); }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--cal-gap, 8px); }
.cal__dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 2px; }

.cal-day {
  position: relative;
  /* Square, never wider than its column (so neighbours never touch), centred in it */
  width: 100%;
  max-width: 44px;
  aspect-ratio: 1;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
a.cal-day:hover { color: inherit; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cal-day.is-done { background: var(--teal-700); color: #FFFFFF; }
.cal-day.is-done:hover { color: #FFFFFF; }
.cal-day.is-progress { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-day.is-future { background: transparent; color: var(--faint); font-weight: 500; }
.cal-day.is-today { box-shadow: inset 0 0 0 2.5px var(--saffron-400); }
.cal-day.is-today.is-open { background: var(--surface); color: var(--text); }
.cal-day__mark { width: 13px; height: 13px; stroke-width: 3; }
.cal-day__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Legend: miniature day boxes with exactly the grid's fills, marks and rings */
.cal__legend {
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.cal__legend li { display: inline-flex; align-items: center; gap: 8px; }
.cal-key {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.cal-key .icon { width: 13px; height: 13px; stroke-width: 3; }
.cal-key .cal-day__dot { width: 5px; height: 5px; }
.cal-key.is-done { background: var(--teal-700); color: #FFFFFF; }
.cal-key.is-progress { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-key.is-open { background: var(--surface-2); }
.cal-key.is-today { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--saffron-400); }
.cal-key.is-future { background: transparent; color: var(--faint); font-weight: 500; font-size: 12px; }
.cal--lg .cal__legend { gap: 10px 24px; font-size: 14px; }
.cal--lg .cal-key { width: 28px; height: 28px; border-radius: 8px; }

.cal--lg { --cal-gap: 8px; }
.cal--lg .cal__month { font-size: 22px; }
.cal--lg .cal__summary { font-size: 14px; }
.cal--lg .cal-day { max-width: none; aspect-ratio: auto; height: 72px; font-size: 18px; border-radius: 14px; gap: 4px; }
.cal--lg .cal-day__mark { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .cal--lg { --cal-gap: 5px; }
  .cal--lg .cal-day { height: auto; aspect-ratio: 1; font-size: 15px; border-radius: 10px; }
  .cal--lg .cal__dow { font-size: 11px; }
}
@media (max-width: 360px) {
  .cal { --cal-gap: 4px; }
  .cal-day { font-size: 13px; border-radius: 9px; }
  .cal__dow { font-size: 10px; }
}

/* 14. Home ----------------------------------------------------------------- */
.greeting { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.greeting__hello { font-size: 16px; color: var(--muted); }

.daily-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  padding: 36px;
  border-radius: var(--r-xl);
  background: var(--hero);
  color: var(--on-ink);
  overflow: hidden;
}
.daily-hero__body { flex: 1 1 300px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.daily-hero__date { font-family: var(--font-display); font-size: clamp(34px, 5vw, 48px); font-weight: 700; line-height: 1.15; }
.daily-hero__meta { font-size: 16px; color: var(--on-ink-muted); }
.daily-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.daily-hero__note { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--on-ink-muted); }
.daily-hero__note .icon { color: var(--saffron-400); }
.daily-hero__art { flex: none; transform: rotate(-4deg); }
.daily-hero .letter-grid { --size: 220px; }
@media (max-width: 640px) {
  .daily-hero { padding: 24px; gap: 20px; border-radius: var(--r-lg); }
  .daily-hero__art { display: none; }
  .daily-hero__actions .btn { flex: 1 1 auto; }
}

.create-card .field__label { font-size: 15px; font-weight: 700; }
.create-card .segmented { max-width: 520px; }
.create-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
@media (max-width: 640px) { .create-card__foot .btn { width: 100%; } }

.resume-list { display: flex; flex-direction: column; gap: 10px; }
.resume-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.resume-item:hover { color: var(--text); border-color: var(--field-border); box-shadow: var(--shadow-md); }
.size-tile {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.size-tile--daily { background: var(--accent-soft); color: var(--saffron-600); }
.resume-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.resume-item__title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-item__meta { font-size: 12px; color: var(--muted); }
.resume-item > .icon { color: var(--faint); }

.guest-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  border-radius: var(--r-xl);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.guest-band__text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 380px; min-width: 0; }
.guest-band__title { font-size: 20px; font-weight: 700; color: var(--text); }
@media (prefers-color-scheme: dark) { .guest-band__title { color: var(--saffron-300); } }
@media (max-width: 640px) { .guest-band { padding: 22px; border-radius: var(--r-lg); } .guest-band .btn { width: 100%; } }

/* 15. Puzzle lists ----------------------------------------------------------- */
.tabs-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.tabs-bar .segmented { min-width: 280px; }
.tabs-bar .segmented a { min-height: 44px; padding: 0 20px; }

.puzzle-table { width: 100%; font-size: 15px; }
.puzzle-table th {
  padding: 12px 16px;
  text-align: start;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.puzzle-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.puzzle-table tr:last-child td { border-bottom: 0; }
.puzzle-table tbody tr { transition: background-color 0.15s ease; }
.puzzle-table tbody tr:hover { background: var(--surface-2); }
.puzzle-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.puzzle-cell .size-tile { width: 44px; height: 44px; font-size: 16px; }
.puzzle-cell__title { font-weight: 600; }
.puzzle-table .progress { width: 140px; }
.puzzle-table__action { text-align: end; }

/* Below 760px each row becomes a card */
@media (max-width: 760px) {
  .puzzle-table, .puzzle-table tbody, .puzzle-table tr, .puzzle-table td { display: block; }
  .puzzle-table thead { display: none; }
  .puzzle-table tbody { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
  .puzzle-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
  }
  .puzzle-table tbody tr:hover { background: transparent; }
  .puzzle-table td { padding: 0; border: 0; }
  .puzzle-table td.puzzle-table__main { grid-column: 1 / -1; }
  .puzzle-table td.puzzle-table__level, .puzzle-table td.puzzle-table__date { display: none; }
  .puzzle-table td.puzzle-table__progress { grid-column: 1 / -1; }
  .puzzle-table .progress { width: 100%; }
  .puzzle-table__action { text-align: start; }
}
.puzzle-cell__sub { display: none; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .puzzle-cell__sub { display: block; } }

/* 16. Play ----------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.pill--teal { background: var(--primary-soft); color: var(--primary); }
.pill--sun { background: var(--accent-soft); color: var(--accent-text); }

.play-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
.play-bar__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "title stats tools";
  align-items: center;
  gap: 10px 16px;
  min-height: 68px;
  padding-block: 10px;
}
.play-bar__title { grid-area: title; display: flex; align-items: center; gap: 12px; min-width: 0; }
.play-bar__brand { font-size: 26px; color: var(--text); padding-inline-end: 12px; border-inline-end: 1px solid var(--border); }
.play-bar__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.play-bar__heading { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-bar__meta { font-size: 13px; color: var(--muted); }
.play-bar__stats { grid-area: stats; display: flex; gap: 8px; }
.play-bar__tools { grid-area: tools; display: flex; gap: 8px; }
.play-progress { height: 3px; background: var(--surface-3); }
.play-progress > span { display: block; width: 0; height: 100%; background: var(--primary); transition: width 0.3s ease; }

@media (max-width: 1180px) { .play-bar__brand { display: none; } }
@media (max-width: 980px) {
  .play-bar__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title stats" "tools tools"; }
  .play-bar__tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .play-bar__tools .btn { padding: 0 8px; }
}
@media (max-width: 480px) {
  .play-bar__row { grid-template-areas: "title title" "stats stats" "tools tools"; }
  .play-bar__stats .pill { min-height: 32px; font-size: 13px; }
  .play-bar__tools .btn { font-size: 13px; gap: 4px; }
}

.play-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; padding-block: 24px 56px; }
.play-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.play-main > * { width: 100%; max-width: 780px; }
.play-main__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.play-main__top .segmented { min-width: 0; }
.play-main__hint { font-size: 13px; color: var(--muted); }
@media (hover: none) { .play-main__hint { display: none; } }

.completed-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--hero);
  color: var(--on-ink);
}
.completed-card__icon {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--saffron-400);
  color: var(--ink-900);
  transform: rotate(-6deg);
}
.completed-card__icon .icon { width: 26px; height: 26px; }
.completed-card__text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.completed-card__text strong { font-size: 17px; }
.completed-card__text span { font-size: 14px; color: var(--on-ink-muted); }
.completed-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.clue-bar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: var(--accent-soft);
  box-shadow: 0 6px 18px rgba(14, 42, 43, 0.08);
}
.clue-bar__nav {
  width: 44px;
  height: 52px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.clue-bar__nav:hover { background: #FFFFFF; }
.clue-bar__body {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px;
}
.clue-bar__label { font-size: 13px; font-weight: 700; color: var(--accent-text); }
.clue-bar__text { font-size: 17px; font-weight: 500; line-height: 1.45; }
@media (prefers-color-scheme: dark) {
  .clue-bar__nav { background: rgba(255, 255, 255, 0.08); }
  .clue-bar__nav:hover { background: rgba(255, 255, 255, 0.14); }
}
@media (max-width: 480px) {
  .clue-bar__nav { width: 38px; height: 48px; }
  .clue-bar__text { font-size: 16px; }
}

/* Board: cell size follows the board's own width (container query units) */
.board-wrap { container-type: inline-size; overflow-x: auto; padding-bottom: 4px; }
.play-board {
  --hdr: 1;
  --cell: clamp(24px, calc((100cqi - 4px) / (var(--cols) + 1.2 * var(--hdr))), 52px);
  width: max-content;
  margin-inline: auto;
  border-collapse: collapse;
  user-select: none;
}
.play-board.display-cell { --hdr: 0; }
.play-board td {
  position: relative;
  width: var(--cell);
  min-width: var(--cell);
  height: var(--cell);
  padding: 0;
  border: 1px solid var(--board-line);
  background: var(--cell);
  text-align: center;
  vertical-align: middle;
}
.play-board td.black { background: var(--cell-black); }
.play-board td.header {
  width: calc(var(--cell) * 0.6);
  min-width: calc(var(--cell) * 0.6);
  height: calc(var(--cell) * 0.6);
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: max(10px, calc(var(--cell) * 0.32));
  font-weight: 700;
}
.play-board.display-cell td.header { display: none; }
.play-board .clue-number {
  display: none;
  position: absolute;
  top: 2px;
  inset-inline-start: 3px;
  font-size: max(8px, calc(var(--cell) * 0.24));
  font-weight: 600;
  line-height: 1;
  color: var(--cell-num);
  pointer-events: none;
}
.play-board.display-cell .clue-number { display: block; }
.play-board td.in-slot { background: var(--cell-word); }
.play-board td.active { background: var(--cell-cursor); box-shadow: inset 0 0 0 2px var(--ink-900); }
.play-board td.active input, .play-board td.active .clue-number { color: var(--ink-900); }
.play-board input {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--cell-text);
  font-family: var(--font-sans);
  font-size: calc(var(--cell) * 0.56);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  caret-color: transparent;
}
.play-board input.wrong { color: var(--danger); background: var(--danger-soft); }
.play-board input.revealed-flash { color: var(--primary); }
.play-board td.active input.revealed-flash { color: var(--teal-700); }

/* Clue lists */
.play-clues {
  flex: 1 1 340px;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  align-items: start;
}
@media (min-width: 1000px) { .play-clues { position: sticky; top: 16px; } }
.clue-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.clue-card__title { display: flex; align-items: center; gap: 8px; padding: 0 10px 8px; font-size: 17px; }
.clue-card__key { width: 8px; height: 8px; border-radius: 2px; background: var(--saffron-400); }
.clue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(560px, calc(100vh - 200px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 999px) { .clue-list { max-height: 340px; } }
.play-clue, .play-clue-group {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.65;
}
.play-clue { cursor: pointer; }
.play-clue:hover { background: var(--surface-2); }
.play-clue.active { background: var(--cell-word); }
.play-clue .num, .play-clue-group .num { flex: none; min-width: 22px; font-weight: 700; color: var(--primary); }
.play-clue.active .num { color: var(--accent-text); }
.clue-text { flex: 1; min-width: 0; }
.clue-len { color: var(--muted); font-size: 13px; white-space: nowrap; }
.clue-sep { color: var(--faint); }
.play-clue-seg { cursor: pointer; padding: 1px 4px; border-radius: 6px; }
.play-clue-seg:hover { background: var(--surface-2); }
.play-clue-seg.active { background: var(--cell-word); font-weight: 600; }

/* 17. Auth shell ------------------------------------------------------------ */
.auth { display: flex; flex-wrap: wrap; min-height: 100vh; }
.auth__panel {
  flex: 1 1 420px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px;
  background: var(--ink-900);
  color: var(--on-ink);
}
.auth__panel .brand { font-size: 34px; align-self: flex-start; }
.auth__pitch { display: flex; flex-direction: column; gap: 28px; max-width: 460px; }
.auth__art { transform: rotate(-4deg); align-self: flex-start; }
.auth__headline { font-family: var(--font-display); font-size: clamp(30px, 3.2vw, 40px); font-weight: 700; line-height: 1.25; }
.auth__benefits { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 16px; color: #DCE6E4; }
.auth__benefits li { display: flex; align-items: center; gap: 10px; }
.auth__benefits .icon { color: var(--saffron-400); stroke-width: 2.4; }
.auth__foot { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13px; }
.auth__foot a { color: var(--on-ink-muted); display: inline-flex; min-height: 44px; align-items: center; }
.auth__foot a:hover { color: var(--on-ink); }

.auth__main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--gutter);
}
.auth__form { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 24px; }
.auth__form--wide { max-width: 620px; }
.auth__back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding-inline-end: 8px;
  font-size: 14px;
  font-weight: 600;
}
.auth__email {
  align-self: flex-start;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding-inline: 12px 6px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}
.auth__email .num-ltr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth__email a {
  flex: none;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 13px;
}
.auth__guest { align-self: center; display: inline-flex; min-height: 44px; align-items: center; font-size: 15px; font-weight: 600; }

/* Phones / narrow tablets: the brand panel becomes a compact top bar */
@media (max-width: 860px) {
  .auth { flex-direction: column; flex-wrap: nowrap; }
  .auth__panel { flex: none; flex-direction: row; align-items: center; padding: 16px var(--gutter); gap: 16px; }
  .auth__panel .brand { font-size: 28px; }
  .auth__pitch, .auth__foot { display: none; }
  .auth__main { align-items: flex-start; padding-block: 28px 48px; }
}

.form-row--name { grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 560px) {
  .form-row--name { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form-row--name > :first-child { grid-column: 1 / -1; }
}

/* Searchable picker (country) */
.combo { position: relative; }
.combo__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
  cursor: pointer;
}
.combo__toggle .is-placeholder { color: var(--faint); }
.combo__toggle .country-dropdown-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo.is-open .combo__toggle { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.combo__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  inset-inline: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.combo__search { position: relative; }
.combo__search .icon { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.combo__search .input { min-height: 44px; padding-inline-start: 38px; }
.combo__list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.combo__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text);
}
.combo__option:hover, .combo__option:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.combo__option[aria-selected="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.combo__empty { padding: 12px; font-size: 14px; color: var(--muted); text-align: center; }
.iti__flag { flex: none; }
.iti__flag.is-empty { display: none; }

/* 18. Profile --------------------------------------------------------------- */
.profile-nav { --pad: 10px; display: flex; flex-direction: column; gap: 2px; flex-basis: 240px; }
.profile-nav .menu__item[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.profile-nav .menu__item[aria-current="page"] .icon { color: var(--primary); }
@media (max-width: 880px) {
  .profile-nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .profile-nav .menu__sep { display: none; }
  .profile-nav .menu__item { flex: 1 1 auto; justify-content: center; }
}

.identity { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.identity__who { display: flex; align-items: center; gap: 18px; min-width: 0; }
.identity__email { overflow-wrap: anywhere; }
.identity__since { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: var(--r-md); background: var(--hero-2); }
@media (max-width: 480px) { .avatar--xl { width: 64px; height: 64px; font-size: 28px; } }

.kv { margin: 0; }
.kv__row {
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  gap: 6px 16px;
  padding-block: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.kv__row:last-child { border-bottom: 0; }
.kv dt { font-size: 14px; color: var(--muted); }
.kv dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv__row { grid-template-columns: minmax(0, 1fr); } }

/* 19. Dialogs (SweetAlert2 theme) ----------------------------------------- */
.swal2-container { padding: 16px; }
.swal2-container.swal2-backdrop-show { background: rgba(11, 21, 22, 0.55); }
.swal2-container .k-dialog.swal2-popup {
  width: min(440px, 100%);
  padding: 28px 24px 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  direction: rtl;
  box-shadow: var(--shadow-lg);
}
.swal2-container .k-dialog .k-dialog__title {
  padding: 0;
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.4;
}
.swal2-container .k-dialog .k-dialog__body {
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.swal2-container .k-dialog .k-dialog__actions {
  width: 100%;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: stretch;
}
/* SweetAlert2 sets an inline display:block on each visible button — !important is the only
   way to keep icon + label on one line. Hidden buttons get display:none inline and stay hidden
   because [style*="none"] is excluded. */
.swal2-container .k-dialog .k-dialog__actions .btn:not([style*="none"]) { display: inline-flex !important; }
.swal2-container .k-dialog .k-dialog__actions .btn { align-items: center; justify-content: center; gap: 8px; flex: 1 1 140px; margin: 0; }
.swal2-container .k-dialog .k-dialog__actions .btn .icon { width: 18px; height: 18px; }
.swal2-container .k-dialog .swal2-icon { margin: 0 auto 16px; transform: scale(0.82); }
.swal2-container .k-dialog .swal2-icon.swal2-success { border-color: var(--teal-300); color: var(--primary); }
.swal2-container .k-dialog .swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: var(--primary); }
.swal2-container .k-dialog .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(95, 184, 176, 0.35); }
.swal2-container .k-dialog .swal2-icon.swal2-error { border-color: var(--danger); }
.swal2-container .k-dialog .swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color: var(--danger); }
.swal2-container .k-dialog .swal2-icon.swal2-info, .swal2-container .k-dialog .swal2-icon.swal2-question { border-color: var(--teal-300); color: var(--primary); }
.swal2-container .k-dialog .swal2-icon.swal2-warning { border-color: var(--saffron-400); color: var(--saffron-600); }
.swal2-container .k-dialog .swal2-icon.k-dialog__icon--brand {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--saffron-600);
  transform: none;
}
.swal2-container .k-dialog .swal2-icon.k-dialog__icon--brand .swal2-icon-content { font-size: inherit; }
.swal2-container .k-dialog .swal2-icon.k-dialog__icon--brand .icon { width: 30px; height: 30px; }
.swal2-container .k-dialog .swal2-close { color: var(--muted); }
.swal2-container .k-toast.swal2-popup {
  border-radius: var(--r-md);
  background: var(--ink-900);
  color: var(--on-ink);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-md);
}
.swal2-container .k-toast .swal2-title { color: var(--on-ink); font-size: 15px; }

/* 20. Utilities ------------------------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.w-100 { width: 100%; }
.mt-auto { margin-top: auto; }
