:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #071728;
  color: #eef8ff;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(11, 102, 161, .28), transparent 42rem),
    radial-gradient(ellipse at 100% 80%, rgba(30, 58, 131, .24), transparent 45rem),
    #071728;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #6bdcff;
  outline-offset: 3px;
}
.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}
.topbar, main, .footer { width: min(100%, 1440px); margin-inline: auto; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 90px; height: 61px; object-fit: contain; }
.brand strong { display: block; font-size: 20px; letter-spacing: -.04em; }
.brand span { display: block; color: #a5cadf; font-size: 13px; }
.connection-label {
  color: #9cdeed;
  border: 1px solid #29506b;
  border-radius: 99px;
  padding: 9px 14px;
  font-size: 13px;
  text-align: right;
}
main { flex: 1; }
.screen { animation: enter .32s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.opening { min-height: 68dvh; display: grid; align-content: center; justify-items: center; text-align: center; }
.opening h1 { margin-bottom: 0; }
.opening p { color: #a9cadd; }
.loading-mark { width: 58px; height: 58px; border: 4px solid #275375; border-top-color: #61d5f8; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
h1 { font-size: clamp(35px, 5.4vw, 72px); line-height: 1.02; letter-spacing: -.06em; margin: .2em 0 .3em; }
h2 { font-size: 25px; letter-spacing: -.04em; margin: 0 0 12px; }
p { line-height: 1.55; }
.eyebrow { margin: 0; color: #5bd0f6; font-size: 12px; font-weight: 800; letter-spacing: .2em; }
.subtle { color: #a9cadd; }
.split-card, .welcome-card, .controls-card, .chat-card {
  background: rgba(9, 29, 47, .94);
  border: 1px solid #2a5470;
  box-shadow: 0 20px 55px rgba(1, 8, 17, .25);
  border-radius: 27px;
}
.pairing, .welcome { min-height: calc(100dvh - 160px); display: grid; align-content: center; }
.split-card { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: clamp(28px, 5vw, 90px); padding: clamp(28px, 5vw, 72px); }
.pairing-intro > p:not(.eyebrow) { max-width: 44ch; font-size: clamp(17px, 2vw, 21px); }
.pairing-intro > p.subtle { font-size: 15px; }
.pairing-form { display: grid; align-content: center; gap: 12px; }
.pairing-form label, #translate-settings label { font-size: 14px; color: #b7daeb; font-weight: 700; }
.pairing-form input, #translate-settings select, .composer textarea {
  min-height: 54px;
  border: 1px solid #37627e;
  border-radius: 13px;
  padding: 13px 15px;
  color: #fff;
  background: #0a2034;
  width: 100%;
}
.pairing-form input + label { margin-top: 10px; }
.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 19px;
  border-radius: 13px;
  border: 1px solid transparent;
  color: #eaf9ff;
  background: #18364d;
  font-weight: 750;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.button:not(:disabled):active, .mode-button:not(:disabled):active { transform: scale(.98); }
.button.primary { background: linear-gradient(130deg, #41c9f2, #71e0ff); color: #052139; }
.button.primary:hover { background: #a0eaff; }
.button.outline { border-color: #37627e; background: #102b41; }
.button.outline:hover { background: #1a415b; }
.button.small { min-height: 46px; font-size: 14px; }
.pairing-form .button { margin-top: 12px; }
.form-message { margin: 2px 0 0; min-height: 1.5em; color: #ffd3a4; }
.welcome-card { text-align: center; padding: clamp(30px, 5vw, 76px); }
.welcome-card > p:not(.eyebrow) { max-width: 620px; margin-inline: auto; color: #bbd9e9; font-size: clamp(17px, 2vw, 21px); }
.welcome-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 820px; margin: 34px auto; }
.welcome-features > div { border: 1px solid #274e69; border-radius: 17px; padding: 18px; background: #0c2740; }
.welcome-features span { display: block; color: #6ddcff; font-size: 25px; }
.welcome-features strong { display: block; margin: 6px 0 3px; font-size: 18px; }
.welcome-features small { display: block; color: #a9cadd; font-size: 13px; line-height: 1.4; }
.start-button { min-width: 230px; min-height: 62px; font-size: 18px; }
.welcome-card .privacy-note { font-size: 13px !important; max-width: 640px; }
.trip { padding-top: 26px; }
.trip-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.trip-heading h1 { font-size: clamp(32px, 4.2vw, 57px); }
.trip-heading p:last-child { margin-bottom: 0; }
.end-button { white-space: nowrap; }
.trip-layout { display: grid; grid-template-columns: minmax(260px, 335px) minmax(0, 1fr); gap: 20px; }
.controls-card { padding: 22px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 5px; background: #061a2c; border-radius: 15px; margin-bottom: 24px; }
.mode-button {
  min-height: 56px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #a9cadd;
  font-weight: 750;
  line-height: 1.2;
  padding: 7px;
}
.mode-button.selected { color: #062034; background: #73dcf6; }
.mode-button span { font-size: 20px; margin-right: 4px; }
.controls-card p { color: #b0cfe0; margin-top: 0; font-size: 14px; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.suggestion { padding: 10px 12px; border: 1px solid #3a6482; border-radius: 99px; color: #d0efff; background: #11334e; min-height: 44px; }
.suggestion:hover { background: #1e4a68; }
#translate-settings label { display: block; margin: 14px 0 6px; }
#translate-settings select { min-height: 52px; }
#swap-languages { margin-top: 15px; width: 100%; }
.help-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid #29485f; }
.help-note strong { color: #c9eafa; }
.help-note p { margin-top: 6px; }
.chat-card { display: flex; flex-direction: column; min-height: min(670px, 72dvh); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #244860; padding: 22px 25px; }
.chat-head strong { display: block; font-size: 22px; }
.chat-head span:not(.mic-light) { display: block; color: #a9cadd; font-size: 14px; }
.mic-light { width: 11px; height: 11px; border-radius: 50%; background: #536f7e; box-shadow: 0 0 0 5px rgba(83,111,126,.15); flex: none; }
.mic-light.recording { background: #ff8178; box-shadow: 0 0 0 6px rgba(255,129,120,.18); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(255,129,120,.08); } }
.messages { flex: 1; min-height: 160px; max-height: 47dvh; overflow: auto; padding: 23px 25px; display: flex; flex-direction: column; align-items: flex-start; gap: 15px; }
.empty-chat { align-self: center; margin: auto; color: #9dbdd0; font-size: 17px; text-align: center; }
.message { max-width: min(82%, 650px); }
.message.mine { align-self: flex-end; }
.message .speaker { color: #a7c8dd; font-size: 12px; font-weight: 750; margin: 0 0 5px; letter-spacing: .03em; }
.message p:last-child { margin: 0; padding: 13px 17px; border-radius: 18px; background: #163955; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.mine p:last-child { background: #1a556b; }
.message-sources { display: flex; flex-wrap: wrap; gap: 8px; margin: 7px 0 0; }
.message-sources span { color: #97e2ff; font-size: 12px; }
.reply-controls { min-height: 0; display: flex; gap: 9px; padding: 0 25px; }
.reply-controls .button { min-height: 42px; font-size: 13px; padding: 8px 12px; }
.chat-status { min-height: 1.4em; margin: 14px 25px 10px; color: #a9d7e9; font-size: 14px; }
.chat-status.error { color: #ffbaab; }
.voice-controls { display: flex; align-items: center; gap: 12px; padding: 0 25px 16px; }
.voice-controls .button { white-space: nowrap; }
.voice-controls .button[aria-pressed="true"] { border-color: #62d6f5; color: #b9efff; }
.voice-controls span { color: #a9cadd; font-size: 12px; line-height: 1.35; }
.composer { display: grid; gap: 12px; border-top: 1px solid #244860; padding: 18px 25px 24px; }
.composer textarea { resize: vertical; max-height: 180px; font-size: 16px; }
.composer-buttons { display: flex; gap: 10px; justify-content: space-between; }
.composer-buttons .button { min-width: 132px; }
.mic-button { background: #254762; }
.mic-button.recording { background: #9d353a; }
.trip-privacy { color: #9bbacd; font-size: 13px; max-width: 80ch; margin: 15px auto; text-align: center; }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 24px 0 10px; color: #759db5; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 740px) {
  .trip-layout { grid-template-columns: 1fr; }
  .controls-card { display: grid; grid-template-columns: 1fr; }
  .chat-card { min-height: 560px; }
  .messages { max-height: 48dvh; }
}
@media (max-width: 620px) {
  .shell { padding-inline: 13px; }
  .topbar { min-height: 72px; }
  .brand img { width: 61px; height: 48px; }
  .brand strong { font-size: 17px; }
  .brand span { font-size: 11px; }
  .connection-label { font-size: 11px; padding: 7px 9px; }
  .split-card { grid-template-columns: 1fr; padding: 24px; }
  .welcome-card { padding: 24px 18px; }
  .welcome-features { grid-template-columns: 1fr; margin-block: 23px; }
  .welcome-features > div { padding: 11px; display: grid; grid-template-columns: 28px 1fr; text-align: left; column-gap: 10px; }
  .welcome-features span { grid-row: span 2; }
  .welcome-features strong { margin: 0; font-size: 16px; }
  .welcome-features small { font-size: 12px; }
  .trip-heading { align-items: flex-start; }
  .trip-heading h1 { font-size: 34px; }
  .trip-heading .eyebrow { font-size: 10px; }
  .end-button { min-height: 43px; padding: 8px 10px; font-size: 13px; }
  .controls-card { padding: 17px; }
  .chat-head, .messages { padding: 17px; }
  .chat-status { margin-inline: 17px; }
  .voice-controls { padding-inline: 17px; flex-wrap: wrap; }
  .composer { padding: 14px 17px 18px; }
  .reply-controls { padding-inline: 17px; }
  .message { max-width: 92%; }
  .composer-buttons .button { min-width: 0; flex: 1; }
  .footer { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
