@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("fonts/PretendardVariable.woff2") format("woff2-variations");
}

/* Legacy visual source: Translator_Old/frontend/src/styles.css. */
:root {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #f7f5ff;
  --surface: #ffffff;
  --surface-soft: #f3f0fb;
  --ink: #17151d;
  --muted: #716d7d;
  --line: #e8e3f2;
  --primary: #7c5cfc;
  --primary-dark: #6240e8;
  --primary-soft: #eee9ff;
  --lime: #c8f560;
  --coral: #ff7a90;
  --shadow: 0 20px 50px rgba(65, 46, 121, 0.10);
  --focus: 0 0 0 4px rgba(124, 92, 252, 0.2);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111016;
  --surface: #1b1922;
  --surface-soft: #24212e;
  --ink: #f7f4ff;
  --muted: #aaa4b7;
  --line: #332f3e;
  --primary: #9a82ff;
  --primary-dark: #b09cff;
  --primary-soft: #30294d;
  --lime: #b9e657;
  --coral: #ff8799;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--primary) 10%, transparent) 0 1px, transparent 2px) 0 0 / 26px 26px,
    var(--bg);
  transition: background-color 180ms ease, color 180ms ease;
}

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

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

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

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  color: var(--primary);
}

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

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

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #9d7eff 60%, var(--coral));
  box-shadow: 0 8px 22px rgba(124, 92, 252, 0.28);
  transform: rotate(-3deg);
}

.brand-mark--large {
  width: 60px;
  height: 60px;
  border-radius: 20px;
}

.icon-button,
.soft-button,
.text-button,
.copy-button,
.cancel-button,
.clear-history,
.history-delete {
  border: 0;
  color: var(--ink);
  background: transparent;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: transform 150ms ease, background 150ms ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  background: var(--surface-soft);
}

.primary-button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 24px;
  border: 0;
  border-radius: 17px;
  color: #fff;
  font-weight: 750;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px rgba(124, 92, 252, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(124, 92, 252, 0.32);
}

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

.primary-button:disabled {
  opacity: 0.45;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

/* Login */
.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(150deg, transparent 48%, color-mix(in srgb, var(--lime) 16%, transparent));
}

.login-theme {
  position: absolute;
  top: 24px;
  right: 28px;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.75;
}

.login-orb--one {
  width: 220px;
  height: 220px;
  top: -75px;
  left: -60px;
  background: color-mix(in srgb, var(--primary) 22%, transparent);
}

.login-orb--two {
  width: 170px;
  height: 170px;
  right: -40px;
  bottom: -35px;
  background: color-mix(in srgb, var(--coral) 22%, transparent);
}

.login-card {
  z-index: 1;
  width: min(100%, 470px);
  padding: 48px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  margin-bottom: 28px;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(2.25rem, 8vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.055em;
}

.login-lead {
  margin: 20px 0 32px;
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  margin-left: 3px;
  font-size: 0.88rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: var(--surface-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-form input:focus {
  border-color: var(--primary);
}

.login-button {
  margin-top: 8px;
}

.form-error,
.translation-error {
  color: #d43c59;
  font-size: 0.88rem;
  font-weight: 650;
}

:root[data-theme='dark'] .form-error,
:root[data-theme='dark'] .translation-error {
  color: #ff91a5;
}

.form-error {
  margin: 2px 3px 0;
}

.private-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Main */
.app-shell {
  min-height: 100vh;
  padding-bottom: 48px;
}

.topbar {
  width: min(100% - 40px, 1280px);
  height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 550;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand strong {
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.soft-button {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 650;
  background: var(--surface);
}

.history-count {
  min-width: 21px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 8px;
  color: var(--primary-dark);
  font-size: 0.7rem;
  background: var(--primary-soft);
}

.main-content {
  width: min(100% - 40px, 1180px);
  margin: 42px auto 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin: 0 14px 34px;
}

.live-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lime) 25%, transparent);
}

.hero h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(2.5rem, 5.3vw, 4.7rem);
  line-height: 0.99;
  letter-spacing: -0.065em;
}

.hero h1 span {
  position: relative;
  color: var(--primary);
}

.hero h1 span::after {
  content: '';
  position: absolute;
  z-index: -1;
  height: 12px;
  left: 0;
  right: 0;
  bottom: 4px;
  border-radius: 99px;
  opacity: 0.52;
  background: var(--lime);
  transform: rotate(-1deg);
}

.hero-copy {
  flex: 0 0 auto;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.translator-area {
  position: relative;
}

.direction-bar {
  position: relative;
  z-index: 2;
  width: calc(50% + 44px);
  height: 58px;
  margin: 0 auto -18px;
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(65, 46, 121, 0.08);
}

.direction-bar label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-left: 14px;
  color: var(--primary);
}

.direction-bar select {
  min-width: 0;
  padding: 5px 23px 5px 4px;
  border: 0;
  color: var(--ink);
  font-weight: 750;
  background: transparent;
}

/* Windows Chromium may render the native popup on a light system surface
   while inheriting the dark-theme foreground from the closed select. */
.direction-bar select option {
  color: #17151d;
  background-color: #ffffff;
}

.swap-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 0;
  border-radius: 14px;
  color: var(--primary-dark);
  background: var(--lime);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--lime) 40%, transparent);
  transition: transform 250ms cubic-bezier(.2,.8,.2,1);
}

.swap-button:hover {
  transform: rotate(180deg) scale(1.04);
}

.target-language {
  justify-self: center;
  font-size: 0.92rem;
  font-weight: 750;
}

.translation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.translation-card {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-card {
  border-top-right-radius: 36px;
}

.output-card {
  border-top-left-radius: 36px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--primary-soft) 42%, transparent), transparent 42%),
    var(--surface);
}

.card-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 32px 30px 18px;
}

.card-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.card-header h2 {
  margin: 0;
  font-size: 1.16rem;
  letter-spacing: -0.025em;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.translation-card textarea {
  width: 100%;
  min-height: 235px;
  flex: 1;
  resize: none;
  padding: 10px 30px 24px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 1.13rem;
  line-height: 1.72;
  background: transparent;
}

.translation-card textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 65%, transparent);
}

.card-footer {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 30px 18px;
  color: var(--muted);
  font-size: 0.75rem;
}

.character-count--warn {
  color: var(--coral);
  font-weight: 750;
}

.shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.66rem;
  background: var(--surface-soft);
}

.result-body {
  min-height: 235px;
  flex: 1;
  display: flex;
  padding: 10px 30px 24px;
}

.result-placeholder,
.thinking-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.placeholder-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 20px;
  color: var(--primary);
  background: var(--primary-soft);
  transform: rotate(3deg);
}

.result-placeholder strong,
.thinking-state strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.result-placeholder span {
  margin-top: 7px;
  font-size: 0.8rem;
}

.translated-text {
  margin: 0;
  width: 100%;
  color: var(--ink);
  font-size: 1.13rem;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: result-in 350ms cubic-bezier(.2,.8,.2,1) both;
}

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

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 750;
}

.level-badge--low {
  color: #5a3a00;
  background: var(--lime);
}

.level-badge--medium {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--coral));
}

.thinking-bubble {
  min-width: 64px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 16px;
  border-radius: 17px 17px 17px 5px;
  background: var(--primary-soft);
}

.thinking-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 1s ease-in-out infinite;
}

.thinking-bubble span:nth-child(2) { animation-delay: 120ms; }
.thinking-bubble span:nth-child(3) { animation-delay: 240ms; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.cancel-button {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
}

.copy-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border-radius: 11px;
  color: var(--primary-dark);
  font-weight: 750;
  background: var(--primary-soft);
}

.copy-button:disabled {
  opacity: 0.38;
}

.control-dock {
  width: calc(100% - 64px);
  min-height: 96px;
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(65, 46, 121, 0.08);
}

.mode-group {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 17px;
  background: var(--surface-soft);
}

.mode-button {
  min-width: 0;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 13px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.mode-button span {
  font-size: 0.84rem;
  font-weight: 750;
}

.mode-button small,
.precision-toggle small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-button--active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 4px 13px rgba(51, 38, 92, 0.10);
}

.precision-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  cursor: pointer;
}

.precision-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 99px;
  background: var(--line);
  transition: background 160ms ease;
}

.toggle-track span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1);
}

.precision-toggle input:checked + .toggle-track {
  background: var(--primary);
}

.precision-toggle input:checked + .toggle-track span {
  transform: translateX(18px);
}

.precision-toggle input:focus-visible + .toggle-track {
  box-shadow: var(--focus);
}

.precision-toggle strong {
  font-size: 0.82rem;
}

.precision-toggle small {
  color: var(--muted);
}

.translate-button {
  min-width: 145px;
  height: 58px;
  border-radius: 18px;
}

.translation-error {
  margin: 14px auto 0;
  text-align: center;
}

.privacy-line {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.privacy-line span {
  margin-right: 4px;
}

/* History */
.sheet-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(20, 16, 30, 0.38);
  backdrop-filter: blur(4px);
  animation: fade-in 180ms ease both;
}

@keyframes fade-in { from { opacity: 0; } }

.history-sheet {
  width: min(430px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 30px;
  background: var(--surface);
  box-shadow: -20px 0 60px rgba(22, 13, 46, 0.2);
  animation: sheet-in 260ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes sheet-in { from { transform: translateX(100%); } }

.sheet-handle {
  display: none;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.sheet-header .eyebrow {
  margin-bottom: 5px;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 2px;
}

.history-item {
  position: relative;
  display: flex;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  transition: transform 150ms ease, border-color 150ms ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}

.history-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 16px 42px 16px 16px;
  border: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.history-meta {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.history-content strong,
.history-content > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-content strong {
  font-size: 0.87rem;
}

.history-content > span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.history-delete {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
}

.history-delete:hover {
  color: var(--coral);
  background: color-mix(in srgb, var(--coral) 12%, transparent);
}

.clear-history {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-history svg {
  margin-bottom: 16px;
  color: var(--primary);
}

.empty-history strong {
  color: var(--ink);
}

.empty-history span {
  max-width: 250px;
  margin-top: 7px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.mobile-history-button {
  display: none;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  background: #211d2c;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .main-content {
    margin-top: 26px;
  }

  .hero {
    align-items: start;
    flex-direction: column;
    gap: 18px;
  }

  .hero-copy br {
    display: none;
  }

  .direction-bar {
    width: calc(100% - 48px);
  }

  .translation-grid {
    grid-template-columns: 1fr;
  }

  .translation-card {
    min-height: 330px;
  }

  .input-card,
  .output-card {
    border-radius: 24px;
  }

  .output-card {
    min-height: 300px;
  }

  .control-dock {
    width: 100%;
    flex-wrap: wrap;
  }

  .mode-group {
    flex-basis: 100%;
  }

  .precision-toggle {
    margin-left: 8px;
  }

  .translate-button {
    flex: 1;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding-bottom: 92px;
  }

  .topbar {
    width: calc(100% - 28px);
    height: 70px;
  }

  .brand {
    font-size: 0.93rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .history-top {
    display: none;
  }

  .main-content {
    width: calc(100% - 24px);
    margin-top: 24px;
  }

  .hero {
    margin: 0 8px 28px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 10.5vw, 2.8rem);
  }

  .hero h1 span {
    white-space: nowrap;
  }

  .hero-copy {
    font-size: 0.86rem;
  }

  .direction-bar {
    width: calc(100% - 20px);
    grid-template-columns: minmax(0, 1fr) 45px minmax(0, .75fr);
  }

  .direction-bar label {
    gap: 4px;
    padding-left: 8px;
  }

  .direction-bar label svg {
    display: none;
  }

  .direction-bar select,
  .target-language {
    max-width: 100%;
    font-size: 0.78rem;
  }

  .swap-button {
    width: 38px;
    height: 38px;
  }

  .translation-card {
    min-height: 340px;
  }

  .card-header {
    min-height: 82px;
    padding: 29px 22px 14px;
  }

  .translation-card textarea,
  .result-body {
    padding-left: 22px;
    padding-right: 22px;
  }

  .translation-card textarea,
  .translated-text {
    font-size: 1.02rem;
  }

  .card-footer {
    padding-left: 22px;
    padding-right: 22px;
  }

  .shortcut-hint {
    display: none;
  }

  .control-dock {
    gap: 12px;
    margin-top: 12px;
    padding: 10px;
    border-radius: 21px;
  }

  .mode-button {
    align-items: center;
    height: 52px;
    padding: 0 5px;
    text-align: center;
  }

  .mode-button small {
    display: none;
  }

  .precision-toggle {
    flex: 1;
    margin: 0 5px;
  }

  .translate-button {
    min-width: 132px;
    padding: 0 17px;
  }

  .privacy-line {
    padding: 0 20px;
    line-height: 1.5;
  }

  .mobile-history-button {
    position: fixed;
    z-index: 10;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 17px;
    border: 1px solid var(--line);
    border-radius: 17px;
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 750;
    background: var(--surface);
    box-shadow: 0 12px 34px rgba(37, 24, 72, 0.18);
    transform: translateX(-50%);
  }

  .mobile-history-button span {
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border-radius: 7px;
    color: var(--primary-dark);
    font-size: 0.68rem;
    background: var(--primary-soft);
  }

  .sheet-backdrop {
    align-items: flex-end;
  }

  .history-sheet {
    width: 100%;
    height: min(82vh, 720px);
    padding: 12px 20px 20px;
    border-radius: 26px 26px 0 0;
    animation-name: sheet-up;
  }

  @keyframes sheet-up { from { transform: translateY(100%); } }

  .sheet-handle {
    width: 38px;
    height: 4px;
    display: block;
    margin: 0 auto 10px;
    border-radius: 99px;
    background: var(--line);
  }

  .login-card {
    padding: 36px 25px;
    border-radius: 27px;
  }

  .login-theme {
    top: 18px;
    right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.recovery-notice:not(:empty) {
  margin: 12px auto;
  padding: 12px 16px;
  max-width: 1100px;
  font-size: 0.875rem;
  line-height: 1.6;
}
.recovery-notice:empty { display: none; }

/* Semantic adaptations: current username/session, native controls and modal focus. */
#blazor-error-ui { display: none; position: fixed; z-index: 100; bottom: 0; left: 0; right: 0; padding: 16px; background: var(--surface); color: var(--ink); border-top: 1px solid var(--coral); }
#blazor-error-ui a { color: var(--primary-dark); }
fieldset { min-width: 0; }
.login-form, .mode-group { margin: 0; border: 0; }
.login-form { padding: 0; }
.direction-bar { padding: 0; }
.direction-bar label, .direction-bar select, .target-language { min-width: 0; }
.direction-bar select { max-width: 100%; }
.theme-control { position: relative; flex-shrink: 0; padding: 0; }
.theme-control svg { pointer-events: none; }
.theme-control select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.theme-control:has(select:focus-visible) { box-shadow: var(--focus); }
.theme-control option { color: #17151d; background: #fff; }
.theme-notice, .history-notice { position: absolute; top: 72px; right: 20px; z-index: 5; max-width: min(500px, calc(100vw - 40px)); background: var(--surface); }
.mode-button { position: relative; cursor: pointer; min-width: 0; }
.mode-button input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.precision-toggle { position: relative; }
.precision-toggle input { inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; pointer-events: auto; z-index: 1; }
.mode-button:has(input:focus-visible) { box-shadow: var(--focus); }
.translation-card { min-width: 0; }
.translation-card textarea:focus-visible { box-shadow: none; outline: 0; }
.input-card:has(textarea:focus-visible) { box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
@media (forced-colors: active) {
  .input-card:has(textarea:focus-visible) { outline: 2px solid Highlight; outline-offset: 2px; }
}
.card-header, .card-footer { flex-shrink: 0; }
.card-header h2 { overflow-wrap: anywhere; }
.translation-status { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: .875rem; }
.translation-status:empty, .copy-feedback:empty { margin: 0; }
.copy-feedback { max-width: calc(100vw - 32px); }
.cancel-button:disabled { opacity: .45; }
.history-list { list-style: none; margin: 0; min-height: 0; }
.history-dialog { position: fixed; inset: 0; max-height: none; max-width: none; margin: 0 0 0 auto; border: 0; color: var(--ink); }
.history-dialog:not([open]) { display: none; }
.history-dialog[open] { display: flex; }
.history-dialog::backdrop { background: rgba(20, 16, 30, .38); backdrop-filter: blur(4px); }
.history-dialog .sheet-header, .history-dialog .clear-history, .clear-confirm { flex-shrink: 0; }
.history-privacy { margin: 14px 0 0; font-size: .75rem; line-height: 1.5; color: var(--muted); }
.history-options { margin-bottom: 8px; font-size: .67rem; color: var(--muted); }
body:has(.history-dialog[open]) .history-notice { display: none; }
.history-dialog .empty-history + .history-list { flex: 0; padding: 0; }
.clear-confirm { padding: 12px; border: 1px solid var(--line); border-radius: 14px; font-size: .85rem; }
.clear-confirm .soft-button { margin-right: 10px; }
.history-delete, .clear-history { border: 0; background: transparent; }
.history-delete:disabled, .clear-history:disabled { opacity: .45; }
.history-content:focus-visible, .history-delete:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.history-count .sr-only { width: 1px; height: 1px; }
/* The narrow phone trigger floats; wider compact headers have room in normal flow. */
@media (max-width: 479px) {
  .history-trigger { position: fixed; z-index: 10; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); height: 48px; padding: 0 17px; gap: 8px; border-radius: 17px; transform: translateX(-50%); box-shadow: 0 12px 34px rgba(37, 24, 72, .18); font-size: .84rem; font-weight: 750; }
  .history-trigger:hover { transform: translateX(-50%); }
  .history-trigger > svg { width: 19px; height: 19px; }
  .history-trigger .history-count { min-width: 20px; height: 20px; padding: 0 4px; border-radius: 7px; font-size: .68rem; }
  .history-trigger-label { font-size: 0; }
  .history-trigger-label::after { content: '최근 번역'; font-size: .84rem; }
}
@media (max-width: 600px) {
  .history-dialog { top: auto; margin: 0; }
  .direction-bar label > svg { display: none; }
  .mode-button { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.recovery-notice p { margin: 0 0 8px; }
.recovery-notice button + button { margin-left: 16px; }
