/* Wortkasten – styles. Phone first; from 900 px a sidebar layout. */
:root {
  --ink: #0F1B33;
  --muted: #4A5875;
  --muted-2: #33415C;
  --ground: #F3F6FB;
  --card: #FFFFFF;
  --line: #DCE5F3;
  --line-2: #EDF2FA;
  --input: #B9C8E2;
  --blue: #1F5FD6;
  --blue-dark: #0B3E9E;
  --navy: #0B2A5B;
  --tint: #E6EEFB;
  --tint-2: #DCE7FA;
  --der: #1F5FD6;
  --die: #B8325E;
  --das: #17784E;
  --ok: #17784E;
  --ok-tint: #E3F4EC;
  --bad: #B8325E;
  --bad-tint: #FBE7EE;
  --shadow: 0 1px 2px rgba(15, 27, 51, .06), 0 8px 24px rgba(31, 95, 214, .08);
  --radius: 16px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 500 15px/1.5 var(--font);
}
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(31, 95, 214, .45); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 800; }
p { margin: 0; }

/* ------------------------------------------------------------------ layout */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.view { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 16px 96px; display: flex; flex-direction: column; gap: 16px; outline: none; }
.view.bare { max-width: none; padding: 0; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head .sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > * { flex: 1 1 380px; min-width: 0; }
.cols > .wide { flex: 1.4 1 460px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

/* mobile tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px;
  text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 700;
}
.tabbar a .ic { padding: 4px 16px; border-radius: 999px; display: flex; }
.tabbar a.on { color: var(--blue); font-weight: 800; }
.tabbar a.on .ic { background: var(--tint); }

/* desktop sidebar */
.side {
  display: none; background: var(--navy); color: #fff; padding: 22px 14px; flex-direction: column; gap: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 800; font-size: 19px; text-decoration: none; color: inherit; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: #C9D8F2; text-decoration: none; font-weight: 700; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: var(--blue); color: #fff; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.me a { color: #C9D8F2; font-size: 13px; font-weight: 700; }
.me a.avatar { color: var(--navy); text-decoration: none; }
.credits { font-size: 11px; color: #9FB3D6; line-height: 1.45; padding: 0 6px; }
.credits a { color: #C9D8F2; }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--tint-2); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; border: 0; }

@media (min-width: 900px) {
  .app { flex-direction: row; }
  .side { display: flex; width: 240px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
  .tabbar { display: none; }
  .view { padding: 28px 32px 48px; gap: 22px; }
  h1 { font-size: 28px; }
  .m-only { display: none !important; }
}
@media (max-width: 899px) { .d-only { display: none !important; } }

/* ------------------------------------------------------------------ elements */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(15, 27, 51, .05); }
.card.big { border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--blue); color: #fff;
  font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: var(--blue-dark); color: #fff; }
.btn.navy { background: var(--navy); }
.btn.navy:hover { background: #071d40; }
.btn.ghost { background: var(--card); color: var(--blue); border: 1px solid var(--blue); }
.btn.ghost:hover { background: var(--tint); color: var(--blue-dark); }
.btn.plain { background: var(--card); color: var(--navy); border: 1px solid var(--input); }
.btn.plain:hover { background: var(--ground); color: var(--navy); }
.btn.danger { background: var(--card); color: var(--bad); border: 2px solid var(--bad); }
.btn.danger:hover { background: var(--bad-tint); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn.lg { min-height: 56px; border-radius: 16px; font-size: 16px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.iconbtn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.iconbtn:hover { background: var(--tint); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 700; }
.chip.light { background: var(--tint); color: var(--navy); }
.chip.outline { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; max-width: 100%; overflow-wrap: anywhere; }
.chip.ok { background: var(--ok-tint); color: var(--ok); }
.chip.bad { background: var(--bad-tint); color: var(--bad); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--blue); font-size: 11px; font-weight: 800; }
.art-der { color: var(--der); } .art-die { color: var(--die); } .art-das { color: var(--das); } .art-x { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 700; color: var(--muted-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--input); padding: 0 14px;
  background: #fff; font-weight: 600; font-size: 16px;
}
textarea.input { padding: 10px 12px; min-height: 120px; font: 500 14px/1.55 var(--mono); resize: vertical; }
.input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(31, 95, 214, .18); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.err { font-size: 13px; color: var(--bad); font-weight: 700; }
.seg { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; flex-wrap: wrap; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted-2); font-weight: 700; font-size: 13px; padding: 0 12px; white-space: nowrap; }
.seg button.on { background: var(--blue); color: #fff; }
.seg.dark button.on { background: var(--navy); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--tint); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--tint); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--blue); border-radius: 999px; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(11, 42, 91, .3); max-width: calc(100% - 32px);
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 700 11px var(--font); background: rgba(255, 255, 255, .22); }
.btn.ghost kbd, .btn.danger kbd { background: var(--tint); }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--navy); }
.login .hero { padding: 64px 28px 36px; color: #fff; display: flex; flex-direction: column; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.login .hero .logo { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; background: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.login .hero h1 { font-size: 32px; }
.login .hero p { color: #C9D8F2; font-size: 16px; }
.login .sheet { flex: 1; background: var(--ground); border-radius: 28px 28px 0 0; padding: 28px 24px 32px; }
.login form { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.login .note { display: flex; gap: 12px; align-items: flex-start; background: var(--tint); border-radius: 14px; padding: 14px 16px; font-size: 13px; color: var(--muted-2); }
.login .art-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.login .art-pills span { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 700; }
.login .art-pills b { font-weight: 800; }
.login .p-der { color: #8FB4F5; } .login .p-die { color: #F2A3BE; } .login .p-das { color: #8EDDB6; }

/* ------------------------------------------------------------------ translate */
.langbar { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 5px; }
.langbar span { flex: 1; text-align: center; font-weight: 700; font-size: 14px; padding: 8px; border-radius: 10px; }
.langbar span.from { background: var(--tint); color: var(--navy); }
.searchrow { display: flex; gap: 8px; }
.searchrow .input { min-height: 54px; border: 2px solid var(--blue); font-size: 19px; font-weight: 700; border-radius: 14px; }
.searchrow .btn { min-height: 54px; min-width: 54px; border-radius: 14px; padding: 0 16px; }
.alts { display: flex; gap: 6px; flex-wrap: wrap; }
.alts button { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--muted-2); min-height: 36px; }
.alts button.on { border-color: var(--blue); color: var(--blue); background: var(--tint); }
.entry { display: flex; flex-direction: column; gap: 14px; }
.entry .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.entry .word { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.entry .forms { font-size: 13px; color: var(--muted); font-weight: 600; }
.entry .tr { font-size: 21px; font-weight: 800; color: var(--blue); }
.senses { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.senses li { font-size: 15px; font-weight: 600; }
.senses .tags { font-size: 12px; color: var(--muted); font-weight: 600; }
.example { background: var(--ground); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.example .de { font-size: 15px; font-weight: 700; }
.example .en { font-size: 13px; color: var(--muted); }
.saved { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ok); flex-wrap: wrap; }
.saved .btn { margin-left: auto; }
.wordrow { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 11px 14px; text-decoration: none; color: inherit; min-height: 48px; }
a.wordrow:hover { background: #fafcff; color: inherit; }
.wordrow .w { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wordrow .t { font-size: 14px; color: var(--muted); text-align: right; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wordrow .k { font-size: 11px; font-weight: 800; color: var(--blue); }

/* ------------------------------------------------------------------ words / groups */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group .gh { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.group .cnt { font-size: 13px; font-weight: 800; color: var(--navy); background: var(--ground); border-radius: 8px; padding: 4px 8px; white-space: nowrap; }
.group .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.group .pr { display: flex; align-items: center; gap: 10px; }
.group .pr span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.group.rep { border: 2px solid var(--bad-tint); }
.wordlist { display: flex; flex-direction: column; gap: 6px; }
.wordlist .wordrow { background: var(--ground); }

/* ------------------------------------------------------------------ practice */
.practice { display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.ptop { display: flex; align-items: center; gap: 12px; }
.score { display: flex; gap: 8px; flex-wrap: wrap; }
.flash { min-height: 380px; display: flex; flex-direction: column; gap: 16px; }
.flash .ftop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.flash .mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 8px 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex-shrink: 0; margin: 0; }
.flash .q.long { font-size: 24px; }
.flash .q { font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.flash .a { width: 100%; border-top: 1px solid var(--line-2); padding-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.flash .a .tr { font-size: 26px; font-weight: 800; color: var(--blue); }
.flash .example { width: 100%; text-align: left; }
.answers { display: flex; gap: 10px; }
.answers .btn { flex: 1; }
.verdict { font-weight: 800; font-size: 15px; }
.typed { font-size: 18px; text-align: center; }
.arts { display: flex; gap: 10px; width: 100%; }
.arts .btn { flex: 1; font-size: 18px; }
@media (min-width: 900px) { .check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex-shrink: 0; margin: 0; }
.flash .q.long { font-size: 24px; }
.flash .q { font-size: 48px; } .flash { min-height: 440px; } }

/* summary */
.sumhead { background: var(--navy); color: #fff; border-radius: 20px; padding: 22px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#5B9BFF calc(var(--p) * 1%), rgba(255, 255, 255, .14) 0); }
.ring div { width: 96px; height: 96px; border-radius: 50%; background: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring b { font-size: 28px; line-height: 1; }
.ring span { font-size: 11px; color: #C9D8F2; font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--card); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.tile b { font-size: 24px; }
.tile span { font-size: 12px; font-weight: 700; color: var(--muted-2); }

/* tables (admin) */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td.nw { white-space: nowrap; }
td .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 14px; }
.st { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st.ok { background: var(--ok-tint); color: var(--ok); }
.st.inv { background: var(--tint); color: var(--blue); }
.st.off { background: #EEF1F6; color: var(--muted); }
.code { font: 500 12.5px var(--mono); background: #fff; border-radius: 9px; padding: 10px 12px; overflow-wrap: anywhere; user-select: all; }
pre.code { white-space: pre-wrap; max-height: 260px; overflow: auto; background: var(--navy); color: #DCE7FA; margin: 0; }
