:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #edf2f7;
  --muted: #aab7c5;
  --accent: #63b3ff;
  --accent-strong: #9fe1ff;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(99,179,255,.14), transparent 35%),
    linear-gradient(180deg, #08101b 0%, #05070a 60%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body { min-height: 100vh; }

.app-shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .78rem;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.02;
}

.lede, .hint, .meta {
  color: var(--muted);
  line-height: 1.6;
}

.status-card, .panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.status-card {
  padding: 18px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 700;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #8b97a6;
  box-shadow: 0 0 0 0 rgba(99,179,255,.5);
}

.dot.ok {
  background: #46d39f;
  box-shadow: 0 0 0 6px rgba(70,211,159,.12);
}

.dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255,107,107,.12);
}

.panel {
  padding: 18px;
}

.transcript-panel { margin-bottom: 16px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-log {
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.message {
  padding: 14px 16px;
  border-radius: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  justify-self: end;
  max-width: min(80%, 780px);
  background: rgba(99,179,255,.16);
  border: 1px solid rgba(99,179,255,.25);
}

.message.assistant {
  justify-self: start;
  max-width: min(80%, 780px);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
}

.message.system {
  max-width: 100%;
  color: #d2dde8;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}

.composer {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(3,7,12,.55);
  color: var(--text);
  font: inherit;
}

textarea:focus {
  outline: 2px solid rgba(99,179,255,.3);
  border-color: rgba(99,179,255,.45);
}

.controls, .composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.composer-actions {
  justify-content: space-between;
}

.live-transcript {
  color: var(--accent-strong);
  min-height: 1.4em;
}

.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(180deg, #94d1ff 0%, #63b3ff 100%);
  color: #06111d;
  font-weight: 800;
}

.ghost-btn {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  flex-wrap: wrap;
}

.lang-picker select {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(3,7,12,.65);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.hint {
  margin: 12px 0 0;
  font-size: .92rem;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .message.user,
  .message.assistant {
    max-width: 100%;
  }
}

@media (max-width: 520px) and (orientation: portrait) {
  html, body {
    height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 100dvh;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 0;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.05;
    margin-bottom: 6px;
  }

  .lede {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.35;
  }

  .status-card {
    padding: 10px 12px;
  }

  .status-row {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .meta + .meta {
    display: none;
  }

  .status-card #secureContextNote {
    display: none;
  }

  .panel {
    padding: 10px 12px;
    border-radius: 14px;
  }

  .transcript-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .composer-panel {
    flex: 0 0 auto;
  }

  .transcript-panel {
    margin-bottom: 0;
  }

  .panel-header {
    margin-bottom: 8px;
  }

  .panel-header h2 {
    font-size: 0.98rem;
  }

  .chat-log {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    gap: 8px;
  }

  .message {
    padding: 10px 12px;
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .composer {
    gap: 8px;
  }

  textarea {
    min-height: 64px;
    padding: 10px 12px;
    font-size: 0.96rem;
    border-radius: 12px;
  }

  .controls,
  .settings-row,
  .composer-actions {
    gap: 8px;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .composer-actions {
    align-items: flex-start;
  }

  .primary-btn,
  .ghost-btn {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .toggle {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .lang-picker {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .lang-picker select {
    width: 100%;
  }

  .hint {
    display: none;
  }

  .live-transcript {
    font-size: 0.86rem;
    line-height: 1.25;
    min-height: 1em;
  }
}
