:root {
  color-scheme: dark;
  --ink: #edf1ef;
  --muted: #969f9b;
  --line: #303633;
  --paper: #101211;
  --card: #191c1a;
  --surface: #131614;
  --accent: #3d9677;
  --accent-hover: #347f67;
  --accent-dark: #79bca3;
  --accent-soft: #202824;
  --yellow: #f3bd42;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, .035), transparent 34rem),
    var(--paper);
  background-attachment: fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea { font: inherit; }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 38px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 18px;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 6vw, 4rem); letter-spacing: -0.07em; line-height: .95; }
h2 { font-size: 1.22rem; letter-spacing: -0.025em; }
.lede { margin-top: 7px; color: var(--muted); }
.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.translator-card, .examples, .notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.translator-card { padding: clamp(22px, 5vw, 42px); }
.section-heading, .result-heading, .controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading { margin-bottom: 29px; }
.section-heading.compact { margin-bottom: 21px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px rgba(61, 150, 119, .12); }
.field-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
textarea { display: block; width: 100%; resize: vertical; min-height: 124px; padding: 17px 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; outline: none; caret-color: var(--accent); font-size: 1.25rem; line-height: 1.5; transition: border-color .2s, box-shadow .2s; }
textarea::placeholder { color: #676f6b; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(61, 150, 119, .14); }
.field-hint { margin-top: 9px; color: var(--muted); font-size: .82rem; }
.mode-toggle { display: flex; align-items: flex-start; gap: 11px; margin-top: 18px; color: var(--ink); cursor: pointer; }
.mode-toggle input { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); }
.mode-toggle strong, .mode-toggle small { display: block; }
.mode-toggle strong { font-size: .9rem; }
.mode-toggle small { margin-top: 3px; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.controls { justify-content: flex-start; margin: 24px 0 30px; flex-wrap: wrap; }
button { cursor: pointer; border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 750; transition: transform .15s, background .15s, color .15s; }
button:hover { transform: translateY(-1px); }
.primary-button { color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { color: var(--accent-dark); background: var(--accent-soft); }
.copy-feedback { color: var(--accent); font-size: .82rem; }
.result-wrap { position: relative; padding: 19px 72px 19px 19px; background: var(--accent-soft); border-radius: 16px; }
.romanization-wrap { margin-top: 12px; }
.result-heading { margin-bottom: 11px; }
.result-heading .field-label { margin-bottom: 0; }
.result-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.character-count { color: var(--muted); font-size: .76rem; }
.copy-icon-button { position: absolute; top: 50%; right: 19px; display: grid; width: 38px; height: 38px; padding: 0; place-items: center; color: var(--accent-dark); background: rgba(61, 150, 119, .1); border: 1px solid rgba(121, 188, 163, .18); border-radius: 10px; transform: translateY(-50%); }
.copy-icon-button:hover { color: var(--ink); background: rgba(61, 150, 119, .2); transform: translateY(-50%); }
.copy-icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-icon-button.copied { color: #fff; background: var(--accent); animation: copy-confirm .38s ease-out; }
.copy-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy-icon-button .copy-icon, .copy-icon-button .check-icon { grid-area: 1 / 1; transition: opacity .16s ease, transform .2s ease; }
.copy-icon-button .check-icon { opacity: 0; transform: scale(.55) rotate(-12deg); }
.copy-icon-button.copied .copy-icon { opacity: 0; transform: scale(.55) rotate(12deg); }
.copy-icon-button.copied .check-icon { opacity: 1; transform: scale(1) rotate(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.result { display: block; min-height: 42px; overflow-wrap: anywhere; color: var(--accent-dark); font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 700; line-height: 1.35; }
.explanation { position: relative; margin-top: 25px; border-top: 1px solid var(--line); padding-top: 18px; }
.explanation summary { padding-right: 52px; cursor: pointer; color: var(--accent-dark); font-size: .9rem; font-weight: 800; }
.explanation-intro { max-width: 670px; margin-top: 11px; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.explanation-copy-button { top: 29px; right: 0; }
.explanation-copy-button:hover { transform: translateY(-50%); }
.explanation ul { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: .86rem; line-height: 1.65; }
.explanation li + li { margin-top: 7px; }

@keyframes copy-confirm {
  0% { transform: translateY(-50%) scale(1); }
  45% { transform: translateY(-50%) scale(1.12); }
  100% { transform: translateY(-50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .copy-icon-button, .copy-icon-button svg { transition: none; animation: none; }
}
.examples { margin-top: 22px; padding: 25px clamp(22px, 5vw, 34px); box-shadow: none; }
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.example { cursor: pointer; padding: 15px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.example:hover { border-color: var(--accent); background: var(--accent-soft); }
.example-source { display: block; color: var(--ink); font-size: 1.1rem; font-weight: 750; }
.example-output { display: block; margin-top: 5px; color: var(--muted); font-size: .85rem; }
.notice { display: flex; gap: 16px; margin-top: 22px; padding: 22px; background: #201a0e; border-color: #4b3b1a; box-shadow: none; }
.notice-icon { display: grid; flex: 0 0 27px; height: 27px; place-items: center; color: #ffdc82; background: #4a3813; border-radius: 50%; font-weight: 900; }
.notice h2 { margin-bottom: 8px; }
.notice p { color: #d8cba7; font-size: .88rem; line-height: 1.55; }
.notice .muted { margin-top: 7px; color: #a99a73; }
footer { padding-top: 28px; color: var(--muted); text-align: center; font-size: .76rem; }
footer a { color: var(--accent-dark); text-underline-offset: 3px; }
footer a:hover { color: var(--ink); }

@media (max-width: 650px) {
  .shell { padding-top: 30px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .status-pill { align-self: flex-start; }
  .example-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 430px) {
  .hero { align-items: flex-start; }
  .brand-mark { width: 50px; height: 50px; border-radius: 14px; font-size: 25px; }
  .example-grid { grid-template-columns: 1fr; }
}
