:root {
  --ink: #17313a;
  --muted: #6e858c;
  --line: #d8e3e5;
  --paper: #f5f8f7;
  --surface: #fff;
  --teal: #0d5c63;
  --gold: #e1ad3f;
  --coral: #d96c58;
  --shadow: 0 18px 46px rgba(17, 63, 70, .1);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 760px; margin: 0 auto; padding: 20px 18px 52px; }
.topbar, .section-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; font-weight: 800; color: var(--teal); margin: 0 0 5px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1; margin: 0; letter-spacing: 0; }
h2 { font-size: 28px; margin: 0 0 8px; }
h3 { font-size: 18px; margin: 0; }

.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--teal); font-size: 19px; }
.status-strip { margin: 20px 0 14px; min-height: 38px; padding: 10px 14px; background: #e7f1ef; border-radius: 7px; display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--teal); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.status-dot.active { background: #33aa75; box-shadow: 0 0 0 5px #33aa7520; }
.status-mode { margin-left: auto; font-weight: 800; font-size: 11px; letter-spacing: 1px; }

.hero-panel { min-height: 160px; padding: 24px; background: var(--teal); color: #fff; border-radius: 9px; display: flex; justify-content: space-between; align-items: flex-end; box-shadow: var(--shadow); }
.hero-copy p { color: #b8d4d2; margin: 0; }
.live-badge { display: inline-block; padding: 5px 8px; border-radius: 4px; background: #ffffff1c; color: #f2d47c; font-size: 10px; font-weight: 900; letter-spacing: 1px; margin-bottom: 28px; }
.signal { height: 54px; display: flex; gap: 4px; align-items: center; }
.signal i { display: block; width: 4px; border-radius: 5px; background: var(--gold); height: 15px; }
.signal i:nth-child(2) { height: 28px; }
.signal i:nth-child(3) { height: 46px; }
.signal i:nth-child(4) { height: 32px; }
.signal i:nth-child(5) { height: 20px; }
.signal.active i { animation: pulse 1s ease-in-out infinite alternate; }
.signal.active i:nth-child(2) { animation-delay: .1s; }
.signal.active i:nth-child(3) { animation-delay: .2s; }
.signal.active i:nth-child(4) { animation-delay: .3s; }
.signal.active i:nth-child(5) { animation-delay: .4s; }
@keyframes pulse { to { height: 50px; opacity: .65; } }

.translation-stage { background: var(--surface); padding: 25px 22px 24px; border-bottom: 1px solid var(--line); }
.language-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px; font-weight: 800; color: var(--muted); }
.language-label span { color: var(--teal); }
.heard-text, .translated-text { min-height: 31px; font-size: 20px; line-height: 1.35; margin: 9px 0 20px; }
.heard-text { color: #46646c; }
.translated-text { font-size: 24px; font-weight: 750; color: var(--teal); margin-bottom: 0; }
.translation-divider { height: 1px; background: var(--line); position: relative; margin: 22px 0; }
.translation-divider span { position: absolute; top: -8px; left: 0; background: #fff; padding-right: 10px; color: var(--muted); font-size: 9px; letter-spacing: 1.5px; font-weight: 900; }

.drive-controls { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 10px; margin: 16px 0; }
.drive-button { border: 0; border-radius: 8px; min-height: 78px; color: #fff; font-weight: 800; font-size: 17px; display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; }
.drive-button:disabled { opacity: .4; }
.drive-button.start { background: var(--gold); color: #263b3d; }
.drive-button.stop { background: var(--coral); }
.drive-button.volume { background: #fff; border: 1px solid var(--line); color: var(--teal); }
.button-icon { font-size: 22px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 33px; }
.quick-action { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 7px; padding: 12px 6px; font-size: 12px; font-weight: 750; }
.quick-action span { color: var(--teal); font-size: 17px; margin-right: 3px; }

.section-heading { margin-bottom: 13px; }
.context-count { font-size: 11px; color: var(--muted); }
.term-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 34px; }
.term { background: #e8f0ed; border-radius: 5px; padding: 10px 6px; color: var(--teal); font-weight: 800; font-size: 12px; text-align: center; }
.history-section { padding-bottom: 20px; }
.text-button { border: 0; background: transparent; color: var(--coral); font-size: 12px; font-weight: 800; }
.history-list { display: grid; gap: 8px; }
.empty-state { font-size: 13px; color: var(--muted); padding: 18px 0; }
.history-item { background: #fff; border-left: 3px solid var(--gold); padding: 12px 13px; border-radius: 0 6px 6px 0; }
.history-meta { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.history-item p { margin: 3px 0; font-size: 13px; }
.history-item strong { color: var(--teal); }

dialog { border: 0; border-radius: 10px; padding: 0; width: min(92vw, 480px); box-shadow: 0 24px 80px #123b4050; }
dialog::backdrop { background: #123b4066; }
.settings-form { padding: 24px; }
.settings-form label { display: block; font-size: 12px; font-weight: 800; color: var(--ink); margin: 20px 0 0; }
.settings-form input, .settings-form select { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; }
.form-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 10px 0; }
.primary-submit { margin-top: 12px; width: 100%; border: 0; border-radius: 6px; padding: 13px; background: var(--teal); color: #fff; font-weight: 800; }
.secondary-submit { margin-top: 18px; width: 100%; border: 1px solid var(--teal); border-radius: 6px; padding: 12px; background: #fff; color: var(--teal); font-weight: 800; }
.test-result { display: none; margin-top: 10px; border-radius: 6px; padding: 10px 12px; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.test-result.ok { display: block; background: #e8f4ed; color: #1c6b46; }
.test-result.error { display: block; background: #fff0ed; color: #a33b2e; }

@media (max-width: 500px) {
  .app-shell { padding: 16px 14px 38px; }
  .hero-panel { min-height: 145px; padding: 20px; }
  .hero-panel h2 { font-size: 23px; }
  .term-grid { grid-template-columns: repeat(2, 1fr); }
  .term { padding: 11px; }
  .translation-stage { padding: 21px 17px; }
  .translated-text { font-size: 21px; }
}

@media (min-width: 700px) {
  .app-shell { padding-top: 36px; }
}
