/* Tokens, dark mode, layout and the pieces every screen uses. Each screen has its own file beside this one. */

:root {
  --bg: #FAF6F1;
  --surface: #FFFFFF;
  --surface-2: #F4EDE5;
  --ink: #241E19;
  --muted: #6F665D;
  --line: #E7DED3;
  --accent: #C9452E;
  --accent-ink: #FFFFFF;
  --accent-glow: rgba(201, 69, 46, .28);
  --good: #1D8452;
  --good-soft: #E1F3E8;
  --bad: #C23B33;
  --bad-soft: #FBE4E2;
  --m: #2D5FBF;          /* el: a masculine noun */
  --m-soft: #E4ECFA;
  --f: #C0453A;          /* la: a feminine noun */
  --f-soft: #FBE6E2;
  --c-coral: #D9533B;
  --c-teal: #12877A;
  --c-saffron: #C98208;
  --c-sky: #2F7BC8;
  --c-plum: #8A4BAE;
  --c-lime: #4E8A25;
  --c-rose: #C2417A;
  --c-indigo: #4B57C4;
  --tag-ink: #FFFFFF;
  --shadow: 0 1px 2px rgba(64, 40, 20, .06), 0 6px 20px rgba(64, 40, 20, .07);
  --radius: 20px;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --emoji: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412;
    --surface: #221E1A;
    --surface-2: #2E2823;
    --ink: #F3EDE6;
    --muted: #ABA197;
    --line: #3D3630;
    --accent: #FF7B63;
    --accent-ink: #1C0E09;
    --accent-glow: rgba(255, 123, 99, .22);
    --good: #55C98F;
    --good-soft: #173225;
    --bad: #FF8178;
    --bad-soft: #3D201E;
    --m: #93B4FF;
    --m-soft: #1D2A47;
    --f: #FF9B8A;
    --f-soft: #42251F;
    --c-coral: #FF7B63;
    --c-teal: #3FC7B5;
    --c-saffron: #F6B84A;
    --c-sky: #6FB0F6;
    --c-plum: #C796E6;
    --c-lime: #9CD064;
    --c-rose: #F58DB8;
    --c-indigo: #9AA4FF;
    --tag-ink: #171412;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #171412;
  --surface: #221E1A;
  --surface-2: #2E2823;
  --ink: #F3EDE6;
  --muted: #ABA197;
  --line: #3D3630;
  --accent: #FF7B63;
  --accent-ink: #1C0E09;
  --accent-glow: rgba(255, 123, 99, .22);
  --good: #55C98F;
  --good-soft: #173225;
  --bad: #FF8178;
  --bad-soft: #3D201E;
  --m: #93B4FF;
  --m-soft: #1D2A47;
  --f: #FF9B8A;
  --f-soft: #42251F;
  --c-coral: #FF7B63;
  --c-teal: #3FC7B5;
  --c-saffron: #F6B84A;
  --c-sky: #6FB0F6;
  --c-plum: #C796E6;
  --c-lime: #9CD064;
  --c-rose: #F58DB8;
  --c-indigo: #9AA4FF;
  --tag-ink: #171412;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

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

/* A button's display (inline-flex) would otherwise show what the hidden attribute hides. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
}

button { font-family: var(--font); }
h1, h2 { line-height: 1.25; }

:focus-visible { outline: 3px solid var(--c-sky); outline-offset: 2px; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(36px + env(safe-area-inset-bottom));
}

.boot { text-align: center; color: var(--muted); padding: 48px 16px; }

.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;
}

/* ---------- the name ---------- */

.brand-row { display: flex; align-items: baseline; gap: 10px; padding: 4px 2px; }
.brand { font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 15px; font-weight: 500; }

/* ---------- cards and buttons ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px;
  border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: 600 17px/1.2 var(--font);
  cursor: pointer;
  transition: transform .12s ease, border-color .2s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-round { width: 56px; min-height: 56px; padding: 0; border-radius: 50%; font-size: 22px; flex: none; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  font-size: 19px; cursor: pointer;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: 500 16px var(--font); cursor: pointer;
}

.topbar { display: flex; margin-bottom: 10px; }

/* ---------- Spanish ---------- */

.es { font-weight: 500; }
.es-in { font-weight: 600; }
.art { font-weight: 700; padding: 0 .2em; border-radius: .3em; }
.art-m { color: var(--m); background: var(--m-soft); }
.art-f { color: var(--f); background: var(--f-soft); }
.spain { display: block; font-size: 14px; color: var(--muted); }

.pic { font-family: var(--emoji); font-size: 28px; line-height: 1; }
.pic.lg { font-size: 64px; }
.pic.xl { font-size: 88px; }
.numpic {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.7em; height: 1.7em; padding: 0 .3em;
  border-radius: .4em; background: var(--surface-2); color: var(--c-sky);
  font-size: 17px; font-weight: 700; line-height: 1; direction: ltr;
}
.numpic.lg { font-size: 40px; }
.numpic.xl { font-size: 54px; }
.swatch {
  display: inline-block; width: 28px; height: 28px; border-radius: 50%;
  background: var(--sw); box-shadow: inset 0 0 0 2px var(--line);
}
.swatch.lg { width: 64px; height: 64px; }
.swatch.xl { width: 88px; height: 88px; }

.tip {
  margin: 0; padding: 12px 14px;
  background: var(--surface-2); border-radius: 14px;
  font-size: 15.5px; line-height: 1.55;
}

/* ---------- a mode's frame: the way out, the progress ---------- */

.md-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.md-prog { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.md-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .35s ease; }
.md-count { min-width: 3.2em; color: var(--muted); font-size: 15px; font-weight: 600; text-align: left; direction: ltr; }

/* ---------- a window and a message ---------- */

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20, 12, 6, .5);
}
.modal-card {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px; border-radius: 22px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.modal-card .btn { width: 100%; margin-top: 8px; }
.modal-title { margin: 0 0 8px; font-size: 21px; }
.modal-steps { padding-inline-start: 22px; margin: 10px 0; }
.modal-steps li { margin: 6px 0; }
.modal-note { color: var(--muted); font-size: 15px; }

#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 15.5px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
