/* Cafecito — warm, readable, mobile-first. */
:root {
  --coffee: #6f4e37;
  --coffee-dark: #4a3526;
  --cream: #f7f1e8;
  --paper: #fffdf9;
  --ink: #2b2420;
  --muted: #8a7d6f;
  --accent: #c08457;
  --accent-soft: #f0e0d0;
  --line: #e7ddcf;
  --known: #3c8a4e;
  --shadow: 0 6px 24px rgba(74, 53, 38, .18);
  --maxw: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ── Top bar ────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--coffee);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.brand { font-weight: 700; font-size: 20px; letter-spacing: .3px; }
.brand span { vertical-align: middle; }
.icon-btn {
  background: rgba(255,255,255,.16); border: 0; color: #fff;
  font-size: 18px; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer;
}
.icon-btn.on { background: var(--accent); }

/* ── Layout ─────────────────────────────────────────── */
#app { max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 96px; }
.view.hidden, .hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }

/* ── Article ────────────────────────────────────────── */
.article-head h1 { font-size: 26px; line-height: 1.25; margin: 8px 0 4px; }
.article-meta { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.article-meta a { color: var(--accent); text-decoration: none; }
.article-toolbar { display: flex; gap: 8px; margin: 10px 0 18px; }

.article-body {
  font-size: 19px; line-height: 1.75;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 18px 22px;
}
.article-body p { margin: 0 0 1.05em; }
.sentence { transition: background .12s; border-radius: 4px; }
.w {
  cursor: pointer; border-radius: 4px; padding: 0 1px;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.w:hover { background: var(--accent-soft); }
.w.saved { background: #e4efe1; box-shadow: inset 0 -2px 0 var(--known); }
.tip { text-align:center; color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  font: inherit; font-size: 15px; font-weight: 600;
  border-radius: 10px; padding: 11px 16px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--coffee-dark);
}
.btn.primary { background: var(--coffee); color: #fff; border-color: var(--coffee); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.known { background: var(--known); color: #fff; border-color: var(--known); }
.btn.ghost { background: transparent; }
.btn.block { display: block; width: 100%; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }

/* ── Bottom sheet (translation popover) ─────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(43,36,32,.4); z-index: 40;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: var(--maxw); margin: 0 auto;
  background: var(--paper); border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow); padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: -6px auto 12px; }
.sheet .es { font-size: 22px; font-weight: 700; }
.sheet .es.small { font-size: 17px; font-weight: 600; line-height: 1.4; }
.sheet .en { font-size: 18px; color: var(--coffee-dark); margin: 6px 0 14px; min-height: 22px; }
.sheet .en .spin { color: var(--muted); font-style: italic; }
.sheet .label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-top: 4px; }
.sheet .row { display: flex; gap: 8px; margin-top: 10px; }
.sheet .divider { height: 1px; background: var(--line); margin: 16px 0 12px; }

/* ── Review ─────────────────────────────────────────── */
.review-head { margin-bottom: 14px; }
.review-head h2 { margin: 4px 0; }
.review-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 20px; text-align: center; box-shadow: var(--shadow);
}
.review-card .kind {
  display: inline-block; font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--accent); border: 1px solid var(--accent-soft); background: var(--accent-soft);
  padding: 2px 10px; border-radius: 999px; margin-bottom: 14px;
}
.review-card .es { font-size: 24px; font-weight: 700; line-height: 1.4; }
.review-card .es.sentence-text { font-size: 20px; font-weight: 600; }
.review-card .en { font-size: 20px; color: var(--known); margin: 16px 0; min-height: 26px; }
.review-card .dots { margin: 16px 0 4px; font-size: 18px; letter-spacing: 4px; }
.review-card .dot { color: var(--line); }
.review-card .dot.on { color: var(--known); }
.review-actions { display: flex; gap: 10px; margin-top: 18px; }
.review-actions .btn { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

/* ── Item lists (archive) ───────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px;
}
.item .es { font-weight: 600; font-size: 17px; }
.item .en { color: var(--known); margin-top: 4px; font-size: 15px; }
.item .en.hidden-tr { color: var(--muted); font-style: italic; }
.item .item-actions { display: flex; gap: 8px; margin-top: 10px; }
.item .item-actions .btn { padding: 7px 12px; font-size: 13px; }

/* ── Bottom tab bar ─────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; font-size: 20px; color: var(--muted);
}
.tab span { font-size: 11px; font-weight: 600; }
.tab.active { color: var(--coffee); }

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--coffee-dark); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow);
  animation: rise .18s ease-out;
}

@media (min-width: 760px) {
  .tab span { font-size: 12px; }
}
