/* =========================================================
   SeeEnglish — visual system
   UI surfaces use solid colours only. Gradients are reserved
   for the fixed ambient background behind the interface.
   ========================================================= */

:root {
  --font-sans: 'Manrope Variable', 'Segoe UI Variable', 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  --font-serif: 'Newsreader Variable', 'Iowan Old Style', Georgia, 'Times New Roman',
    serif;
  --font-mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --ink: #10243d;
  --ink-deep: #07182c;
  --ink-soft: #3f5671;
  --muted: #6c8098;
  --faint: #91a2b5;

  --accent: #1f64dd;
  --accent-deep: #1753bd;
  --accent-ink: #12335c;
  --accent-soft: #e7f0ff;
  --accent-wash: rgba(31, 100, 221, 0.08);

  --glass: rgba(250, 253, 255, 0.54);
  --glass-strong: rgba(252, 254, 255, 0.72);
  --glass-solid: rgba(255, 255, 255, 0.82);
  --line: rgba(35, 76, 126, 0.13);
  --line-strong: rgba(35, 76, 126, 0.2);
  --white-line: rgba(255, 255, 255, 0.88);

  --danger: #bd4b4b;
  --danger-soft: #fdf1f1;
  --green: #3d9b77;

  --shadow-xs: 0 2px 8px rgba(31, 68, 117, 0.05);
  --shadow-sm: 0 8px 24px rgba(31, 68, 117, 0.07);
  --shadow-md: 0 18px 48px rgba(31, 68, 117, 0.11);
  --shadow-lg: 0 30px 80px rgba(31, 68, 117, 0.16);

  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 16px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 96px;
  --dock-h: 92px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #edf5fd;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  color: var(--ink);
  background: #edf5fd;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button,
input,
textarea {
  margin: 0;
  color: inherit;
  font: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

input,
textarea {
  border: 0;
  outline: 0;
}

textarea {
  resize: none;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
blockquote {
  margin: 0;
}

::selection {
  color: var(--ink-deep);
  background: #cfe2ff;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(51, 95, 147, 0.22);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(51, 95, 147, 0.34);
  border: 3px solid transparent;
  background-clip: padding-box;
}

:focus-visible {
  outline: 2px solid rgba(31, 100, 221, 0.62);
  outline-offset: 3px;
}

#root,
.app {
  min-height: 100svh;
}

.app {
  position: relative;
  isolation: isolate;
}

/* =========================================================
   Ambient background
   ========================================================= */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #edf5fd;
}

.backdrop__base {
  position: absolute;
  inset: 0;
  background-color: #edf5fd;
  background-image:
    radial-gradient(ellipse 82% 68% at 8% 2%, rgba(190, 222, 255, 0.86) 0%, rgba(190, 222, 255, 0) 62%),
    radial-gradient(ellipse 72% 64% at 94% 18%, rgba(216, 235, 255, 0.92) 0%, rgba(216, 235, 255, 0) 64%),
    radial-gradient(ellipse 88% 72% at 50% 106%, rgba(196, 225, 255, 0.86) 0%, rgba(196, 225, 255, 0) 70%),
    linear-gradient(148deg, #f8fbff 0%, #eaf4fd 48%, #f5faff 100%);
}

.backdrop__wash {
  position: absolute;
  filter: blur(3px);
  opacity: 0.74;
  mix-blend-mode: screen;
}

.backdrop__wash--one {
  top: -16%;
  left: -10%;
  width: 62vw;
  height: 55vw;
  border-radius: 42% 58% 63% 37% / 48% 38% 62% 52%;
  background: radial-gradient(circle at 36% 34%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0) 69%);
}

.backdrop__wash--two {
  top: 4%;
  right: -16%;
  width: 54vw;
  height: 64vw;
  border-radius: 57% 43% 34% 66% / 44% 59% 41% 56%;
  background: radial-gradient(circle at 48% 42%, rgba(210, 234, 255, 0.9) 0%, rgba(210, 234, 255, 0) 68%);
}

.backdrop__wash--three {
  bottom: -28%;
  left: 20%;
  width: 70vw;
  height: 48vw;
  border-radius: 64% 36% 52% 48% / 38% 62% 38% 62%;
  background: radial-gradient(circle at 52% 48%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0) 70%);
}

.backdrop__dots {
  position: absolute;
  inset: 0;
  opacity: 0.58;
  background-image: radial-gradient(circle at 1px 1px, rgba(46, 93, 155, 0.15) 1.05px, transparent 1.25px);
  background-size: 27px 27px;
  -webkit-mask-image: radial-gradient(ellipse 82% 72% at 50% 46%, transparent 4%, #000 72%);
  mask-image: radial-gradient(ellipse 82% 72% at 50% 46%, transparent 4%, #000 72%);
}

.backdrop__orb {
  position: absolute;
  top: -150px;
  right: -90px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 0 0 32px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0.9;
}

/* Floating vocabulary fragments */
.floaters {
  position: absolute;
  inset: 0;
}

.floater {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: rgba(35, 79, 132, 0.56);
  opacity: 0.76;
  transform: rotate(var(--rotate));
  animation: floater-drift var(--duration) ease-in-out infinite alternate;
  animation-delay: var(--delay);
  will-change: transform;
}

.floater--word {
  padding: 12px 16px 11px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow:
    0 14px 34px rgba(43, 84, 139, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(15px) saturate(140%);
  backdrop-filter: blur(15px) saturate(140%);
}

.floater__word {
  font-family: var(--font-serif);
  font-size: 19px;
  font-style: italic;
  font-weight: 420;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.floater__detail {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  opacity: 0.66;
  text-transform: uppercase;
}

.floater--glyph {
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 12px 28px rgba(43, 84, 139, 0.06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.floater--glyph .floater__word {
  font-size: 22px;
  font-style: normal;
}

.floater--ring {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(47, 99, 161, 0.22);
  border-radius: 50%;
}

.floater__ring {
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(47, 99, 161, 0.12);
  border-radius: 50%;
}

.floater--index {
  width: 62px;
  padding: 9px 10px;
  border-left: 1px solid rgba(42, 90, 148, 0.22);
}

.floater__index {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 460;
  line-height: 1;
}

.floater--quote .floater__word {
  font-size: 26px;
  opacity: 0.8;
}

.floater--plus,
.floater--dot {
  align-items: center;
  justify-content: center;
}

.floater__plus {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 300;
  color: rgba(43, 91, 149, 0.32);
}

.floater__dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(39, 94, 165, 0.24);
  box-shadow: 0 0 0 6px rgba(39, 94, 165, 0.05);
}

/* =========================================================
   App frame / top bar
   ========================================================= */

.app-main {
  position: relative;
  z-index: 5;
  width: 100%;
  min-height: 100svh;
  padding: calc(var(--topbar-h) + 10px) clamp(20px, 4vw, 56px) calc(var(--dock-h) + 54px);
}

.page-frame {
  width: 100%;
  will-change: opacity, transform, filter;
}

.page-frame.is-entering {
  animation: page-in 0.56s var(--ease) both;
}

.page-frame.is-leaving {
  pointer-events: none;
  animation: page-out 0.17s ease-in both;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 25px clamp(20px, 4vw, 56px) 0;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  border-radius: 14px;
}

.brand__mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: var(--ink-deep);
  box-shadow:
    0 9px 20px rgba(10, 34, 64, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.brand:hover .brand__mark {
  transform: translateY(-2px) rotate(-2deg);
  box-shadow:
    0 13px 26px rgba(10, 34, 64, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand__letter {
  margin-top: -2px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 26px;
  font-style: italic;
  font-weight: 450;
  line-height: 1;
}

.brand__dot {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--ink-deep);
  border-radius: 50%;
  background: #79b6ff;
  box-sizing: content-box;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__name {
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.brand__cn {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 520;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 34px;
  padding-top: 3px;
  color: var(--muted);
}

.topbar__counter,
.topbar__words {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.topbar__counter span,
.topbar__words span {
  color: var(--faint);
}

.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  box-shadow: var(--shadow-xs);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.status-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 155, 119, 0.12);
  animation: status-pulse 2.4s ease-in-out infinite;
}

.status-pill.is-offline .status-pill__dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(189, 75, 75, 0.12);
  animation: none;
}

/* =========================================================
   Shared type / controls
   ========================================================= */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(38, 82, 136, 0.66);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 560;
  letter-spacing: 0.21em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow__line {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--accent);
  opacity: 0.62;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(61, 155, 119, 0.1);
  animation: status-pulse 2s ease-in-out infinite;
}

.pulse-dot.is-warm {
  background: #cf8b35;
  box-shadow: 0 0 0 4px rgba(207, 139, 53, 0.1);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
}

.glass {
  border: 1px solid var(--white-line);
  background: var(--glass);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 0.25s var(--ease),
    background-color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.25s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.5;
  transform: none;
}

.button--primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow:
    0 12px 26px rgba(31, 100, 221, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.button--primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow:
    0 16px 32px rgba(31, 100, 221, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.button--ghost {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.44);
  border-color: var(--line);
}

.button--ghost:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--line-strong);
}

.button--outline {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.38);
  border-color: var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.button--outline:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line-strong);
}

.spin {
  animation: spin 0.9s linear infinite;
}

/* =========================================================
   Add / capture page
   ========================================================= */

.add-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding-top: clamp(68px, 12.8vh, 142px);
  transition: padding-top 0.64s var(--ease);
}

.add-page.is-composing {
  padding-top: 2px;
}

.add-page__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-height: 290px;
  margin-bottom: 32px;
  overflow: hidden;
  text-align: center;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 0.5s var(--ease),
    margin 0.5s var(--ease),
    opacity 0.32s ease,
    transform 0.5s var(--ease);
}

.hero.is-hidden {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
}

.hero__eyebrow {
  margin-bottom: 22px;
}

.hero__title {
  color: var(--ink);
  font-size: clamp(43px, 5.4vw, 64px);
  font-weight: 710;
  letter-spacing: -0.062em;
  line-height: 1.08;
}

.hero__period {
  color: var(--accent);
}

.hero__copy {
  max-width: 620px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 440;
  letter-spacing: 0.005em;
  line-height: 1.85;
}

.hero__rule {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(420px, 70%);
  margin-top: 27px;
}

.hero__rule > span:first-child,
.hero__rule > span:last-child {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.hero__rule-text {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  white-space: nowrap;
}

/* Search */
.search-zone {
  position: relative;
  z-index: 22;
  width: 100%;
  max-width: 800px;
}

.search-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.search-field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 66px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 19px;
  background: var(--glass-strong);
  box-shadow:
    0 18px 52px rgba(37, 80, 137, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  transition:
    border-color 0.25s ease,
    box-shadow 0.3s ease,
    background-color 0.25s ease;
}

.search-field:focus-within {
  border-color: rgba(45, 108, 200, 0.42);
  background: rgba(254, 255, 255, 0.86);
  box-shadow:
    0 22px 60px rgba(37, 80, 137, 0.14),
    0 0 0 4px rgba(31, 100, 221, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.search-field__icon {
  flex: 0 0 auto;
  color: #54759b;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 440;
  letter-spacing: -0.005em;
}

.search-field input::placeholder {
  color: #8799ad;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 430;
  letter-spacing: 0.005em;
}

.search-field input:read-only {
  cursor: default;
}

.search-field__kbd {
  flex: 0 0 auto;
  width: 23px;
  height: 22px;
  border-radius: 6px;
  font-size: 10px;
}

.search-field__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 50%;
  background: rgba(27, 63, 108, 0.06);
  color: var(--muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.search-field__clear:hover {
  background: rgba(27, 63, 108, 0.11);
  color: var(--ink);
}

.search-field__loading {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  padding-right: 2px;
}

.search-field__loading span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: loading-dot 1.05s ease-in-out infinite;
}

.search-field__loading span:nth-child(2) {
  animation-delay: 0.13s;
}

.search-field__loading span:nth-child(3) {
  animation-delay: 0.26s;
}

.capture-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 126px;
  flex: 0 0 126px;
  height: 66px;
  border: 1px solid var(--accent);
  border-radius: 19px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: 0.02em;
  box-shadow:
    0 16px 34px rgba(31, 100, 221, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s var(--ease),
    box-shadow 0.25s ease,
    opacity 0.2s ease;
}

.capture-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow:
    0 20px 40px rgba(31, 100, 221, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.capture-button:active:not(:disabled) {
  transform: translateY(0);
}

.capture-button.is-supplement {
  background: var(--ink-deep);
  border-color: var(--ink-deep);
  box-shadow:
    0 16px 34px rgba(9, 31, 57, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.capture-button.is-supplement:hover:not(:disabled) {
  background: #0d2848;
  border-color: #0d2848;
}

.capture-button:disabled {
  opacity: 0.46;
  transform: none;
  box-shadow: none;
}

.search-caption {
  margin-top: 15px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-align: center;
}

.search-caption kbd {
  height: 17px;
  min-width: 17px;
  font-size: 8px;
  vertical-align: middle;
}

.search-error {
  margin-top: 13px;
  color: var(--danger);
  font-size: 11px;
  text-align: center;
}

/* Match panel */
.match-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  background: rgba(252, 254, 255, 0.88);
  box-shadow:
    0 28px 76px rgba(31, 69, 124, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  backdrop-filter: blur(30px) saturate(160%);
  transform-origin: top center;
  animation: panel-in 0.28s var(--ease) both;
}

.match-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px 8px;
}

.match-panel__count {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.match-panel__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 322px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--ink);
  text-align: left;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.match-row:hover {
  background: rgba(31, 100, 221, 0.05);
}

.match-row.is-selected {
  border-color: rgba(31, 100, 221, 0.14);
  background: #eef5ff;
}

.match-row__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.match-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.match-row__word {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 470;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.match-row__form {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(31, 100, 221, 0.07);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.match-badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 620;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}

.match-badge--exact {
  background: var(--accent-soft);
  color: var(--accent);
}

.match-badge--stored {
  background: #e9f5ef;
  color: #2d7e5e;
}

.match-badge--derived {
  background: #f0f4f9;
  color: #5c7189;
}

.match-badge--related {
  background: #fbf2e8;
  color: #9a6a2f;
}

.match-row__note {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-row__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.match-row:hover .match-row__arrow,
.match-row.is-selected .match-row__arrow {
  background: #fff;
  color: var(--accent);
  transform: translate(1px, -1px);
}

.match-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 5px;
  padding: 10px 14px 5px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.match-panel__foot kbd {
  height: 18px;
  min-width: 25px;
  font-size: 8px;
  vertical-align: middle;
}

.match-panel--new {
  padding: 0;
}

.new-match {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 19px;
}

.new-match__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.new-match__title {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}

.new-match__copy {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.match-panel--loading {
  padding-bottom: 12px;
}

.skeleton-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 15px;
}

.skeleton-row span {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(31, 69, 122, 0.08);
  animation: skeleton-pulse 1.25s ease-in-out infinite;
}

.skeleton-row span:first-child {
  width: 26%;
  height: 11px;
}

.skeleton-row span:last-child {
  width: 62%;
}

/* Composer */
.composer-wrap {
  width: 100%;
  max-width: 800px;
  margin: 20px auto 0;
  animation: composer-in 0.5s var(--ease) both;
}

.composer-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 15px;
  padding: 0 4px;
}

.composer-intro p {
  color: var(--muted);
  font-size: 11.5px;
  text-align: right;
}

.composer-card {
  padding: clamp(20px, 2.8vw, 29px);
  border-radius: var(--radius-xl);
}

.composer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 21px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.composer-head__word {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.composer-word {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 480;
  letter-spacing: -0.025em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.composer-head__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 680;
  letter-spacing: 0.025em;
}

.field__index {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 520;
  letter-spacing: 0.08em;
}

.field__label em {
  color: var(--faint);
  font-size: 8.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.field textarea,
.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(35, 76, 126, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.75;
  transition:
    border-color 0.22s ease,
    background-color 0.22s ease,
    box-shadow 0.22s ease;
}

.field textarea {
  min-height: 72px;
}

.field--note textarea {
  min-height: 130px;
}

.field textarea::placeholder,
.field input::placeholder {
  color: #93a3b5;
  font-size: 11.5px;
}

.field textarea:focus,
.field input:focus {
  border-color: rgba(31, 100, 221, 0.37);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(31, 100, 221, 0.065);
}

.field__hint {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 19px;
}

/* Relation picker */
.relation-picker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.relation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.relation-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 9px;
  border: 1px solid rgba(31, 100, 221, 0.13);
  border-radius: 999px;
  background: #edf4ff;
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 570;
  line-height: 1.4;
}

.relation-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: #6c88aa;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.relation-chip button:hover {
  background: rgba(31, 100, 221, 0.1);
  color: var(--accent);
}

.relation-chip--static {
  padding: 4px 9px;
}

.relation-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 43px;
  padding: 0 12px;
  border: 1px solid rgba(35, 76, 126, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  color: #6c88a9;
  transition:
    border-color 0.22s ease,
    background-color 0.22s ease,
    box-shadow 0.22s ease;
}

.relation-search:focus-within {
  border-color: rgba(31, 100, 221, 0.37);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(31, 100, 221, 0.065);
}

.relation-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  font-size: 11.5px;
}

.relation-search input::placeholder {
  color: #93a3b5;
  font-size: 10.5px;
}

.relation-search input:disabled {
  cursor: not-allowed;
}

.relation-search__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  color: var(--muted);
}

.relation-search__clear:hover {
  background: rgba(27, 63, 108, 0.08);
}

.relation-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 45;
  max-height: 214px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  background: rgba(252, 254, 255, 0.97);
  box-shadow: 0 20px 46px rgba(30, 67, 119, 0.16);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  animation: panel-in 0.2s var(--ease) both;
}

.relation-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 9px;
  color: var(--ink-soft);
  text-align: left;
}

.relation-result:hover {
  background: var(--accent-wash);
  color: var(--accent);
}

.relation-result__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.relation-result__word {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
}

.relation-result__note {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 10px;
  color: var(--faint);
  font-size: 10px;
}

.form-alert {
  margin-top: 18px;
  padding: 11px 13px;
  border: 1px solid rgba(189, 75, 75, 0.16);
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
  line-height: 1.6;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.composer-actions__note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 9.5px;
}

.local-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 155, 119, 0.1);
}

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

/* Success */
.save-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 20px auto 0;
  padding: clamp(30px, 5vw, 54px) 28px clamp(28px, 4vw, 42px);
  border-radius: var(--radius-xl);
  text-align: center;
  animation: composer-in 0.52s var(--ease) both;
}

.save-success__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border: 1px solid rgba(31, 100, 221, 0.14);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(31, 100, 221, 0.1);
}

.save-success__word {
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 460;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.save-success__copy {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.save-success__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.save-success__meta b {
  margin-right: 3px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.save-success__actions {
  display: flex;
  gap: 9px;
  margin-top: 26px;
}

/* =========================================================
   Page headings / shared pages
   ========================================================= */

.page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding-top: 9px;
}

.page-head {
  margin-bottom: 30px;
}

.page-head__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 20px;
}

.page-title {
  max-width: 820px;
  color: var(--ink);
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1.08;
}

.page-subtitle {
  max-width: 620px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.page-stamp {
  flex: 0 0 auto;
  margin-bottom: 5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.17em;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* =========================================================
   Library page
   ========================================================= */

.library-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  margin-top: 27px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.library-stats b {
  margin-right: 5px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow-xs);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 620;
  transition: background-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.segmented button span {
  font-family: var(--font-mono);
  font-size: 8px;
  opacity: 0.66;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(32, 69, 119, 0.08);
}

.library-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 310px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.44);
  color: #6e87a3;
  box-shadow: var(--shadow-xs);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.library-search:focus-within {
  border-color: rgba(31, 100, 221, 0.32);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 3px rgba(31, 100, 221, 0.06);
}

.library-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  font-size: 11px;
}

.library-search input::placeholder {
  color: #8c9eb2;
  font-size: 10.5px;
}

.library-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  color: var(--muted);
}

.library-search button:hover {
  background: rgba(27, 63, 108, 0.08);
}

.library-loading,
.library-error,
.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 260px;
  padding: 36px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.library-loading {
  flex-direction: row;
  min-height: 150px;
  color: var(--muted);
  font-size: 11.5px;
}

.library-error p {
  color: var(--danger);
  font-size: 12px;
}

.library-empty__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(31, 100, 221, 0.1);
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}

.library-empty h2 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.library-empty p {
  max-width: 360px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.library-no-results {
  padding: 38px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Word cards */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: 0 8px 24px rgba(32, 69, 119, 0.04);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  transition:
    background-color 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease;
}

.word-card:hover {
  border-color: rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 30px rgba(32, 69, 119, 0.06);
}

.word-card.is-open {
  border-color: rgba(31, 100, 221, 0.16);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 16px 38px rgba(32, 69, 119, 0.08);
}

.word-card__main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 15px 20px;
  color: var(--ink);
  text-align: left;
}

.word-card__number {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.word-card__content {
  min-width: 0;
}

.word-card__title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.word-card__word {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 480;
  letter-spacing: -0.022em;
  line-height: 1.15;
}

.word-card__form {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(31, 100, 221, 0.065);
  color: #5476a2;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.word-card__note {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-card__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.word-card__meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.word-card__chevron {
  color: var(--muted);
  transition: transform 0.3s var(--ease);
}

.word-card.is-open .word-card__chevron {
  transform: rotate(180deg);
}

.word-card__detail {
  padding: 19px 22px 20px 84px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.2);
  animation: detail-in 0.3s var(--ease) both;
}

.word-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 28px;
}

.word-detail-block h4,
.word-related h4 {
  margin: 0 0 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 560;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.word-detail-block p {
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.word-detail-block p.is-muted {
  color: var(--faint);
}

.word-sentences {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.word-sentences p {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.word-sentences svg {
  flex: 0 0 auto;
  margin-top: 4px;
  color: var(--accent);
  opacity: 0.66;
}

.word-related {
  margin-top: 18px;
}

.word-related__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.word-detail-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
}

/* Sentence cards */
.sentence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sentence-card {
  display: flex;
  gap: 16px;
  min-height: 168px;
  padding: 22px;
  border-radius: 20px;
}

.sentence-card__number {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.sentence-card__body {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sentence-card__quote {
  margin-bottom: 9px;
  color: var(--accent);
  opacity: 0.62;
}

.sentence-card__body p {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 420;
  letter-spacing: -0.008em;
  line-height: 1.52;
}

.sentence-card__source {
  margin-top: auto;
  padding-top: 18px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sentence-card__source b {
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

/* =========================================================
   Review page
   ========================================================= */

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.review-plan {
  padding: clamp(24px, 3.5vw, 36px);
  border-radius: var(--radius-xl);
}

.review-plan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}

.review-quote {
  max-width: 570px;
  margin: 31px 0 22px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(27px, 3.3vw, 38px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.3;
}

.review-quote cite {
  display: block;
  margin-top: 12px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.review-plan__copy {
  max-width: 550px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.85;
}

.review-steps {
  margin: 26px 0 28px;
  border-top: 1px solid var(--line);
}

.review-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.review-step__index {
  padding-top: 2px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.review-step h3 {
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
}

.review-step p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.review-preview {
  position: sticky;
  top: 105px;
  padding: 26px;
  border-radius: var(--radius-xl);
}

.review-preview__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
}

.review-preview__word {
  margin-top: 38px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(31px, 3.5vw, 40px);
  font-weight: 460;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.review-preview__prompt {
  margin-top: 11px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.review-preview__lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 23px 0;
}

.review-preview__lines span {
  height: 7px;
  border-radius: 999px;
  background: rgba(30, 69, 118, 0.075);
}

.review-preview__lines span:nth-child(1) {
  width: 100%;
}

.review-preview__lines span:nth-child(2) {
  width: 78%;
}

.review-preview__lines span:nth-child(3) {
  width: 54%;
}

.review-preview__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.review-preview__actions span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.review-preview__actions span:last-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.review-preview__foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 23px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
  line-height: 1.6;
}

.review-preview__foot svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* =========================================================
   Profile page
   ========================================================= */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.profile-card {
  padding: clamp(24px, 3.5vw, 34px);
  border-radius: var(--radius-xl);
}

.profile-card__identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 17px;
  background: var(--ink-deep);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 32px;
  font-style: italic;
  font-weight: 450;
  box-shadow:
    0 12px 24px rgba(8, 28, 54, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.profile-card__identity h2 {
  color: var(--ink);
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.profile-card__identity p {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.profile-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.profile-status > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.profile-status.is-offline > span {
  background: var(--danger);
}

.profile-quote {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 27px 0;
  padding: 19px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.32);
  color: var(--accent);
}

.profile-quote svg {
  flex: 0 0 auto;
  margin-top: 2px;
  opacity: 0.7;
}

.profile-quote p {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 19px;
  font-style: italic;
  line-height: 1.45;
}

.profile-quote p span {
  display: block;
  margin-top: 7px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.profile-stats > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-stats span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.13em;
}

.profile-stats b {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 480;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.profile-stats small {
  color: var(--muted);
  font-size: 8.5px;
}

.profile-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-info {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 18px;
  border-radius: 19px;
}

.profile-info__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--accent);
}

.profile-info h3 {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 680;
}

.profile-info p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
}

.profile-info code {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.38);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.tech-chips span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink-soft);
  font-size: 8px;
}

.profile-info p.profile-info__muted {
  margin-top: 10px;
  color: var(--faint);
  font-size: 8.5px;
}

/* =========================================================
   Bottom dock
   ========================================================= */

.dock {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 60;
  width: min(1060px, calc(100% - 32px));
  transform: translateX(-50%);
}

.dock__surface {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 76px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 26px;
  background: rgba(250, 253, 255, 0.66);
  box-shadow:
    0 24px 64px rgba(31, 72, 128, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
}

.dock__indicator {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 7px;
  width: calc((100% - 14px) / 4);
  border-radius: 20px;
  background: var(--accent);
  box-shadow:
    0 10px 24px rgba(31, 100, 221, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.48s var(--ease);
  will-change: transform;
}

.dock__item {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border-radius: 20px;
  color: #6b7f96;
  transition: color 0.28s ease, background-color 0.28s ease;
}

.dock__item:hover {
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
}

.dock__item.is-active {
  color: #fff;
}

.dock__item.is-active:hover {
  background: transparent;
  color: #fff;
}

.dock__icon {
  flex: 0 0 auto;
}

.dock__label {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.dock__english {
  color: currentColor;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.11em;
  opacity: 0.48;
  text-transform: uppercase;
  white-space: nowrap;
}

/* =========================================================
   Motion
   ========================================================= */

@keyframes page-in {
  from {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes page-out {
  from {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
  to {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-5px) scale(0.996);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes composer-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-dot {
  0%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

@keyframes status-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(61, 155, 119, 0.1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(61, 155, 119, 0.03);
  }
}

@keyframes floater-drift {
  0% {
    transform: translate3d(0, 0, 0) rotate(var(--rotate));
  }
  50% {
    transform: translate3d(6px, -14px, 0) rotate(calc(var(--rotate) + 1.8deg));
  }
  100% {
    transform: translate3d(-4px, -25px, 0) rotate(calc(var(--rotate) - 1deg));
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1120px) {
  .floater--index,
  .floater--quote {
    opacity: 0.4;
  }

  .floater--glyph {
    right: 3.5%;
  }

  .review-preview {
    top: 24px;
  }
}

@media (max-width: 920px) {
  :root {
    --topbar-h: 88px;
    --dock-h: 84px;
  }

  .app-main {
    padding-top: calc(var(--topbar-h) + 4px);
  }

  .topbar {
    padding-top: 21px;
  }

  .review-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .review-preview {
    position: relative;
    top: 0;
  }

  .profile-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-info:last-child {
    grid-column: 1 / -1;
  }

  .add-page {
    padding-top: clamp(56px, 10vh, 110px);
  }

  .hero {
    margin-bottom: 28px;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-h: 82px;
    --dock-h: 80px;
  }

  .app-main {
    padding: calc(var(--topbar-h) + 2px) 18px calc(var(--dock-h) + 40px);
  }

  .topbar {
    height: var(--topbar-h);
    padding: 18px 18px 0;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 12px;
  }

  .brand__letter {
    font-size: 23px;
  }

  .brand__dot {
    right: 6px;
    bottom: 6px;
  }

  .brand__cn {
    display: none;
  }

  .topbar__meta {
    gap: 10px;
    padding-top: 4px;
  }

  .topbar__counter,
  .topbar__divider,
  .topbar__words {
    display: none;
  }

  .status-pill {
    height: 26px;
    padding: 0 9px;
    font-size: 7px;
  }

  .add-page {
    padding-top: clamp(42px, 8vh, 74px);
  }

  .add-page.is-composing {
    padding-top: 0;
  }

  .hero {
    max-height: 250px;
    margin-bottom: 24px;
  }

  .hero__eyebrow {
    margin-bottom: 17px;
  }

  .hero__title {
    font-size: clamp(35px, 9vw, 46px);
    letter-spacing: -0.055em;
  }

  .hero__copy {
    max-width: 340px;
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.75;
  }

  .hero__rule {
    display: none;
  }

  .search-bar {
    gap: 8px;
  }

  .search-field {
    height: 58px;
    padding: 0 14px;
    gap: 10px;
    border-radius: 17px;
  }

  .search-field input {
    font-size: 17px;
  }

  .search-field input::placeholder {
    font-size: 12px;
  }

  .capture-button {
    width: 104px;
    flex-basis: 104px;
    height: 58px;
    gap: 6px;
    border-radius: 17px;
    font-size: 12.5px;
  }

  .search-field__kbd {
    display: none;
  }

  .search-caption {
    margin-top: 12px;
    font-size: 7.5px;
    line-height: 1.7;
  }

  .match-panel {
    top: calc(100% + 8px);
    border-radius: 18px;
  }

  .match-panel__list {
    max-height: 42svh;
  }

  .match-row {
    padding: 10px;
  }

  .match-row__word {
    font-size: 19px;
  }

  .match-badge {
    font-size: 7.5px;
  }

  .match-panel__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    font-size: 8.5px;
  }

  .composer-wrap {
    margin-top: 16px;
  }

  .composer-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 11px;
    padding: 0 2px;
  }

  .composer-intro p {
    font-size: 10.5px;
    text-align: left;
  }

  .composer-card {
    padding: 18px;
    border-radius: 23px;
  }

  .composer-head {
    gap: 10px;
    margin-bottom: 17px;
    padding-bottom: 14px;
  }

  .composer-word {
    font-size: 28px;
  }

  .composer-head__meta {
    gap: 8px;
    font-size: 7px;
  }

  .composer-grid {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .composer-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
  }

  .composer-actions__buttons {
    justify-content: flex-end;
  }

  .composer-actions__buttons .button--primary {
    flex: 1;
  }

  .save-success {
    padding: 32px 18px;
    border-radius: 23px;
  }

  .save-success__meta {
    gap: 12px;
    padding: 10px 4px;
    font-size: 8.5px;
  }

  .save-success__actions {
    width: 100%;
  }

  .save-success__actions .button {
    flex: 1;
  }

  .page {
    padding-top: 4px;
  }

  .page-head {
    margin-bottom: 22px;
  }

  .page-head__row {
    align-items: flex-start;
    flex-direction: column;
    gap: 17px;
    margin-top: 16px;
  }

  .page-title {
    font-size: clamp(33px, 9vw, 43px);
  }

  .page-subtitle {
    margin-top: 10px;
    font-size: 12px;
  }

  .page-stamp {
    display: none;
  }

  .library-stats {
    gap: 16px;
    margin-top: 20px;
    padding-top: 11px;
    font-size: 7px;
  }

  .library-stats b {
    font-size: 12px;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 13px;
  }

  .segmented {
    align-self: flex-start;
  }

  .library-search {
    width: 100%;
    height: 40px;
  }

  .word-card__main {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 13px 14px;
  }

  .word-card__number {
    font-size: 7px;
  }

  .word-card__word {
    font-size: 21px;
  }

  .word-card__meta {
    gap: 8px;
    font-size: 7.5px;
  }

  .word-card__meta > span:nth-child(2),
  .word-card__meta > span:nth-child(3) {
    display: none;
  }

  .word-card__detail {
    padding: 16px;
  }

  .word-detail-grid {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .word-detail-foot {
    gap: 12px;
    font-size: 6.5px;
  }

  .sentence-list {
    grid-template-columns: 1fr;
  }

  .sentence-card {
    min-height: 140px;
    padding: 18px;
  }

  .sentence-card__body p {
    font-size: 16px;
  }

  .review-plan,
  .profile-card {
    padding: 22px;
    border-radius: 23px;
  }

  .review-quote {
    margin: 23px 0 18px;
    font-size: 29px;
  }

  .review-preview {
    padding: 21px;
    border-radius: 23px;
  }

  .review-preview__word {
    margin-top: 29px;
  }

  .profile-card__identity {
    flex-wrap: wrap;
  }

  .profile-status {
    margin-left: 0;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 18px;
  }

  .profile-side {
    grid-template-columns: 1fr;
  }

  .profile-info:last-child {
    grid-column: auto;
  }

  .dock {
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100% - 20px);
  }

  .dock__surface {
    height: 66px;
    padding: 6px;
    border-radius: 22px;
  }

  .dock__indicator {
    top: 6px;
    bottom: 6px;
    left: 6px;
    width: calc((100% - 12px) / 4);
    border-radius: 17px;
  }

  .dock__item {
    gap: 5px;
    border-radius: 17px;
  }

  .dock__icon {
    width: 16px;
    height: 16px;
  }

  .dock__label {
    font-size: 11px;
  }

  .dock__english {
    display: none;
  }

  .floaters .floater:nth-child(n + 5) {
    display: none;
  }

  .floater {
    opacity: 0.42;
    transform: scale(0.82) rotate(var(--rotate));
  }

  .floater--word {
    padding: 9px 12px;
  }

  .floater__word {
    font-size: 16px;
  }

  .floater__detail {
    font-size: 6.5px;
  }
}

@media (max-width: 520px) {
  .brand__name {
    font-size: 14px;
  }

  .status-pill {
    padding: 0 8px;
  }

  .add-page {
    padding-top: 34px;
  }

  .hero__title {
    font-size: 34px;
  }

  .hero__copy {
    max-width: 290px;
    font-size: 11.5px;
  }

  .search-field {
    height: 55px;
    padding: 0 12px;
  }

  .search-field__icon {
    width: 18px;
    height: 18px;
  }

  .search-field input {
    font-size: 16px;
  }

  .capture-button {
    width: 88px;
    flex-basis: 88px;
    height: 55px;
    font-size: 11.5px;
  }

  .capture-button svg {
    width: 16px;
    height: 16px;
  }

  .match-row__arrow {
    display: none;
  }

  .match-row__note {
    font-size: 9.5px;
  }

  .match-row__title {
    flex-wrap: wrap;
    gap: 5px;
  }

  .new-match {
    padding: 15px;
  }

  .composer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-head__meta {
    padding-top: 2px;
  }

  .composer-word {
    font-size: 26px;
  }

  .composer-actions__buttons {
    width: 100%;
  }

  .composer-actions__buttons .button--ghost {
    flex: 0 0 auto;
  }

  .save-success__word {
    font-size: 38px;
  }

  .save-success__meta {
    flex-wrap: wrap;
    gap: 8px 15px;
  }

  .library-stats {
    gap: 13px;
  }

  .word-card__main {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .word-card__number {
    display: none;
  }

  .word-card__form:nth-of-type(n + 3) {
    display: none;
  }

  .segmented button {
    padding: 0 11px;
  }

  .library-empty {
    padding: 28px 18px;
  }

  .profile-card__identity {
    align-items: flex-start;
  }

  .profile-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 14px;
    font-size: 28px;
  }

  .dock__item {
    flex-direction: column;
    gap: 3px;
  }

  .dock__label {
    font-size: 10px;
  }

  .dock__icon {
    width: 17px;
    height: 17px;
  }
}

@media (max-width: 380px) {
  .hero__title {
    font-size: 30px;
  }

  .search-field__icon {
    display: none;
  }

  .search-field {
    padding: 0 13px;
  }

  .capture-button {
    width: 80px;
    flex-basis: 80px;
  }

  .capture-button span {
    font-size: 11px;
  }

  .dock__label {
    font-size: 9.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .floater {
    animation: none;
  }
}
