/* Lyrebird — warm folk-art palette, mobile-first. */
:root {
  --bg:      #f4ecda;
  --surface: #fffdf6;
  --ink:     #2c2a26;
  --muted:   #7a736310;
  --muted-ink:#8a8272;
  --line:    #e4d9bf;
  --teal:    #1f7a6f;
  --teal-dk: #175d55;
  --plum:    #a5426a;
  --gold:    #d99a2b;
  --again:   #c1524a;
  --good:    #1f7a6f;
  --easy:    #3f7bb0;
  --shadow:  0 2px 0 rgba(0,0,0,.06), 0 8px 24px rgba(80,60,20,.10);
  --radius:  16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.muted { color: var(--muted-ink); }
button { font: inherit; cursor: pointer; }

/* ---- brand mark: a little fanned-tail bird drawn in CSS ---- */
.brand { display: flex; align-items: center; gap: .55rem; }
.brand h1 { margin: 0; font-size: 1.9rem; letter-spacing: .5px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 58%, var(--gold) 0 18%, transparent 19%),
    conic-gradient(from 205deg at 50% 62%,
      var(--teal) 0 25%, var(--plum) 25% 50%, var(--teal-dk) 50% 75%, var(--plum) 75% 100%);
  box-shadow: inset 0 0 0 3px var(--surface), 0 1px 3px rgba(0,0,0,.2);
  flex: none;
}
.brand.small .brand-mark { width: 26px; height: 26px; }
.brand.small { font-weight: 700; font-size: 1.1rem; gap: .4rem; }

/* ============================ LOGIN ============================ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem 1.75rem; width: 100%; max-width: 360px; text-align: center;
}
.login-card .brand { justify-content: center; }
.tagline { color: var(--muted-ink); margin: .3rem 0 1.5rem; }
#login-form { display: grid; gap: .75rem; }
input, select, textarea {
  font: inherit; padding: .7rem .8rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.error { color: var(--again); margin: .25rem 0 0; font-size: .9rem; }
.setup-note { color: var(--gold); font-size: .85rem; margin-top: 1rem; }

/* ============================ SHELL ============================ */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: .25rem; margin: 0 auto; }
.tab {
  border: none; background: transparent; color: var(--muted-ink);
  padding: .5rem .9rem; border-radius: 999px; font-weight: 600;
}
.tab.active { background: var(--teal); color: #fff; }
.link-btn { border: none; background: none; color: var(--muted-ink); text-decoration: underline; padding: .3rem; }
main { max-width: 620px; margin: 0 auto; padding: 1rem; padding-bottom: 4rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem; margin-bottom: 1rem;
}
h2 { margin: 0 0 .75rem; font-size: 1.25rem; }

/* buttons */
.primary {
  background: var(--teal); color: #fff; border: none; border-radius: 10px;
  padding: .7rem 1.1rem; font-weight: 700; box-shadow: 0 2px 0 var(--teal-dk);
}
.primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--teal-dk); }
.primary.big { width: 100%; padding: .95rem; font-size: 1.05rem; }

/* ============================ STUDY ============================ */
.stats { display: flex; gap: .75rem; margin-bottom: 1.25rem; }
.stat {
  flex: 1; text-align: center; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: .75rem .5rem;
}
.stat .num { display: block; font-size: 1.8rem; font-weight: 800; color: var(--teal); }
.stat .lbl { font-size: .78rem; color: var(--muted-ink); }
.options { display: grid; gap: .7rem; margin-bottom: 1.25rem; }
.opt { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted-ink); font-weight: 600; }

/* flashcard */
.card-panel { text-align: center; }
.progress { color: var(--muted-ink); font-size: .85rem; margin-bottom: .5rem; }
.flashcard {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 2rem 1.25rem; min-height: 190px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
}
.dir-badge {
  position: absolute; top: .6rem; left: .6rem; font-size: .68rem; font-weight: 700;
  color: var(--plum); background: #a5426a14; padding: .2rem .5rem; border-radius: 999px;
  letter-spacing: .3px;
}
.prompt { font-size: 2rem; font-weight: 700; }
.answer hr { border: none; border-top: 1px dashed var(--line); margin: 1rem 0; width: 80%; }
.answer-text { font-size: 1.5rem; color: var(--teal-dk); }
.type-form { display: flex; gap: .5rem; margin-top: 1.25rem; width: 100%; max-width: 340px; }
.type-form input { text-align: center; }
.type-result { margin-top: 1rem; font-size: 1.1rem; }
.type-result .ok { color: var(--good); font-weight: 700; }
.type-result .no { color: var(--again); font-weight: 700; }
.type-result .correct { display: block; font-size: 1.4rem; color: var(--teal-dk); margin-top: .3rem; }
.type-result .accent-note { display: block; font-size: .85rem; color: var(--gold); margin-top: .35rem; }

.controls { margin-top: 1.25rem; }
.grades { display: flex; gap: .5rem; }
.grade {
  flex: 1; border: none; border-radius: 10px; padding: .8rem .5rem; color: #fff;
  font-weight: 700; font-size: 1rem;
}
.grade.again { background: var(--again); box-shadow: 0 2px 0 #9c3f38; }
.grade.good  { background: var(--good);  box-shadow: 0 2px 0 var(--teal-dk); }
.grade.easy  { background: var(--easy);  box-shadow: 0 2px 0 #2f5f8a; }
.grade:active { transform: translateY(1px); }
.grade.suggest { outline: 3px solid var(--gold); outline-offset: 1px; }
.end { display: block; margin: 1rem auto 0; }

.done { text-align: center; padding: 2.5rem 1.25rem; }
.done-mark {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--teal); position: relative;
}
.done-mark::after {
  content: ""; position: absolute; left: 20px; top: 12px; width: 12px; height: 24px;
  border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg);
}

/* ============================ ADD ============================ */
.add-form { display: grid; gap: .8rem; }
.add-form label, .cards-head label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.add-form small { color: var(--muted-ink); font-weight: 400; }
.flash { font-size: .9rem; color: var(--good); font-weight: 600; }
.flash.warn { color: var(--gold); }
.accent-bar { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .85rem; color: var(--muted-ink); }
.accent-bar button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  min-width: 34px; padding: .3rem .1rem; font-size: 1rem;
}
.accent-bar button:active { background: var(--bg); }
.example {
  background: #fbf6e8; border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .8rem; font-size: .9rem; overflow-x: auto; margin: .5rem 0;
}
code { background: #fbf6e8; border: 1px solid var(--line); border-radius: 5px; padding: .05rem .3rem; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; }
#bulk-form { display: grid; gap: .7rem; }
.bulk-report { margin-top: .8rem; font-size: .9rem; }
.bulk-report .skipped { margin-top: .5rem; color: var(--gold); }
.bulk-report ul { margin: .3rem 0; padding-left: 1.2rem; }

/* ============================ CARDS ============================ */
.cards-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.cards-head h2 { margin: 0; flex: 1; }
.cards-head input { width: auto; flex: 1; min-width: 140px; }
.count { color: var(--muted-ink); font-weight: 400; font-size: .9rem; }
.cards-list { display: grid; gap: .5rem; }
.crow {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .3rem;
  border-bottom: 1px solid var(--line);
}
.crow .txt { flex: 1; min-width: 0; }
.crow .front { font-weight: 700; }
.crow .back { color: var(--muted-ink); }
.crow .due-dot { font-size: .7rem; color: var(--muted-ink); white-space: nowrap; }
.crow .row-actions { display: flex; gap: .3rem; opacity: 0; transition: opacity .12s; }
.crow:hover .row-actions, .crow:focus-within .row-actions { opacity: 1; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .3rem .5rem; font-size: .85rem; }
.icon-btn.danger { color: var(--again); }
.crow .edit-fields { flex: 1; display: grid; gap: .35rem; }
@media (hover: none) { .crow .row-actions { opacity: 1; } }

/* ============================ VERBS (conjugation) ============================ */
.tense-chip {
  position: absolute; top: .6rem; left: .6rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .3px;
  padding: .2rem .5rem; border-radius: 999px;
}
.tense-chip.mini {
  position: static; display: inline-block; margin: .15rem .35rem 0 0;
  font-size: .62rem; padding: .12rem .45rem;
}
.t-presente    { color: var(--teal-dk); background: #1f7a6f18; }
.t-preterito   { color: var(--plum);    background: #a5426a14; }
.t-imperfecto  { color: #9a6d15;        background: #d99a2b1f; }
.t-futuro      { color: #2f5f8a;        background: #3f7bb01a; }
.t-condicional { color: #555;           background: #00000010; }

.conj-hint { color: var(--muted-ink); font-size: .9rem; margin-top: .35rem; }
.accent-bar.compact { margin-top: .9rem; justify-content: center; }

.conj-column { margin: 1rem auto 0; border-collapse: collapse; font-size: 1rem; }
.conj-column td { padding: .25rem .8rem; border-bottom: 1px solid var(--line); }
.conj-column td:first-child { color: var(--muted-ink); text-align: right; }
.conj-column td:last-child { color: var(--teal-dk); font-weight: 600; }
.conj-column tr.target td { background: #d99a2b22; }
.conj-column tr.target td:last-child { font-weight: 800; }

.verb-search-wrap { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 4;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
.suggest-list button {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: .55rem .8rem; border-bottom: 1px solid var(--line); font-size: .95rem;
}
.suggest-list button:last-child { border-bottom: none; }
.suggest-list button:hover { background: var(--bg); }
.suggest-list b { margin-right: .4rem; }

.tense-picks { display: flex; flex-wrap: wrap; gap: .6rem .9rem; margin: .9rem 0; }
.tense-picks label { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.tense-picks input { width: auto; }
#verb-add-btn { margin-right: .6rem; }

@media (max-width: 480px) {
  /* Tight header: keep the bird mark, drop the wordmark text so all four
     tabs and Sign out fit on a phone. */
  .brand.small span:not(.brand-mark) { display: none; }
  .topbar { gap: .4rem; padding-left: .6rem; padding-right: .6rem; }
  .tabs { gap: .1rem; }
  .tab { padding: .45rem .5rem; font-size: .92rem; }
  .link-btn { padding: .3rem 0; font-size: .8rem; }
}
@media (max-width: 420px) {
  .prompt { font-size: 1.7rem; }
  .stat .num { font-size: 1.5rem; }
  main { padding: .75rem; }
}
