/* ═══════════════════════════════════════════════════════════════════
   The Boring Input — ID visual "A Busca pela Temperança"
   Cinzel (display) · Montserrat (texto) · #0f255f · #ffffff · #242425
   ═══════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/cinzel-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/montserrat-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/montserrat-italic-var.woff2') format('woff2');
}

:root {
  --navy-deep: #070f2e;
  --navy: #0f255f;
  --navy-soft: #16306e;
  --line: rgba(244, 239, 226, 0.14);
  --line-strong: rgba(244, 239, 226, 0.32);
  --ink: #eef1f9;
  --muted: #93a3cd;
  --ivory: #f4efe2;
  --ivory-dim: #cfc9b6;
  --card-ink: #1b2547;
  --card-muted: #5a6485;
  --champagne: #cdb987;
  --again: #c65b4e;
  --hard: #c98f4b;
  --good: #7f9d5f;
  --easy: #5f92a8;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', 'Malgun Gothic', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background:
    radial-gradient(115% 90% at 50% -10%, var(--navy-soft) 0%, var(--navy) 42%, var(--navy-deep) 100%)
    fixed var(--navy-deep);
}

/* grain — papel da campanha */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

.frame {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 28px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* colunas ornamentais laterais (desktop) */
@media (min-width: 1080px) {
  .frame::before,
  .frame::after {
    content: '✦\A✦\A✦';
    white-space: pre;
    line-height: 3.4;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--line-strong);
    text-align: center;
    padding: 26px 10px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .frame::before { left: 34px; }
  .frame::after  { right: 34px; }
}

/* ── masthead ───────────────────────────────────────────── */

.masthead { text-align: center; padding: 44px 0 10px; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 22px;
  justify-content: center;
  text-decoration: none;
  color: var(--ivory);
}
.wordmark .rule { flex: 1; max-width: 130px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
.wordmark .rule:last-child { background: linear-gradient(270deg, transparent, var(--line-strong)); }

.wordmark h1 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: clamp(21px, 4vw, 30px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.motto {
  margin-top: 7px;
  font-style: italic;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  position: relative;
  display: inline-block;
  cursor: help;
}

/* tooltip do lema */
.motto::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--ivory);
  color: var(--navy);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  white-space: nowrap;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}
.motto:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (max-width: 640px) {
  .motto::after { white-space: normal; width: 78vw; }
}

.topnav { margin-top: 22px; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }
.topnav a { color: var(--muted); text-decoration: none; padding: 4px 10px; transition: color 0.15s; }
.topnav a:hover, .topnav a.active { color: var(--ivory); }
.topnav .dot { color: var(--line-strong); font-size: 9px; vertical-align: 2px; }

main { flex: 1; padding-top: 26px; }

/* ── stats strip ────────────────────────────────────────── */

.strip {
  display: flex;
  justify-content: center;
  gap: 44px;
  padding: 18px 10px 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
  animation: rise 0.5s ease both;
}
.stat { text-align: center; }
.stat b {
  display: block;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 30px;
  color: var(--ivory);
  line-height: 1.1;
}
.stat span {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat.lit b { color: var(--champagne); }

/* heatmap */
.heatwrap { margin: 4px 0 34px; animation: rise 0.5s 0.08s ease both; }
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 10px);
  gap: 3px;
  justify-content: center;
}
.heatmap i {
  width: 10px; height: 10px;
  border-radius: 2px;
  background: rgba(244, 239, 226, 0.07);
}
.heatmap i.h1 { background: rgba(205, 185, 135, 0.32); }
.heatmap i.h2 { background: rgba(205, 185, 135, 0.58); }
.heatmap i.h3 { background: rgba(230, 213, 170, 0.85); }
.heatmap i.today { outline: 1px solid var(--line-strong); outline-offset: 1px; }
.heatlabel { text-align: center; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }

/* ── deck list ──────────────────────────────────────────── */

.decklist { display: flex; flex-direction: column; gap: 14px; }

.deck {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.03);
  transition: border-color 0.2s, background 0.2s;
  animation: rise 0.45s ease both;
}
.deck:hover { border-color: var(--line-strong); background: rgba(244, 239, 226, 0.05); }

.deck .info { flex: 1; min-width: 0; }
.deck h2 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--ivory);
  margin-bottom: 5px;
}
.deck .meta { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.deck .meta b { color: var(--ink); font-weight: 600; }
.deck .meta .sep { margin: 0 7px; color: var(--line-strong); }
.deck .actions { display: flex; gap: 8px; align-items: center; }

.btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 11px 20px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ivory);
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--ivory); color: var(--navy); border-color: var(--ivory); }
.btn.primary { background: var(--ivory); color: var(--navy); border-color: var(--ivory); }
.btn.primary:hover { background: var(--champagne); border-color: var(--champagne); }
.btn.quiet { border-color: transparent; color: var(--muted); padding: 11px 10px; }
.btn.quiet:hover { color: var(--ivory); background: transparent; }
.btn.danger:hover { background: var(--again); border-color: var(--again); color: var(--ivory); }
.btn:disabled { opacity: 0.35; pointer-events: none; }

/* empty state — vende o destino, uma ação só */
.empty {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--line-strong);
  animation: rise 0.5s ease both;
}
.empty .glyph { font-size: 26px; color: var(--champagne); display: block; margin-bottom: 18px; }
.empty h2 { font-family: 'Cinzel', serif; font-weight: 600; font-size: 20px; color: var(--ivory); margin-bottom: 10px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 26px; line-height: 1.7; font-size: 13.5px; }

.section-title {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 38px 0 16px;
}
.section-title::before, .section-title::after { content: ' ✦ '; color: var(--line-strong); }

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

/* ── inputs ─────────────────────────────────────────────── */

input[type='text'], input[type='email'], input[type='password'], textarea, select {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: rgba(7, 15, 46, 0.55);
  border: 1px solid var(--line-strong);
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
}
input[type='text']:focus, input[type='email']:focus, input[type='password']:focus, textarea:focus { border-color: var(--champagne); }
textarea { width: 100%; resize: vertical; line-height: 1.6; }
::placeholder { color: rgba(147, 163, 205, 0.65); }

/* ── review ─────────────────────────────────────────────── */

.review { max-width: 660px; margin: 0 auto; }

.review .crumbs {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.review .crumbs b { color: var(--ivory); font-family: 'Cinzel', serif; letter-spacing: 0.08em; font-size: 13px; }

.progressbar { height: 2px; background: var(--line); margin-bottom: 30px; }
.progressbar i { display: block; height: 100%; background: var(--champagne); transition: width 0.3s ease; }

.card {
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(15, 37, 95, 0.045) 27px 28px),
    var(--ivory);
  color: var(--card-ink);
  padding: 46px 46px 40px;
  min-height: 300px;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  position: relative;
  animation: cardin 0.35s ease both;
  display: flex;
  flex-direction: column;
}
.audiobtn {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: 1px solid rgba(15, 37, 95, 0.18);
  border-radius: 50%;
  width: 34px; height: 34px;
  font-size: 14px;
  cursor: pointer;
  color: var(--card-ink);
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s;
}
.audiobtn:hover { opacity: 1; border-color: rgba(15, 37, 95, 0.45); }

.card::before {
  content: '✦';
  position: absolute;
  top: 14px; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(15, 37, 95, 0.35);
}

.card .front {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.55;
  white-space: pre-wrap;
  text-align: center;
  margin: auto 0;
  padding: 12px 0;
}
.card .front .headword { font-family: 'Cinzel', serif; font-weight: 700; font-size: 24px; letter-spacing: 0.02em; }

.card .divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 20px;
  color: rgba(15, 37, 95, 0.4);
  font-size: 10px;
}
.card .divider::before, .card .divider::after { content: ''; flex: 1; height: 1px; background: rgba(15, 37, 95, 0.22); }

.card .pron { text-align: center; font-style: italic; color: var(--card-muted); font-size: 14.5px; margin-top: 6px; }

.card .back {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  animation: rise 0.3s ease both;
}
.card .example {
  margin-top: 18px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.7;
  color: var(--card-muted);
  padding-left: 16px;
  border-left: 2px solid rgba(15, 37, 95, 0.18);
  animation: rise 0.3s 0.05s ease both;
}
.card .notes { margin-top: 14px; font-size: 12.5px; color: var(--card-muted); animation: rise 0.3s 0.1s ease both; }

.review .controls { margin-top: 26px; text-align: center; }

.reveal-hint { color: var(--muted); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }

.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grades.two { grid-template-columns: repeat(2, 1fr); max-width: 440px; margin: 0 auto; }
.grade {
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  background: rgba(244, 239, 226, 0.04);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gc, var(--line-strong));
  color: var(--ink);
  padding: 12px 6px 10px;
  transition: all 0.15s;
}
.grade:hover { background: var(--gc); color: #fff; border-color: var(--gc); }
.grade b { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.grade small { display: block; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.grade:hover small { color: rgba(255, 255, 255, 0.8); }
.grade .key { font-size: 9.5px; opacity: 0.55; }

.g0 { --gc: var(--again); }
.g1 { --gc: var(--hard); }
.g2 { --gc: var(--good); }
.g3 { --gc: var(--easy); }

/* fim de sessão — celebrar, não confirmar */
.finis { text-align: center; padding: 60px 20px 30px; animation: rise 0.6s ease both; }
.finis .glyph { font-size: 22px; color: var(--champagne); display: block; margin-bottom: 22px; animation: glow 2.4s ease infinite; }
.finis h2 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: 0.1em;
  color: var(--ivory);
  margin-bottom: 8px;
}
.finis .sub { font-style: italic; color: var(--muted); margin-bottom: 34px; }
.finis .numbers { display: flex; justify-content: center; gap: 50px; margin-bottom: 40px; }
.finis .wait { color: var(--muted); font-size: 13px; margin-bottom: 30px; }

@keyframes glow { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ── browse ─────────────────────────────────────────────── */

.browse-head { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.browse-head h2 { font-family: 'Cinzel', serif; font-size: 18px; color: var(--ivory); flex: 1; }
.browse-head input { flex: 1; min-width: 180px; }

.cardrow {
  border: 1px solid var(--line);
  padding: 14px 18px;
  margin-bottom: 10px;
  background: rgba(244, 239, 226, 0.03);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.cardrow .txt { flex: 1; min-width: 0; }
.cardrow .f { font-family: var(--serif); font-size: 15px; color: var(--ivory); white-space: pre-wrap; }
.cardrow .b { font-size: 12.5px; color: var(--muted); margin-top: 5px; white-space: pre-wrap; max-height: 60px; overflow: hidden; }
.cardrow .srs { font-size: 10.5px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 7px; }
.cardrow .ops { display: flex; gap: 4px; }
.iconbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 7px; }
.iconbtn:hover { color: var(--ivory); }

/* form / modal */
.overlay {
  position: fixed; inset: 0;
  background: rgba(7, 15, 46, 0.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fade 0.15s ease both;
}
.modal {
  background: var(--navy);
  border: 1px solid var(--line-strong);
  padding: 30px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal h3 { font-family: 'Cinzel', serif; font-size: 16px; color: var(--ivory); margin-bottom: 20px; letter-spacing: 0.06em; }
.modal label { display: block; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.modal input[type='text'], .modal textarea { width: 100%; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── import ─────────────────────────────────────────────── */

.import { max-width: 640px; margin: 0 auto; animation: rise 0.45s ease both; }
.import h2 { font-family: 'Cinzel', serif; font-size: 19px; color: var(--ivory); text-align: center; margin-bottom: 8px; }
.import .lead { text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.7; margin-bottom: 26px; }
.import .lead code { color: var(--champagne); font-size: 12.5px; }
.import textarea { min-height: 220px; font-family: Consolas, monospace; font-size: 12.5px; }
.import .row { display: flex; gap: 10px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.import .result { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--champagne); min-height: 20px; }
.import .hintbox {
  margin-top: 34px;
  border: 1px solid var(--line);
  padding: 18px 22px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.8;
}
.import .hintbox b { color: var(--ink); }
.import .hintbox code { color: var(--champagne); }

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: var(--ivory);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 11px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 99;
  animation: rise 0.25s ease both;
}

/* ── colophon ───────────────────────────────────────────── */

.colophon { text-align: center; padding-top: 46px; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
.colophon span { color: var(--line-strong); font-size: 9px; display: block; margin-bottom: 10px; }
kbd {
  font-family: Consolas, monospace;
  font-size: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink);
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardin { from { opacity: 0; transform: translateY(14px) scale(0.99); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .frame { padding: 0 16px 40px; }
  .card { padding: 34px 24px 30px; }
  .strip { gap: 26px; }
  .deck { flex-direction: column; align-items: flex-start; }
  .deck .actions { width: 100%; justify-content: flex-end; }
}

/* ── conta (login/cadastro/senha) ───────────────────────── */

.auth {
  max-width: 360px;
  margin: 48px auto 0;
  text-align: center;
  animation: rise 0.35s ease both;
}
.auth .glyph { font-size: 26px; color: var(--champagne); display: block; margin-bottom: 18px; }
.auth h2 { font-family: 'Cinzel', serif; font-weight: 600; font-size: 20px; color: var(--ivory); margin-bottom: 22px; letter-spacing: 0.06em; }
.auth form { text-align: left; }
.auth label { display: block; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.auth label small { text-transform: none; letter-spacing: 0; }
.auth input { width: 100%; }
.auth .btn { width: 100%; margin-top: 22px; }
.auth .authnote { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 4px; }
.authlinks { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.authlinks a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.authlinks a:hover { color: var(--ivory); }
.authlinks .sep { margin: 0 8px; color: var(--line-strong); }
.autherr { margin-top: 14px; font-size: 13px; color: var(--champagne); min-height: 18px; }

.who { display: inline-flex; align-items: center; gap: 8px; }
.who .email { color: var(--muted); font-size: 11.5px; letter-spacing: 0.04em; }
.who a { color: var(--muted); font-size: 11.5px; text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.who a:hover { color: var(--ivory); }
