/* Afinar — « Sol y sombra » theme.
   Parchment paper, ink text, pomegranate (granate) + gold (oro) accents.
   Newsreader serif for Spanish & headings, Inter for UI. */

:root {
  --paper: #f7f2e9;
  --paper-2: #fffdf8;
  --paper-3: #efe6d4;
  --ink: #241f1c;
  --muted: #7c7266;
  --line: #e6dcc8;
  --line-soft: #efe7d6;
  --granate: #93202a;
  --granate-deep: #6e1720;
  --granate-wash: #f6e9e6;
  --oro: #b9822a;
  --oro-soft: #f3e6c8;
  --verde: #3f7d4e;
  --rojo: #b3362f;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-1: 0 1px 2px rgba(36, 31, 28, .05), 0 6px 18px rgba(36, 31, 28, .06);
  --shadow-2: 0 2px 6px rgba(36, 31, 28, .08), 0 16px 38px rgba(36, 31, 28, .12);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(147, 32, 42, .06), transparent 60%),
    radial-gradient(900px 460px at -8% -6%, rgba(185, 130, 42, .07), transparent 58%),
    var(--paper);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
.es { font-family: var(--serif); }
a { color: var(--granate); }
button { font-family: inherit; }

/* Layout ------------------------------------------------------------ */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 96px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: rgba(247, 242, 233, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; box-shadow: var(--shadow-1);
  background: linear-gradient(#c60b1e 0 25%, #f1bf00 25% 75%, #c60b1e 75% 100%);
}
.brand b { font-family: var(--serif); font-size: 20px; letter-spacing: .2px; }
.spacer { flex: 1; }
.streak { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.streak b { color: var(--granate); }

/* Bottom nav -------------------------------------------------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav button {
  border: 0; background: none; cursor: pointer;
  padding: 6px 12px; border-radius: 10px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px;
}
.nav button .ic { font-size: 18px; line-height: 1; }
.nav button.on { color: var(--granate); background: var(--granate-wash); }

/* Cards & sections -------------------------------------------------- */
.section-title { margin: 26px 0 12px; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--sans); font-weight: 700; }
.card {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px 20px;
}
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .grid.two { grid-template-columns: 1fr; } }

.hero { margin-top: 22px; padding: 26px 24px; text-align: left; }
.hero h1 { font-size: 30px; margin-bottom: 6px; }
.hero p { margin: 0 0 18px; color: var(--muted); max-width: 46ch; }

.tile { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tile .k { font-family: var(--serif); font-size: 19px; }
.tile .d { font-size: 13.5px; color: var(--muted); }
.tile .meta { font-size: 12.5px; color: var(--oro); font-weight: 700; margin-top: 2px; }

.statrow { display: flex; gap: 22px; margin: 4px 0 2px; }
.stat b { font-family: var(--serif); font-size: 24px; color: var(--granate); display: block; line-height: 1; }
.stat span { font-size: 12px; color: var(--muted); }

/* Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .1s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--granate); border-color: var(--granate); color: #fff; }
.btn.primary:hover { background: var(--granate-deep); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.sm { padding: 7px 13px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: default; }

/* Review flashcard -------------------------------------------------- */
.reviewwrap { max-width: 620px; margin: 0 auto; }
.progressbar { height: 4px; background: var(--paper-3); border-radius: 4px; overflow: hidden; margin: 10px 0 20px; }
.progressbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--oro), var(--granate)); }
.flash { min-height: 230px; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 34px 26px; }
.flash .term { font-family: var(--serif); font-size: 30px; line-height: 1.25; }
.flash .type { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--oro); font-weight: 700; margin-bottom: 12px; }
.flash .reveal { margin-top: 18px; text-align: left; border-top: 1px dashed var(--line); padding-top: 16px; }
.flash .reveal .m { font-size: 18px; margin-bottom: 8px; }
.flash .reveal .m .en { color: var(--muted); }
.flash .badge { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--granate); background: var(--granate-wash); padding: 2px 9px; border-radius: 999px; margin-bottom: 10px; }
.flash .nuance { font-size: 14.5px; color: var(--muted); background: var(--paper); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 13px; margin: 10px 0; }
.flash .ex { font-family: var(--serif); font-size: 17px; margin: 6px 0 2px; }
.flash .ex .en { display: block; font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.speak { border: 0; background: var(--oro-soft); color: var(--oro); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 15px; vertical-align: middle; }
.speak:hover { filter: brightness(.96); }

.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.grades button { border: 1px solid var(--line); background: var(--paper-2); border-radius: 12px; padding: 12px 4px; cursor: pointer; font-weight: 700; font-size: 14px; }
.grades button small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); margin-top: 2px; }
.grades .g0:hover { border-color: var(--rojo); color: var(--rojo); }
.grades .g1:hover { border-color: var(--oro); color: var(--oro); }
.grades .g2:hover { border-color: var(--granate); color: var(--granate); }
.grades .g3:hover { border-color: var(--verde); color: var(--verde); }

/* Reader ------------------------------------------------------------ */
.reader { font-family: var(--serif); font-size: 19px; line-height: 1.72; }
.reader p { margin: 0 0 1em; }
.gloss { border-bottom: 1.5px dotted var(--oro); cursor: pointer; }
.gloss:hover { background: var(--oro-soft); }
.pop { position: fixed; z-index: 50; max-width: 280px; background: var(--ink); color: #fbf7ee; padding: 10px 13px; border-radius: 10px; box-shadow: var(--shadow-2); font-family: var(--sans); font-size: 13.5px; line-height: 1.5; }
.pop .gl-es { font-weight: 600; }
.pop .gl-en { color: #d9cfbe; }
.pop .add { margin-top: 8px; }
.pop .add button { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 0; background: var(--oro); color: #241f1c; font-weight: 700; cursor: pointer; }
.qa { margin-top: 22px; }
.qa details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: var(--paper-2); }
.qa summary { cursor: pointer; font-weight: 600; }
.qa .a { margin-top: 6px; color: var(--muted); }

/* Matices ----------------------------------------------------------- */
.opts { display: grid; gap: 10px; margin: 18px 0; }
.opts button { text-align: left; border: 1px solid var(--line); background: var(--paper-2); border-radius: 12px; padding: 13px 16px; cursor: pointer; font-size: 16px; font-family: var(--serif); }
.opts button:hover { border-color: var(--granate); }
.opts button.right { border-color: var(--verde); background: #eef6ef; }
.opts button.wrong { border-color: var(--rojo); background: #f8ecea; }
.explain { border-left: 3px solid var(--oro); padding: 4px 0 4px 14px; margin-top: 6px; color: var(--muted); font-size: 14.5px; }
.explain .en { display: block; margin-top: 4px; }
.cat { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--oro); font-weight: 700; }

/* Producción -------------------------------------------------------- */
.prod .prompt { font-size: 20px; margin: 6px 0 14px; }
.prod textarea { width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: var(--serif); font-size: 17px; background: var(--paper-2); resize: vertical; color: var(--ink); }
.prod .models { margin-top: 14px; }
.prod .models .m { font-family: var(--serif); font-size: 18px; border-left: 3px solid var(--granate); padding-left: 12px; margin: 8px 0; }

/* Forms / Ajustes --------------------------------------------------- */
.field { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.field:last-child { border-bottom: 0; }
.field label { font-weight: 600; }
.field .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
select, input[type=number] { font-family: var(--sans); font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); color: var(--ink); }
input[type=range] { accent-color: var(--granate); }
.hint { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fbf7ee; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-2); z-index: 60; }
