:root {
  --bg: #0e1013;
  --bg-2: #111419;
  --surface: #16191e;
  --surface-2: #1b1f25;
  --line: #262b33;
  --line-2: #313742;
  --text: #e7e9ec;
  --muted: #9aa1ab;
  --dim: #707781;
  --accent: #a7bcd6;
  --accent-soft: rgba(167, 188, 214, .13);
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }

body {
  margin: 0 auto;
  max-width: 760px;
  min-height: 100vh;
  background:
    radial-gradient(90% 340px at 50% -140px, rgba(167, 188, 214, .07), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------- header */

.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(14, 16, 19, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.toprow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
}

.brand {
  font-size: 15px; font-weight: 800;
  letter-spacing: .22em; color: var(--accent);
}

.iconbtn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  cursor: pointer; transition: color .15s, border-color .15s, transform .1s;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn:hover { color: var(--text); border-color: var(--line-2); }
.iconbtn.spin .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  display: flex; gap: 6px;
  padding: 0 12px 9px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 99px;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(167, 188, 214, .28);
}

/* ---------------------------------------------------------------- feed */

.feed { padding: 12px; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .12s, background .15s;
}
.card:active { transform: scale(.994); }
@media (hover: hover) { .card:hover { border-color: var(--line-2); background: var(--surface-2); } }

.hero { aspect-ratio: 16 / 9; background: var(--bg-2); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.body { padding: 12px 14px 13px; }

.meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 11px; color: var(--muted);
  letter-spacing: .01em;
}
.meta .sep { color: var(--dim); }

.cat {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700; font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
}
.cat::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .9;
}
.cat.games { color: #b3a6cc; }
.cat.3d { color: #a3bda9; }
.cat.auto { color: #c9b6a1; }
.cat.science { color: #9dbdbf; }
.cat.humor { color: #c3aab4; }

.card h2 {
  margin: 6px 0 5px;
  font-size: 18px; line-height: 1.24;
  font-weight: 750; letter-spacing: -.012em;
  color: var(--text);
}

.card .summary {
  margin: 0;
  font-size: 13.5px; line-height: 1.5;
  color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

.foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 9px;
  color: var(--dim); font-size: 11px;
}
.foot .icon { width: 17px; height: 17px; color: var(--accent); }

/* skeleton */
.sk { pointer-events: none; }
.skhero { height: 150px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
.skbody { padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.skline { height: 11px; border-radius: 6px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
.skline.w30 { width: 30%; } .skline.w90 { width: 90%; } .skline.w70 { width: 70%; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.empty {
  margin: 40px 12px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty .icon { width: 30px; height: 30px; color: var(--dim); }
.empty p { margin: 0; font-size: 13.5px; max-width: 300px; }

.more {
  margin: 2px 0 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 12px;
  padding: 12px; font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
.more:active { transform: scale(.995); }

/* ---------------------------------------------------------------- article */

.article {
  position: fixed; inset: 0; z-index: 40;
  max-width: 760px; margin: 0 auto;
  background: var(--bg);
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.article[hidden] { display: none; }

.a-top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(14, 16, 19, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.a-top .iconbtn { border-color: transparent; background: transparent; }
.a-top .src { font-size: 11.5px; color: var(--muted); }

.a-body { padding: 14px 16px calc(40px + env(safe-area-inset-bottom)); }

.a-hero {
  aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: var(--bg-2); margin-bottom: 14px;
}
.a-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.a-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); }
.a-meta .sep { color: var(--dim); }

.a-body h1 {
  margin: 8px 0 10px;
  font-size: 26px; line-height: 1.16;
  font-weight: 800; letter-spacing: -.022em;
}

.a-lead {
  margin: 0 0 6px;
  font-size: 15px; line-height: 1.55; color: var(--muted);
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}

.a-body p { margin: 14px 0; font-size: 16.5px; line-height: 1.72; color: var(--text); }
.a-body h2 { margin: 26px 0 8px; font-size: 19px; line-height: 1.3; font-weight: 750; letter-spacing: -.01em; }

.a-note {
  margin: 16px 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--muted); font-size: 13px;
}

.a-orig {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px; padding: 12px 15px;
  border: 1px solid rgba(167, 188, 214, .32); border-radius: 12px;
  background: var(--accent-soft); color: var(--text);
  font-size: 13.5px; font-weight: 650; text-decoration: none;
}
.a-orig .icon { width: 17px; height: 17px; color: var(--accent); }

.a-loading { padding: 24px 16px; color: var(--muted); font-size: 13px; }

@media (min-width: 620px) {
  .feed { padding: 16px; gap: 14px; }
  .card h2 { font-size: 19px; }
  .a-body { padding: 18px 22px 48px; }
}

/* ---------------------------------------------------------------- words ui */

.brandwrap { display: flex; align-items: center; gap: 8px; }

.lvlchip {
  font-size: 10.5px; font-weight: 750; letter-spacing: .04em;
  color: var(--accent); border: 1px solid rgba(167, 188, 214, .28);
  background: var(--accent-soft); border-radius: 99px; padding: 1px 7px;
}

.topactions { display: flex; align-items: center; gap: 6px; }

.iconbtn.on {
  color: var(--accent);
  border-color: rgba(167, 188, 214, .32);
  background: var(--accent-soft);
}

.hook {
  margin: 6px 0 0;
  padding-left: 8px;
  border-left: 2px solid rgba(167, 188, 214, .28);
  font-size: 12.5px; line-height: 1.42;
  color: #b9c6d6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hook:empty { display: none; }
body.no-hooks .hook { display: none !important; }

.a-tip {
  margin: -2px 0 4px;
  font-size: 11.5px; color: var(--dim);
}

.a-body .w {
  cursor: pointer; border-radius: 4px;
  transition: background .12s, color .12s;
}
.a-body .w:hover { background: var(--accent-soft); }
.a-body .w:active { background: rgba(167, 188, 214, .26); }

.a-feedback {
  display: flex; gap: 8px; margin: 26px 0 4px;
}
.a-feedback button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 12px; padding: 10px 8px; font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer;
}
.a-feedback button .icon { width: 16px; height: 16px; }
.a-feedback button:active { transform: scale(.985); }
.a-feedback.done { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- sheet */

.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet[hidden] { display: none; }

.sheet-bg {
  position: absolute; inset: 0;
  background: rgba(4, 6, 9, .62);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 760px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .55);
  animation: sheetup .18s ease-out;
}
@keyframes sheetup { from { transform: translateY(22px); opacity: .5; } }

.sheet-grip {
  width: 38px; height: 4px; border-radius: 99px;
  background: var(--line-2); margin: 0 auto 10px;
}
.sheet-x {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted);
  cursor: pointer;
}
.sheet-x .icon { width: 18px; height: 18px; }

.sh-word {
  font-size: 27px; font-weight: 800; letter-spacing: -.02em;
  padding-right: 44px; line-height: 1.15;
}
.sh-tr { margin-top: 4px; font-size: 19px; font-weight: 650; color: var(--accent); }
.sh-tr.loading { font-size: 14px; font-weight: 500; color: var(--dim); }
.sh-ctxnote {
  margin-top: 3px; font-size: 11px; letter-spacing: .02em; color: var(--dim);
}
.sh-ctxhint { margin-top: 5px; font-size: 11px; color: var(--dim); }

.sh-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 8px; font-size: 11.5px; color: var(--muted);
}
.sh-pos { color: var(--dim); }
.sh-lvl {
  color: var(--accent); border: 1px solid rgba(167, 188, 214, .28);
  background: var(--accent-soft); border-radius: 99px; padding: 1px 7px;
}
.sh-enc { color: var(--dim); }

.sh-alts-label {
  margin-top: 12px; font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.sh-alts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sh-alts span {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px;
  background: var(--bg-2);
}

.sh-sentence {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.sh-sent-en { font-size: 13px; line-height: 1.5; color: var(--muted); }
.sh-sent-ru { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--text); }
.sh-sent-btn {
  margin-top: 8px; border: 1px solid rgba(167, 188, 214, .3);
  background: var(--accent-soft); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer;
}
.sh-sent-btn:disabled { opacity: .6; }

.sh-actions {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
}
.sh-know {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(167, 188, 214, .3);
  background: var(--accent-soft); color: var(--text);
  border-radius: 11px; padding: 10px 14px;
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.sh-know .icon { width: 16px; height: 16px; color: var(--accent); }
.sh-know:disabled { opacity: .55; cursor: default; }
.sh-hint { font-size: 11px; color: var(--dim); }

/* ---------------------------------------------------------------- vocab */

.v-body { padding-top: 16px; }

.v-hero {
  border: 1px solid var(--line);
  border-radius: 16px; padding: 16px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(167, 188, 214, .1), transparent 60%),
    var(--surface);
}
.v-level {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.v-points { margin-top: 3px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.v-points span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.v-track {
  height: 6px; border-radius: 99px; background: var(--surface-2);
  overflow: hidden; margin-top: 12px;
}
.v-track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.v-sub { margin-top: 7px; font-size: 11.5px; color: var(--dim); }

.v-stats { display: flex; gap: 8px; margin: 10px 0 14px; }
.v-stats > div {
  flex: 1; text-align: center; padding: 10px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.v-stats b { display: block; font-size: 19px; font-weight: 800; }
.v-stats span { font-size: 10.5px; color: var(--muted); }

.v-dist {
  display: flex; align-items: flex-end; gap: 10px;
  height: 78px; padding: 8px 14px 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2);
  margin-bottom: 16px;
}
.v-d { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.v-d i { width: 100%; max-width: 26px; background: rgba(167, 188, 214, .35); border-radius: 4px 4px 0 0; }
.v-d span { margin-top: 4px; font-size: 9.5px; color: var(--dim); }
.v-d b { font-size: 10.5px; font-weight: 700; color: var(--muted); }

.v-list { border-top: 1px solid var(--line); }
.v-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.v-row:active { background: var(--surface-2); }
.v-word { font-size: 14.5px; font-weight: 700; }
.v-tr {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-lvl {
  font-size: 10.5px; font-weight: 700; color: var(--accent);
  border: 1px solid rgba(167, 188, 214, .3); border-radius: 99px; padding: 2px 7px;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 90; pointer-events: none;
  background: #1c222b; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 11px;
  padding: 9px 14px; font-size: 12.5px; font-weight: 600;
  opacity: 0; transition: opacity .18s, transform .18s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .brand { letter-spacing: .16em; }
  .iconbtn { width: 35px; height: 35px; }
  .topactions { gap: 4px; }
}

.a-hook {
  font-size: 14px; line-height: 1.45;
  margin: 4px 0 12px;
  -webkit-line-clamp: 3;
}

/* ---------------------------------------------------------------- dictionary */

.v-input {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; -webkit-appearance: none; appearance: none;
}
.v-input::placeholder { color: var(--dim); }
.v-input:focus { outline: none; border-color: var(--accent); }

.v-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid rgba(167, 188, 214, .3); background: var(--accent-soft);
  color: var(--text); border-radius: 11px; padding: 10px 14px; font: inherit;
  font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.v-btn .icon { width: 15px; height: 15px; }

.v-add, .v-tr {
  margin-top: 14px; padding: 12px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface);
}
.v-add { display: flex; flex-direction: column; gap: 8px; }
.v-add-row { display: flex; gap: 8px; align-items: stretch; }
.v-add-row .v-input { flex: 1; }

.v-tr-title {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; font-weight: 650;
}
.v-tr-title .icon { width: 15px; height: 15px; }
.v-tr { display: flex; flex-direction: column; gap: 8px; }
.v-tr-out { display: flex; flex-direction: column; gap: 8px; }
.v-tr-line { font-size: 15px; line-height: 1.4; color: var(--text); }
.v-tr-line b { font-size: 17px; color: var(--accent); }
.v-tr-line.loading { color: var(--dim); }
.v-pos { font-size: 11.5px; color: var(--dim); margin-left: 4px; }
.v-tr-alts { display: flex; flex-wrap: wrap; gap: 6px; }
.v-tr-alts span {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 8px; background: var(--bg-2);
}

.v-search { margin-top: 14px; }

.v-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.v-tab {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 99px; padding: 6px 11px; font: inherit; font-size: 12.5px;
  font-weight: 600;
}
.v-tab b { font-weight: 700; color: var(--dim); }
.v-tab[aria-pressed="true"] {
  color: var(--accent); border-color: rgba(167, 188, 214, .4);
  background: var(--accent-soft);
}
.v-tab[aria-pressed="true"] b { color: var(--accent); }

.v-grp-h {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 2px 8px; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim); font-weight: 700;
}
.v-grp-h span { color: var(--muted); }

.v-own {
  font-style: normal; font-size: 9.5px; letter-spacing: .03em; color: var(--accent);
  border: 1px solid rgba(167, 188, 214, .3); border-radius: 99px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}
.v-tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; align-items: center; }
.v-tags i {
  font-style: normal; font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px;
}
.v-tags i.v-lvl { color: var(--accent); border-color: rgba(167, 188, 214, .3); }

.sh-del {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); border-radius: 11px; padding: 10px 12px;
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.sh-del .icon { width: 14px; height: 14px; }

.tr-page { margin-top: 14px; }
.tr-page .v-tr-title { font-size: 13px; }
.tr-hint { margin-top: 12px; font-size: 12px; line-height: 1.45; color: var(--dim); }
