@font-face { font-family: "Noto Sans Ethiopic"; src: url("fonts/NotoSansEthiopic.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/CormorantGaramond.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }
:root {
  --bg: #f4efe6;
  --card: #fffdf8;
  --ink: #1f1a16;
  --muted: #6d645a;
  --line: #e2d8c8;
  --accent: #6e1f1f;
  --accent-ink: #fff;
  --gold: #c9a24f;
  --flag: #e0a100;
  --guess: #6b8fd6;
  --error: #b42318;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Ethiopic", sans-serif;
}
.am, [lang="am"] { font-family: "Noto Sans Ethiopic", system-ui, sans-serif; }
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; line-height: 1.1; margin: 0 0 8px; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: #2b2420; color: #f4efe6;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.brand-title { color: #f4efe6; font-weight: 650; font-size: 15px; }
.brand-sub { color: #cdbfa9; font-size: 12px; }
.who { font-size: 13px; color: #d8cfc2; white-space: nowrap; }
.who .link { color: var(--gold); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(60, 40, 20, .05);
}
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.hero { display: flex; flex-direction: column; gap: 12px; }
.hero p { margin: 0 0 4px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

label { display: block; font-weight: 600; font-size: 14px; }
input, select {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #cfc3b0; border-radius: 10px; padding: 11px 12px; margin-top: 4px;
  min-height: 46px;
}
input:focus, select:focus { outline: 3px solid rgba(201, 162, 79, .45); border-color: var(--gold); }
input[type="search"] { margin: 8px 0 4px; }
#loginForm label { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 16px system-ui, sans-serif; text-decoration: none; text-align: center;
  border: 1px solid #cfc3b0; background: #fff; color: var(--ink);
  border-radius: 12px; padding: 10px 16px; cursor: pointer; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; min-height: 56px; font-size: 17px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: wait; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.link { background: none; border: 0; padding: 4px; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
#done .btn, #view-done .btn { margin-top: 10px; }

.error { color: var(--error); font-weight: 600; }
.warn { background: #fff4d6; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 12px; }

.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.list .actions { display: flex; gap: 6px; flex-shrink: 0; }

.reading-img { max-width: 100%; max-height: 220px; border-radius: 10px; margin-bottom: 16px; }
.spinner {
  width: 40px; height: 40px; margin: 8px auto 16px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan { margin: 8px 0 4px; }
.scan summary { cursor: pointer; font-weight: 600; }
.scan img { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.note { border-left: 4px solid var(--line); background: #faf6ee; padding: 10px 12px; border-radius: 6px; margin-top: 10px; font-size: 14px; }
.note.warn { border-left-color: var(--flag); background: #fff7e0; border-top: 0; border-right: 0; border-bottom: 0; }
.note.resolved { opacity: .55; text-decoration: line-through; }
.note .btn { margin-top: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; border: 2px solid; }
.swatch.flag { border-color: var(--flag); }
.swatch.guess { border-color: var(--guess); }

/* Review form: label | English | Amharic */
.lang-head, .pair { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 10px; align-items: center; }
.lang-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.pair { padding: 8px 0; border-bottom: 1px solid #f0e9dd; }
.pair input { margin-top: 0; }
.lbl { font-weight: 600; font-size: 14px; }
.lbl em, legend em { display: block; font-style: normal; font-weight: 400; color: var(--muted); font-size: 13px; }
.pair.single .seg { grid-column: span 2; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 46px;
  border: 1px solid #cfc3b0; border-radius: 10px; background: #fff; font-weight: 600; cursor: pointer;
}
.seg input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg input:focus-visible + span { outline: 3px solid rgba(201, 162, 79, .45); }

fieldset.date { border: 0; border-bottom: 1px solid #f0e9dd; margin: 0; padding: 12px 0; }
legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.date-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; align-items: end; }
.date-grid > label { font-weight: 500; font-size: 13px; color: var(--muted); }
.eth > span { font-size: 13px; color: var(--muted); }
.eth-inputs { display: grid; grid-template-columns: 1.6fr .7fr .9fr; gap: 6px; }

.flag, .pair.flag input, fieldset.flag input, fieldset.flag select { border-color: var(--flag) !important; box-shadow: 0 0 0 2px rgba(224, 161, 0, .25); }
.guess { border-color: var(--guess) !important; border-style: dashed !important; }
.pair.flag, fieldset.flag { box-shadow: none; }

.confirm { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 18px 0 14px; }
.confirm input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; flex-shrink: 0; }

.tick {
  width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #e7f3e8; color: #23733a; font-size: 34px; font-weight: 700;
}
#view-done .btn.big { margin-top: 10px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; background: #2b2420; color: #fff;
  padding: 14px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); z-index: 50;
}

@media (max-width: 600px) {
  h1 { font-size: 25px; }
  .card { padding: 16px; }
  .lang-head { display: none; }
  .pair { grid-template-columns: 1fr; row-gap: 6px; }
  .pair .lbl { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .pair .lbl em { display: inline; }
  .pair.single .seg { grid-column: 1 / -1; }
  .date-grid { grid-template-columns: 1fr; }
  .list li { flex-direction: column; align-items: stretch; }
  .list .actions .btn { flex: 1; }
}
