:root {
  --bg: #f6f6f5;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #fff;
  --surface-soft: #eeeeec;
  --surface-tint: #e9e9e7;
  --line: #dcdcda;
  --line-strong: #c9c9c6;
  --text: #212120;
  --muted: #6d6d6a;
  --quiet: #92928e;
  --accent: #55554f;
  --accent-dark: #3a3a36;
  --accent-soft: #e7e7e4;
  --mint: #ececea;
  --mint-text: #4a4a45;
  --peach: #fbe2de;
  --peach-text: #b23a2e;
  --danger: #c94949;
  --shadow: 0 20px 55px rgba(30, 30, 28, .09), 0 2px 8px rgba(30, 30, 28, .04);
  --shadow-soft: 0 10px 28px rgba(40, 40, 37, .07);
  --spring: cubic-bezier(.16, 1, .3, 1);
  --spring-pop: cubic-bezier(.34, 1.56, .64, 1);
  --radius-xl: 10px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --sans: "IBM Plex Sans", ui-sans-serif, sans-serif;
  --mono: "IBM Plex Sans", ui-sans-serif, sans-serif;
}

[data-theme="dark"] {
  --bg: #171716;
  --surface: rgba(32, 32, 30, .9);
  --surface-solid: #212120;
  --surface-soft: #292927;
  --surface-tint: #2c2c2a;
  --line: #3a3a37;
  --line-strong: #4c4c48;
  --text: #efefec;
  --muted: #aaaaa5;
  --quiet: #838380;
  --accent: #b8b8b0;
  --accent-dark: #d4d4cc;
  --accent-soft: #333330;
  --mint: #302f2c;
  --mint-text: #cfcfc7;
  --peach: #452a26;
  --peach-text: #ff8a75;
  --danger: #ff8a8a;
  --shadow: 0 24px 60px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .16);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

button,
input,
select,
textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(6px);
  opacity: .55;
  pointer-events: none;
}

.ambient-one {
  top: -300px;
  right: -100px;
  background: radial-gradient(circle, #dedcd6 0, transparent 68%);
}

.ambient-two {
  left: -250px;
  bottom: -330px;
  background: radial-gradient(circle, #e4e2dc 0, transparent 68%);
}

[data-theme="dark"] .ambient { opacity: .13; }

.app-shell {
  width: min(1240px, calc(100% - 40px));
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -.025em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(145deg, #5c5c56, #38382f);
  box-shadow: 0 9px 20px rgba(50, 50, 45, .22);
}

.brand-mark svg { width: 22px; height: 22px; }
.brand-mark path:first-child { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.brand-mark path:last-child { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.theme-toggle button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--quiet);
  background: transparent;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, transform .3s var(--spring-pop);
}

.theme-toggle button.active { color: var(--accent); background: var(--accent-soft); transform: scale(1.03); }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.intro {
  padding: 12px 4px 18px;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.typing-quote {
  display: block;
  min-height: 86px;
  max-width: 620px;
  margin: 0 0 2px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s ease, transform .45s ease;
}

.typing-quote.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.typing-quote-source {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 4px;
  color: var(--peach-text);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: .01em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  overflow-wrap: anywhere;
  transition: color .2s ease, border-color .2s ease;
}

.typing-quote-source:hover,
.typing-quote-source:focus-visible {
  border-bottom-color: currentColor;
}

.typing-quote-text-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.workspace {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.controls-card,
.results-card {
  min-height: 0;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.controls-card { align-self: start; padding: 12px; }

.mode-switch {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: 42px;
  padding: 4px;
  margin-bottom: 9px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.mode-switch button {
  position: relative;
  z-index: 2;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: color .25s ease;
}

.mode-switch button.active { color: var(--text); }

.mode-glider {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: 4px;
  width: calc(25% - 2px);
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-solid);
  box-shadow: 0 4px 14px rgba(42, 41, 34, .08);
  transition: transform .42s var(--spring);
}

.mode-switch[data-active="dictionary"] .mode-glider { transform: translateX(100%); }
.mode-switch[data-active="story"] .mode-glider { transform: translateX(200%); }
.mode-switch[data-active="random"] .mode-glider { transform: translateX(300%); }

.panel-section { display: none; }
.panel-section.active { display: block; animation: panel-in .34s var(--spring) both; }

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

.control-block {
  padding: 9px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.control-block:last-child { border-bottom: 0; }

.control-heading,
.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 7px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 760;
}

.hint {
  color: var(--mint-text);
  font-size: 11.5px;
  font-weight: 700;
}

.value-bubble {
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  transition: transform .35s var(--spring-pop);
}

.value-bubble.bump { transform: scale(1.16) translateY(-2px); }

.choice-row { display: grid; gap: 5px; }
.source-switch { grid-template-columns: 1fr 1fr; }
.position-row { grid-template-columns: repeat(4, 1fr); }

.choice {
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 13px;
  font-weight: 730;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .28s var(--spring-pop);
}

.choice.active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.range {
  --range-progress: 25%;
  width: 100%;
  height: 18px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0 var(--range-progress), var(--line) var(--range-progress) 100%);
}

.range::-moz-range-track { height: 5px; border-radius: 999px; background: var(--line); }
.range::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--accent); }
.range::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -6px;
  appearance: none;
  border: 4px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 8px rgba(50, 50, 45, .35);
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 4px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 8px rgba(50, 50, 45, .35);
}

.range-labels { display: flex; justify-content: space-between; margin-top: 1px; color: var(--quiet); font-size: 11px; }

.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-cols .control-block:first-child { border-right: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }

select,
.text-input,
.word-inputs input,
.phrase-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface-solid);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

select { padding: 0 30px 0 10px; font-size: 13px; cursor: pointer; }
.text-input { padding: 0 10px; font-size: 13px; }
.mono { font-family: var(--mono); letter-spacing: .04em; }

select:focus,
.text-input:focus,
.word-inputs input:focus,
.phrase-input:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
  outline: none;
}

.input-with-note { display: grid; grid-template-columns: minmax(110px, .7fr) 1.3fr; align-items: center; gap: 10px; }
.input-with-note > span { color: var(--quiet); font-size: 11.5px; line-height: 1.25; }

.word-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.word-inputs label { position: relative; }
.word-inputs label > span {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 1;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 800;
}
.word-inputs input { padding: 0 7px 0 24px; font-size: 12.5px; }
.translit-preview { min-height: 15px; margin: 6px 0 0; color: var(--accent); font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }

.phrase-input {
  min-height: 64px;
  height: auto;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.4;
}

.phrase-guidance {
  margin: 5px 0 0;
  color: var(--peach-text);
  font-size: 11.5px;
  line-height: 1.35;
}

.phrase-guidance.is-ready { color: var(--mint-text); }
.mode-description strong { color: var(--text); }

.primary-action {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 20px);
  min-height: 46px;
  margin: 10px;
  padding: 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #4a4a44, #2e2e28);
  box-shadow: 0 12px 26px rgba(40, 40, 36, .22);
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .35s var(--spring-pop), box-shadow .25s ease, filter .25s ease;
}

.primary-action::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at var(--tap-x, 50%) var(--tap-y, 50%), rgba(255,255,255,.38), transparent 42%);
  transition: opacity .35s ease;
}

.primary-action:active { transform: scale(.975); }
.primary-action:active::before { opacity: 1; }
.primary-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--spring-pop); }

.mode-description {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.check-card { position: relative; display: grid; place-items: center; min-height: 58px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--surface-solid); cursor: pointer; transition: all .2s ease; }
.check-card input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.check-card span { font-family: var(--mono); font-size: 13.5px; font-weight: 800; }
.check-card small { font-size: 10px; }
.check-card:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent-dark); background: var(--accent-soft); }

.check-line { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; }
.check-line input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check-line span { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.check-line small { color: var(--quiet); font-family: var(--mono); font-weight: 500; }

.results-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
}

.results-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 46px; margin-bottom: 12px; }
.results-header h2 { margin: 0; font-size: clamp(20px, 2vw, 25px); line-height: 1.15; letter-spacing: -.025em; }
.section-kicker { margin-bottom: 3px; font-size: 11px; }
.results-actions { display: flex; gap: 6px; }

.soft-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, transform .3s var(--spring-pop), box-shadow .2s ease;
}

.soft-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.soft-button:active { transform: scale(.94); }

.results { display: grid; align-content: start; gap: 8px; }

.result-card {
  --delay: 0ms;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 65px;
  padding: 10px 10px 10px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  animation: result-in .46s var(--spring) var(--delay) both;
  transition: transform .34s var(--spring), border-color .2s ease, box-shadow .2s ease;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), #8f8f86);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .34s var(--spring);
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(13px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.password-wrap { min-width: 0; }
.result-password {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(17px, 1.75vw, 21px);
  font-weight: 720;
  letter-spacing: -.025em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-subline { display: block; margin-top: 3px; color: var(--quiet); font-size: 11px; }
.seg-word { color: var(--text); }
.seg-insert { color: var(--peach-text); font-weight: 850; }

.result-actions { display: flex; gap: 5px; margin-left: 12px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  transition: transform .3s var(--spring-pop), color .2s ease, border-color .2s ease, background .2s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.copied { border-color: transparent; color: var(--mint-text); background: var(--mint); transform: scale(1.08); }

.breakdown-panel {
  position: absolute;
  z-index: 5;
  inset: 78px 22px auto;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-solid) 94%, var(--accent-soft));
  box-shadow: var(--shadow);
  animation: breakdown-in .42s var(--spring-pop) both;
}

@keyframes breakdown-in {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.breakdown-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.breakdown-head h3 { margin: 0; font-size: 15px; }
.breakdown-close { width: 30px; height: 30px; border: 0; border-radius: 5px; color: var(--muted); background: var(--surface-soft); cursor: pointer; }
.breakdown-row { display: grid; grid-template-columns: 1fr 1.45fr; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.breakdown-row span:first-child { color: var(--muted); }
.breakdown-row span:last-child { font-family: var(--mono); font-weight: 650; overflow-wrap: anywhere; }

.empty-state { position: absolute; inset: 80px 22px 22px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; background: var(--surface); }
.loader-mark { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  padding: 11px 18px;
  border-radius: 7px;
  color: #fff;
  background: #252824;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  font-size: 13.5px;
  font-weight: 750;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 140%) scale(.9);
  transition: transform .52s cubic-bezier(.18, 1.25, .4, 1), opacity .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (hover: hover) and (pointer: fine) {
  .choice:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); transform: translateY(-1px); }
  .primary-action:hover { filter: saturate(1.08) brightness(1.03); box-shadow: 0 15px 32px rgba(40, 40, 36, .28); transform: translateY(-2px); }
  .primary-action:hover svg { transform: translateX(4px); }
  .soft-button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow-soft); transform: translateY(-1px); }
  .result-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); box-shadow: var(--shadow-soft); }
  .result-card:hover::before { transform: scaleY(1); }
  .icon-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); transform: scale(1.06); }
}

@media (min-width: 921px) and (min-height: 690px) {
  body { overflow: hidden; }
}

@media (max-height: 780px) and (min-width: 921px) {
  .topbar { min-height: 54px; }
  .intro { padding: 5px 4px 12px; }
  .typing-quote-text-line { font-size: 13.5px; }
  .controls-card { overflow-y: auto; scrollbar-width: thin; }
  .result-card { min-height: 59px; }
}

@media (max-width: 920px) {
  html, body { height: auto; min-height: 100%; overscroll-behavior-y: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app-shell {
    width: min(720px, calc(100% - 24px));
    min-height: 100svh;
    height: auto;
    display: block;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .intro { grid-template-columns: 1fr; gap: 4px; padding: 8px 2px 8px; }
  .typing-quote { max-width: 620px; }
  .workspace {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 12px;
  }
  .controls-card { overflow: visible; }
  .results-card { min-height: 430px; margin-top: 0; overflow: visible; }
  .mode-switch,
  .choice,
  select,
  .text-input { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}

@media (max-width: 560px) {
  .app-shell { width: min(calc(100% - 16px), 480px); }
  .topbar { min-height: 48px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 28px; height: 28px; }
  .typing-quote-text-line { font-size: 12.5px; }
  .workspace { gap: 10px; }
  .controls-card,
  .results-card { border-radius: 9px; }
  .controls-card { padding: 7px; }
  .results-card { padding: 10px; }
  .results-header { margin-bottom: 6px; }
  .results-header h2 { font-size: 17px; }
  .soft-button span { display: none; }
  .soft-button { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .position-row { grid-template-columns: repeat(2, 1fr); }
  .result-card { min-height: 62px; padding: 9px 9px 9px 12px; }
  .result-password { overflow: visible; font-size: clamp(14px, 4vw, 17px); text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  .result-subline { font-size: 10.5px; line-height: 1.35; }
  .result-actions { margin-left: 6px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .breakdown-panel { inset: 60px 10px auto; padding: 12px; }
  .breakdown-row { grid-template-columns: 1fr; gap: 3px; padding: 5px 0; }
  .strength-box { padding: 8px 10px; }
  .control-block { padding: 6px 8px; }
  .primary-action { min-height: 48px; margin: 8px; }
  .mode-switch { height: 48px; }
  .mode-switch button { min-width: 0; padding: 0 3px; font-size: 11.5px; line-height: 1.1; }
  .mode-glider { height: 40px; }
  .phrase-input { min-height: 78px; font-size: 16px; }
}

@media (max-height: 700px) and (max-width: 920px) {
  .intro { padding: 4px 2px 4px; }
  .typing-quote { min-height: 40px; }
  .typing-quote-text-line { font-size: 11.5px; -webkit-line-clamp: 1; }
}

@media (max-width: 380px) {
  .two-cols { grid-template-columns: 1fr; }
  .two-cols .control-block:first-child { border-right: 0; }
  .input-with-note { grid-template-columns: 1fr; gap: 4px; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
