:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #eef4f0;
  --ink: #13201c;
  --muted: #5f706a;
  --line: #cddbd5;
  --accent: #10756f;
  --accent-strong: #0a5a56;
  --accent-soft: #d9f2ed;
  --danger: #ad343e;
  --shadow: 0 18px 50px rgb(16 24 32 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 82%), rgb(244 247 245 / 55%)),
    url("/images/sound-map.svg") center / cover fixed,
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  min-height: 44px;
}

button {
  cursor: pointer;
}

svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.hero-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 10px 30px rgb(19 32 28 / 18%);
}

.brand-mark img {
  width: 44px;
  height: 44px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.install-button {
  margin-left: auto;
}

.hero-panel > div:not(.brand-mark) {
  min-width: 0;
}

.icon-button,
.swap-button {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgb(19 32 28 / 8%);
}

.translator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}

.language-pane {
  min-height: 520px;
  border: 1px solid rgb(205 219 213 / 86%);
  border-radius: 8px;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.pane-header,
.pane-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.pane-header {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
}

.pane-header label {
  color: var(--muted);
  font-weight: 700;
}

select {
  width: min(210px, 58%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  background-color: var(--surface);
}

textarea,
output {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 22px;
  color: var(--ink);
  background: transparent;
  font-size: clamp(1.15rem, 2.2vw, 1.8rem);
  line-height: 1.45;
  letter-spacing: 0;
  resize: none;
  outline: none;
}

textarea::placeholder {
  color: #8fa09a;
}

output {
  display: block;
  white-space: pre-wrap;
  overflow: auto;
}

.pane-actions {
  border-top: 1px solid var(--line);
  justify-content: space-between;
  background: var(--surface-soft);
}

.tool-button,
.translate-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.tool-button.ghost {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.center-rail {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
}

.translate-button {
  min-width: 140px;
  min-height: 54px;
  background: var(--ink);
  box-shadow: 0 12px 28px rgb(19 32 28 / 20%);
}

.swap-button {
  color: var(--accent-strong);
}

.status-panel {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
}

.status-panel p {
  margin: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgb(16 117 111 / 12%);
}

.status-panel[data-state="busy"] .status-dot {
  animation: pulse 1s ease-in-out infinite;
  background: #d17b0f;
  box-shadow: 0 0 0 6px rgb(209 123 15 / 16%);
}

.status-panel[data-state="error"] {
  color: var(--danger);
}

.status-panel[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgb(173 52 62 / 13%);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(16 117 111 / 30%);
  outline-offset: 3px;
}

.is-listening #listenButton {
  background: var(--danger);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.35);
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 18px 0 22px;
  }

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

  .language-pane {
    min-height: 330px;
  }

  .center-rail {
    grid-template-columns: 64px 1fr;
    align-items: center;
  }

  .translate-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .hero-panel {
    min-height: 74px;
    gap: 10px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 14px;
  }

  .brand-mark img {
    width: 32px;
    height: 32px;
  }

  h1 {
    font-size: clamp(1.65rem, 10vw, 2.2rem);
    line-height: 1;
  }

  .icon-button {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .pane-header,
  .pane-actions {
    padding: 12px;
  }

  .pane-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-button span {
    font-size: 0.92rem;
  }

  select {
    width: 62%;
  }
}
