:root {
  color-scheme: light;
  --ink: #17201f;
  --ink-soft: #52605e;
  --paper: #f6f4ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #dcded7;
  --line-strong: #b8c2bd;
  --mint: #bbf1d9;
  --mint-strong: #2c8768;
  --blue: #2d5bff;
  --blue-dark: #1e3db8;
  --coral: #ff745f;
  --warn: #9b5300;
  --warn-bg: #fff2d9;
  --danger: #9a2d2d;
  --danger-bg: #fff0ed;
  --shadow: 0 20px 60px rgba(37, 53, 48, 0.1);
  --radius-lg: 28px;
  --radius-md: 18px;
  font-family: Inter, Pretendard, "Noto Sans KR", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 15%, rgba(187, 241, 217, 0.55), transparent 27rem),
    radial-gradient(circle at 95% 0%, rgba(255, 180, 158, 0.33), transparent 24rem),
    var(--paper);
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(45, 91, 255, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1480px, calc(100% - 44px));
  margin: 0 auto;
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 32, 31, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--mint);
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b2b9b6;
}

.service-status.ready .status-dot {
  background: #2eb67d;
  box-shadow: 0 0 0 4px rgba(46, 182, 125, 0.13);
}

.service-status.error .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 116, 95, 0.13);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  align-items: end;
  gap: 80px;
  padding: 60px 8px 44px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.intro h1 {
  max-width: 790px;
  margin: 0;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.intro h1 em {
  color: var(--blue);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-style: normal;
  font-weight: 500;
}

.intro-copy {
  max-width: 420px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
}

.control-deck {
  display: grid;
  grid-template-columns: repeat(4, minmax(135px, 1fr)) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: rgba(255, 253, 248, 0.8);
  backdrop-filter: blur(18px);
}

.control-deck label:not(.auto-control) {
  min-width: 0;
  padding: 7px 12px 8px;
  border-right: 1px solid var(--line);
}

.control-deck label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.control-deck select {
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.auto-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.auto-control > span {
  margin: 0 !important;
  white-space: nowrap;
}

.auto-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auto-control i {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9ceca;
  transition: background 160ms ease;
}

.auto-control i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}

.auto-control input:checked + i {
  background: var(--blue);
}

.auto-control input:checked + i::after {
  transform: translateX(18px);
}

.translator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 580px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.output-panel {
  background:
    linear-gradient(140deg, rgba(187, 241, 217, 0.19), transparent 48%),
    var(--surface-strong);
}

.input-panel {
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.panel-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}

.panel-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-code {
  display: grid;
  place-items: center;
  width: 31px;
  height: 25px;
  border-radius: 7px;
  color: var(--blue-dark);
  background: #e8edff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.output-panel .language-code {
  color: #146449;
  background: var(--mint);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.copy-button,
.translate-button,
.steer-form button,
.error-state button {
  border: 0;
  border-radius: 12px;
}

.icon-button {
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: #eef1ed;
  font-size: 21px;
}

.copy-button {
  padding: 0 16px;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
}

.clear-button {
  color: var(--ink-soft);
}

.output-stage {
  min-height: 420px;
  flex: 1;
  padding: 34px 38px;
}

.empty-state,
.loading-state,
.error-state {
  height: 100%;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  border: 1px solid #9bcdb9;
  border-radius: 24px;
  color: #1f7155;
  background: rgba(187, 241, 217, 0.45);
  font-family: serif;
  font-size: 31px;
  transform: rotate(-3deg);
}

.empty-state p,
.loading-state p {
  max-width: 280px;
  margin: 0 0 15px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.loading-lines {
  width: min(330px, 80%);
  margin-bottom: 26px;
}

.loading-lines span {
  display: block;
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf0ea 25%, #d7efe4 50%, #edf0ea 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

.loading-lines span:nth-child(2) {
  width: 82%;
}

.loading-lines span:nth-child(3) {
  width: 58%;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.korean-result {
  min-height: 150px;
  margin: 0;
  color: #111918;
  white-space: pre-wrap;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 560;
  line-height: 1.62;
  letter-spacing: -0.035em;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 24px 0;
}

.result-tags span {
  padding: 7px 10px;
  border: 1px solid #cbd8d1;
  border-radius: 999px;
  color: #34564b;
  background: #f0f8f4;
  font-size: 11px;
  font-weight: 700;
}

.warning-box {
  margin: 20px 0;
  padding: 15px 17px;
  border: 1px solid #eac88b;
  border-radius: 14px;
  color: var(--warn);
  background: var(--warn-bg);
  font-size: 12px;
  line-height: 1.6;
}

.warning-box strong {
  display: block;
  margin-bottom: 5px;
}

.warning-box ul,
.detail-block ul {
  margin: 0;
  padding-left: 18px;
}

.result-details {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-details summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.detail-block {
  margin-top: 19px;
}

.detail-block h3 {
  margin: 0 0 7px;
  font-size: 11px;
}

.detail-block p,
.detail-block li,
.platform-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.platform-note {
  margin-top: 15px;
  padding-left: 12px;
  border-left: 3px solid var(--mint);
}

.steer-form {
  margin-top: 24px;
}

.steer-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 750;
}

.steer-form > div {
  display: flex;
  gap: 8px;
}

.steer-form input {
  min-width: 0;
  flex: 1;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fbfcf9;
  font-size: 12px;
}

.steer-form button,
.error-state button {
  padding: 0 17px;
  color: white;
  background: var(--blue);
  font-size: 12px;
  font-weight: 750;
}

.error-state {
  color: var(--danger);
}

.error-state p {
  max-width: 390px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.error-state button {
  min-height: 40px;
}

.panel-foot {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 26px;
  border-top: 1px solid var(--line);
  color: #7d8985;
  font-size: 10px;
}

.textarea-wrap {
  position: relative;
  flex: 1;
  display: block;
}

.textarea-wrap textarea {
  width: 100%;
  height: 100%;
  min-height: 350px;
  padding: 35px 38px 55px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.72;
  letter-spacing: -0.025em;
}

.textarea-wrap textarea::placeholder {
  color: #aeb5b1;
}

.character-count {
  position: absolute;
  right: 28px;
  bottom: 17px;
  color: #98a09c;
  font-size: 10px;
}

.character-count b {
  color: var(--ink-soft);
}

.quick-tones {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
}

.quick-tones > span {
  margin-right: 4px;
  color: #7c8783;
  font-size: 10px;
}

.quick-tones button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
}

.quick-tones button.active {
  color: var(--blue);
  border-color: #aebdff;
  background: #eef1ff;
}

.input-actions {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 22px 12px 26px;
  border-top: 1px solid var(--line);
  color: #98a09c;
  font-size: 10px;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 9px;
  box-shadow: 0 1px 0 #c8cdca;
}

.translate-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(45, 91, 255, 0.2);
  font-size: 12px;
  font-weight: 760;
}

.translate-button:hover,
.steer-form button:hover,
.error-state button:hover {
  background: var(--blue-dark);
}

.translate-button b {
  font-size: 18px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 5px 40px;
  color: #7e8884;
  font-size: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  transform: translateX(-50%);
  padding: 11px 17px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 24px, 720px);
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 42px;
  }

  .intro-copy {
    margin: 0;
  }

  .control-deck {
    grid-template-columns: 1fr 1fr;
    border-radius: 20px;
    margin-bottom: 12px;
  }

  .control-deck label:not(.auto-control) {
    border: 0;
  }

  .auto-control {
    min-height: 48px;
  }

  .translator-grid {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }

  .input-panel {
    order: -1;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .textarea-wrap textarea {
    min-height: 260px;
  }

  .output-stage {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 16px, 520px);
  }

  .topbar {
    height: 76px;
  }

  .brand small {
    display: none;
  }

  .service-status {
    max-width: 155px;
  }

  .service-status span:last-child {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .intro {
    padding: 34px 5px 30px;
  }

  .intro h1 {
    font-size: 39px;
  }

  .control-deck {
    grid-template-columns: 1fr;
  }

  .control-deck label:not(.auto-control) {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
  }

  .auto-control {
    justify-content: space-between;
  }

  .panel-head,
  .output-stage {
    padding-left: 20px;
    padding-right: 20px;
  }

  .textarea-wrap textarea {
    padding: 27px 22px 50px;
    font-size: 19px;
  }

  .input-actions > span {
    display: none;
  }

  .translate-button {
    width: 100%;
    justify-content: space-between;
  }

  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

@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;
  }
}
