:root {
  --sand: #F6EFE4;
  --card: #FFFBF5;
  --ink: #2B2522;
  --soft: #6B5F57;
  --line: #E7DCCB;
  --coral: #E0603A;
  --coral-dark: #B94726;
  --teal: #0F7C8C;
  --green: #4F7F3E;
  --gold: #E9A93B;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(43,37,34,.06), 0 8px 24px rgba(43,37,34,.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--sand); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 560px; margin: 0 auto; padding: 16px 18px 48px; min-height: 100vh; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--teal); }
.muted { color: var(--soft); }
.small { font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

.loading { display: grid; place-items: center; height: 70vh; }
.sun { width: 46px; height: 46px; border-radius: 50%; background: var(--coral); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.82); opacity: .7; } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.streak { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; background: var(--card); border-radius: 999px; padding: 6px 12px; font-weight: 700; box-shadow: var(--shadow); }
.streak .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(233,169,59,.25); }
.iconbtn { background: none; border: 0; padding: 8px; border-radius: 12px; font-size: 22px; color: var(--ink); cursor: pointer; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--soft); font-size: 16px; padding: 6px 0; cursor: pointer; margin-bottom: 8px; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px; }
.hero { background: var(--ink); color: var(--sand); }
.hero .muted { color: #CFC3B5; }
.hero h2 { font-size: 26px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.tile b { font-size: 17px; }
.tile span { color: var(--soft); font-size: 14px; }
.tile .tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: .04em; }
.tile:active, .btn:active { transform: scale(.98); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font: inherit; font-weight: 700; cursor: pointer; background: var(--coral); color: #fff; text-decoration: none; min-height: 52px; }
.btn:hover { background: var(--coral-dark); }
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.secondary:hover { background: #fff; }
.btn.dark { background: var(--ink); color: var(--sand); }
.btn.teal { background: var(--teal); }
.btn.danger { background: #A6322A; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

input[type=email], input[type=text] { width: 100%; font: inherit; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); }
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--coral); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--sand); }

.wordcard { text-align: center; padding: 24px 20px 22px; }
.wordcard .pic { width: 100%; max-width: 280px; aspect-ratio: 1; margin: 0 auto 16px; border-radius: 18px; background: #EFE5D6; display: grid; place-items: center; overflow: hidden; }
.wordcard .pic img { width: 100%; height: 100%; object-fit: cover; }
.wordcard .pic.none { aspect-ratio: auto; height: 0; margin: 0; }
.word { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0; word-break: break-word; }
.latin { color: var(--soft); font-size: 17px; margin-bottom: 6px; }
.meaning { font-size: 20px; color: var(--teal); font-weight: 600; margin-top: 10px; }
.speak { border: 0; background: #EFE5D6; color: var(--ink); border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.progressbar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 16px; }
.progressbar i { display: block; height: 100%; background: var(--coral); border-radius: 999px; transition: width .3s; }

.options { display: grid; gap: 10px; }
.option { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; font: inherit; cursor: pointer; color: var(--ink); }
.option.right { border-color: var(--green); background: #EAF3E3; }
.option.wrong { border-color: #A6322A; background: #F8E3DF; }

.stat { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat b { font-size: 22px; }
.week { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; }
.week div { flex: 1; text-align: center; font-size: 12px; color: var(--soft); }
.week i { display: block; height: 30px; border-radius: 8px; background: var(--line); margin-bottom: 4px; }
.week i.on { background: var(--gold); }
.batches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.batches i { height: 26px; border-radius: 5px; background: var(--line); position: relative; overflow: hidden; }
.batches i b { position: absolute; left: 0; bottom: 0; right: 0; background: var(--teal); }

.pattern { border-left: 4px solid var(--teal); padding-left: 12px; margin-bottom: 4px; }
.line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .t { flex: 1; cursor: pointer; }
.line .m { color: var(--teal); font-size: 15px; margin-top: 4px; }
.line .say { flex: none; border: 0; background: #EFE5D6; border-radius: 999px; width: 40px; height: 40px; cursor: pointer; font-size: 16px; }
.known { background: #FBE2C3; border-radius: 4px; padding: 0 2px; }
.narrator { font-style: italic; color: var(--soft); }

.banner { background: #E3F0F1; border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; }
.banner p { margin: 0; flex: 1; font-size: 15px; }
.banner button { flex: none; }
.notice { font-size: 13px; color: var(--soft); margin-top: 18px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--sand); padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 10; max-width: 90vw; }
.big-tick { width: 84px; height: 84px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 44px; margin: 12px auto 16px; }
footer.links { text-align: center; font-size: 14px; color: var(--soft); margin-top: 22px; }
footer.links a { color: var(--soft); margin: 0 8px; }

@media (min-width: 700px) { main { padding-top: 32px; } .word { font-size: 46px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.topright { flex: none; gap: 6px; align-items: center; }
.pad-8 { padding-top: 8vh; } .pad-6 { padding-top: 6vh; } .pad-4 { padding-top: 4vh; }
.mt-14 { margin-top: 14px; } .mt-22 { margin-top: 22px; } .mt-12vh { margin-top: 12vh; }
.m-0 { margin: 0; } .m-06 { margin: 0 0 6px; } .sect { margin: 6px 4px 8px; }
.w-auto { width: auto; } .logo-big { border-radius: 20px; }
.tile-wide { width: 100%; margin-bottom: 12px; min-height: auto; }
