/* Słówka. Phone first; built for an iPhone home-screen app. */

:root {
  --bg: #faf7f2;
  --panel: #ffffff;
  --ink: #1d1b18;
  --muted: #6b655c;
  --line: #e7e1d7;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe7ea;
  --good: #1f7a4d;
  --good-soft: #e3f3ea;
  --warn: #9a6200;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --dot-new: #b9b2a6;
  --dot-learning: #e0a100;
  --dot-known: #1f9d5a;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 4px 16px rgba(40, 30, 20, .06);
  --radius: 18px;
  --tabbar: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --panel: #221e19;
    --ink: #f3eee6;
    --muted: #a9a196;
    --line: #36302a;
    --accent: #ff4d63;
    --accent-ink: #1b0b0d;
    --accent-soft: #3a1a1f;
    --good: #5fd39a;
    --good-soft: #17301f;
    --warn: #f0b84a;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1b18;
    --dot-new: #6e675d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

button, input, select, textarea { font: inherit; color: inherit; }

h1 { font-size: 32px; line-height: 1.15; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 20px; margin: 0 0 12px; }

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
}

.page.center { text-align: center; padding-top: calc(env(safe-area-inset-top) + 72px); }

.hello { margin: 8px 4px 20px; }
.sub { color: var(--muted); margin: 6px 0 0; }
.flame { font-weight: 700; color: var(--accent); }
.small { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.center { text-align: center; }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 20px;
  margin: 0 0 16px;
}

.hint {
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 16px;
  font-size: 15px;
}
.hint .inline { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */

.btn {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn + .btn { margin-top: 10px; }
.btn.big { padding: 17px 16px; font-size: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); background: transparent; margin-top: 8px; }
.btn:disabled { opacity: .45; }
.btn:active, .tab:active, .g:active { transform: scale(.98); }

.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; cursor: pointer; }
.back { margin: 0 0 6px; }

.icon {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: var(--panel);
  display: grid; place-items: center;
  cursor: pointer;
}
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.seg {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.wide { margin: 0 0 16px; }

/* ---------- study home ---------- */

.today .counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}
.counts div, .stats div {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.counts b { display: block; font-size: 38px; line-height: 1.1; }
.counts span, .stats span { color: var(--muted); font-size: 15px; }
.done-msg { font-size: 19px; text-align: center; margin: 4px 0 16px; }

.opts .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}
.opts .row > span { color: var(--muted); white-space: nowrap; }
.opts select { flex: 1; max-width: 62%; }
.opts .seg { flex: 1; max-width: 62%; }

select, input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.sync { color: var(--muted); font-size: 14px; text-align: center; margin: 8px 0; min-height: 1em; }

/* ---------- session ---------- */

.session {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px);
}
.session .top { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.session .bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.session .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s; }
.session .left { color: var(--muted); font-size: 15px; min-width: 2ch; text-align: right; }

.card {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px 20px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 300px;
  cursor: default;
}
.card[data-reveal] { cursor: pointer; }
.card .tag { color: var(--muted); font-size: 14px; margin: 0 0 auto; padding-bottom: 18px; }
.card .tag b { color: var(--accent); }
.card .prompt { font-size: 38px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: 15px; margin-top: 8px; font-style: italic; }
.card .tap { color: var(--muted); font-size: 15px; margin-top: auto; padding-top: 24px; }
.card hr { width: 60%; border: 0; border-top: 1px solid var(--line); margin: 22px auto; }
.card .answer { font-size: 30px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.card .example { margin-top: 18px; background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 17px; text-align: left; width: 100%; }
.card .example .en { color: var(--muted); font-size: 15px; margin-top: 4px; }
.card .notes { margin-top: 12px; color: var(--muted); font-size: 15px; }
.card .verdict { margin-top: 18px; font-weight: 700; padding: 8px 14px; border-radius: 999px; font-size: 16px; }
.v-exact { background: var(--good-soft); color: var(--good); }
.v-accents { background: var(--warn-soft); color: var(--warn); }
.v-wrong { background: var(--bad-soft); color: var(--bad); }
.card .yours { margin-top: 12px; color: var(--muted); font-size: 15px; }
.card .yours span { color: var(--ink); font-weight: 600; }

.grades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.grades .btn + .btn { margin-top: 0; }
.g {
  border: 0;
  border-radius: 14px;
  padding: 12px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.g b { font-size: 16px; }
.g span { font-size: 13px; opacity: .8; min-height: 1em; }
.g1 { background: var(--bad-soft); color: var(--bad); }
.g2 { background: var(--warn-soft); color: var(--warn); }
.g3 { background: var(--good-soft); color: var(--good); }
.g4 { background: var(--accent-soft); color: var(--accent); }

.typeform { margin-top: 16px; }
.typeform input { font-size: 22px; padding: 14px; text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.row2 .btn + .btn { margin-top: 0; }

.letters {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin: 10px 0 0;
}
.letters button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 9px;
  padding: 9px 0;
  font-size: 19px;
  cursor: pointer;
  touch-action: manipulation;
}
.letters button:active { background: var(--accent-soft); }

.trophy { font-size: 64px; margin-bottom: 8px; }
.page.center .sub { margin-bottom: 20px; }

/* ---------- words ---------- */

.search { margin: 0 0 10px; }
.search input { padding-left: 14px; }
.chips { margin: 0 0 14px; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.list li:first-child { border-top: 0; }
.list li:active { background: var(--bg); }
.list li div { flex: 1; min-width: 0; }
.list li b { display: block; font-weight: 600; }
.list li span { display: block; color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list:empty { display: none; }
.star { color: var(--dot-learning); font-style: normal; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.new { background: var(--dot-new); }
.dot.learning { background: var(--dot-learning); }
.dot.known { background: var(--dot-known); }
.legend { color: var(--muted); font-size: 14px; text-align: center; margin-top: 14px; }
.legend .dot { margin: 0 4px 0 10px; width: 8px; height: 8px; }

/* ---------- forms ---------- */

.form label { display: block; font-size: 15px; color: var(--muted); margin: 0 0 14px; }
.form label input, .form label select, .form label textarea { margin-top: 6px; color: var(--ink); }
.form .letters { margin: -6px 0 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; }
.form .check input { width: 22px; height: 22px; accent-color: var(--accent); }
.form .file { color: var(--accent-ink); margin: 16px 0; cursor: pointer; }
.form p { margin: 0 0 12px; }
.example-list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font: 16px/1.5 ui-monospace, Menlo, monospace; }
.preview img { width: 100%; border-radius: 14px; margin: 0 0 14px; }
.facts p { margin: 0 0 8px; font-size: 15px; }
.facts p:last-child { margin: 0; }
.plain { margin: 0 0 12px; padding-left: 20px; }
.err { color: var(--bad); min-height: 1em; text-align: center; }

.photos { list-style: none; margin: 0; padding: 0; }
.photos li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.photos li:first-child { border-top: 0; }
.photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--bg); }
.photos div { display: flex; flex-direction: column; font-size: 15px; }
.photos span { color: var(--muted); }
.photos em { font-style: normal; font-size: 14px; color: var(--warn); }
.photos em.done { color: var(--good); }

/* ---------- more ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; }
.stats b { display: block; font-size: 24px; }
.stats span { font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 22px; cursor: pointer; }
.stepper b { min-width: 2ch; text-align: center; font-size: 19px; }

/* ---------- login ---------- */

.login { text-align: center; padding-top: calc(env(safe-area-inset-top) + 64px); }
.login .form { text-align: left; margin-top: 28px; }
.logo {
  width: 88px; height: 88px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 40px; font-weight: 800;
  letter-spacing: -.03em;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tab {
  flex: 1;
  height: var(--tabbar);
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- grading ---------- */

.graded-tag { align-self: center; margin: -6px 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.report { width: 132px; height: 132px; margin: 0 auto 18px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.report .big { font-size: 56px; font-weight: 800; line-height: 1; }
.report .pl { font-size: 14px; font-weight: 600; margin-top: 4px; }
.report .en { font-size: 13px; opacity: .8; }
.report.top, .gchip.top { background: var(--good-soft); color: var(--good); }
.report.good, .gchip.good { background: var(--accent-soft); color: var(--accent); }
.report.mid, .gchip.mid { background: var(--warn-soft); color: var(--warn); }
.report.low, .gchip.low { background: var(--bad-soft); color: var(--bad); }
.missed { text-align: left; }
.gchip { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 14px; vertical-align: middle; }
.grades-list { list-style: none; margin: 0; padding: 0; }
.grades-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.grades-list li:first-child { border-top: 0; }
.grades-list .gchip { width: 36px; height: 36px; font-size: 18px; flex: none; }
.grades-list div { display: flex; flex-direction: column; }
.grades-list span { color: var(--muted); font-size: 14px; }

.btn.link-btn { border: 0; background: none; color: var(--accent); padding: 12px 8px 4px; font-size: 16px; }
