:root {
  --ink: #18322f;
  --muted: #65736f;
  --paper: #f5f2e9;
  --surface: rgba(255, 255, 252, 0.92);
  --line: rgba(34, 66, 61, 0.13);
  --green: #216b5d;
  --green-dark: #175247;
  --mint: #d9eadf;
  --coral: #dc765f;
  --coral-soft: #f6ded5;
  --shadow: 0 22px 70px rgba(35, 61, 55, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 11%, rgba(255, 255, 255, 0.82), transparent 28rem),
    linear-gradient(180deg, #f7f4ec 0%, #f1eee4 100%);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
[hidden] { display: none !important; }
.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; }

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}
.ambient-one { width: 28rem; height: 28rem; top: 23%; right: -18rem; background: rgba(210, 231, 219, 0.55); }
.ambient-two { width: 23rem; height: 23rem; bottom: -14rem; left: -10rem; background: rgba(241, 205, 191, 0.35); }

.site-header, main, footer { position: relative; z-index: 1; }

.site-header {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; gap: 2.5px;
  border-radius: 13px; color: #fff; background: var(--green); box-shadow: 0 7px 18px rgba(33, 107, 93, 0.2);
}
.brand-mark span { width: 3px; border-radius: 2px; background: currentColor; }
.brand-mark span:nth-child(1), .brand-mark span:nth-child(5) { height: 9px; opacity: 0.72; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(4) { height: 17px; }
.brand-mark span:nth-child(3) { height: 25px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: -0.3px; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

.privacy-pill {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px; color: var(--green-dark); background: rgba(224, 237, 228, 0.72);
  border: 1px solid rgba(33, 107, 93, 0.09); border-radius: 999px; font-size: 13px; font-weight: 650;
}
.privacy-pill svg, .feature-icon svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

main { width: min(970px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 44px 0 34px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px var(--coral-soft); }
.hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(45px, 6.4vw, 73px); font-weight: 400; line-height: 0.99; letter-spacing: -0.052em; }
.hero h1 em { color: var(--green); font-weight: 400; }
.hero-copy { max-width: 630px; margin: 23px auto 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.ru-helper { display: block; margin-top: 5px; color: #7c8985; font-size: .78em; font-weight: 450; line-height: 1.45; }
.hero-helper { max-width: 630px; margin: 13px auto -12px; font-size: 13px; }
.inline-helper { color: #83908c; font-size: .82em; font-weight: 500; text-transform: none; letter-spacing: 0; }
.button-helper { margin-left: 5px; font-size: .76em; font-weight: 550; opacity: .82; }

.workspace {
  overflow: hidden; background: var(--surface); border: 1px solid rgba(30, 72, 64, 0.12); border-radius: 25px;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.session-gate { padding: 38px; }
.role-intro { max-width: 580px; margin: 0 auto 28px; text-align: center; }
.step-label, .share-label { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.role-intro h2 { margin: 8px 0; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 400; }
.role-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.role-grid { width: min(560px, 100%); margin: 0 auto; }
.role-card { position: relative; min-height: 245px; padding: 27px; display: flex; flex-direction: column; align-items: flex-start; border-radius: 18px; border: 1px solid var(--line); }
.host-card { background: rgba(224, 239, 229, .55); }
.listener-card { background: rgba(249, 232, 224, .5); }
.role-number { color: rgba(33, 107, 93, .32); font-family: Georgia, serif; font-size: 32px; }
.listener-card .role-number { color: rgba(220, 118, 95, .46); }
.role-card h3 { margin: 12px 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 400; }
.role-card p { margin: 0 0 21px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.secondary-button { min-height: 42px; margin-top: auto; padding: 10px 17px; color: white; background: var(--green); border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; }
.secondary-button.coral { background: var(--coral); }
.secondary-button:disabled { cursor: wait; opacity: .5; }
.join-form { width: 100%; margin-top: auto; display: grid; gap: 9px; }
.join-form input { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); background: rgba(255,255,255,.7); border: 1px solid rgba(70,75,70,.18); border-radius: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.join-form input:focus { outline: 3px solid rgba(220,118,95,.22); border-color: var(--coral); }
.room-owner-action { width: 100%; margin-top: 17px; padding-top: 14px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.text-button { padding: 2px; color: var(--green-dark); background: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { cursor: wait; opacity: .5; }
.share-strip { padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #f5eee5; border-bottom: 1px solid var(--line); }
.share-strip > div:first-child { min-width: 0; }
.share-strip strong { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; color: #4b5854; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.share-link { width: min(560px, 62vw); margin-top: 8px; padding: 8px 10px; color: #34423e; background: rgba(255,255,255,.72); border: 1px solid rgba(33,107,93,.16); border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.share-link:focus { outline: 3px solid rgba(33,107,93,.16); border-color: var(--green); }
.share-note { display: block; max-width: 520px; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.share-note .ru-helper { margin-top: 2px; }
.share-actions { display: flex; align-items: center; gap: 8px; }
.listener-count { margin-right: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.copy-button { padding: 7px 10px; color: var(--green-dark); background: rgba(255,255,255,.65); border: 1px solid rgba(33,107,93,.15); border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 700; white-space: nowrap; }
.copy-button.primary { color: white; background: var(--green); }
.workspace-topbar { height: 55px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; background: rgba(245, 248, 242, 0.75); border-bottom: 1px solid var(--line); }
.connection-status, .session-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.status-orb { width: 8px; height: 8px; border-radius: 50%; background: #d7a14b; box-shadow: 0 0 0 4px rgba(215, 161, 75, 0.13); }
.status-orb.ready { background: #4e9d78; box-shadow: 0 0 0 4px rgba(78, 157, 120, 0.13); }
.status-orb.listening { background: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); animation: orb-pulse 1.45s ease-out infinite; }
.status-orb.error { background: #ba3d3d; box-shadow: 0 0 0 4px rgba(186, 61, 61, 0.12); }
.session-meta { font-variant-numeric: tabular-nums; }
.session-meta svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.meta-divider { width: 1px; height: 14px; background: var(--line); }

.captions { min-height: 360px; max-height: 520px; padding: 30px 34px; overflow: auto; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #c6d2cd transparent; }
.empty-state { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.listening-illustration { height: 66px; display: flex; align-items: center; gap: 6px; color: var(--green); }
.listening-illustration span { width: 5px; height: 16px; border-radius: 99px; background: currentColor; opacity: 0.25; }
.listening-illustration span:nth-child(2), .listening-illustration span:nth-child(6) { height: 28px; opacity: 0.4; }
.listening-illustration span:nth-child(3), .listening-illustration span:nth-child(5) { height: 43px; opacity: 0.62; }
.listening-illustration span:nth-child(4) { height: 60px; opacity: 0.85; }
.empty-state h2 { margin: 15px 0 7px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 25px; }
.empty-state h2 .ru-helper { margin-top: 3px; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 12px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; }

.transcript-list { display: flex; flex-direction: column; gap: 14px; }
.utterance, .live-card { position: relative; padding: 20px 22px 18px 74px; border-radius: 17px; }
.utterance { background: #f7f8f4; border: 1px solid rgba(35, 79, 69, 0.08); animation: card-in 260ms ease both; }
.live-card { margin-top: 14px; background: linear-gradient(135deg, rgba(224, 239, 229, 0.72), rgba(245, 249, 244, 0.88)); border: 1px solid rgba(42, 113, 94, 0.13); }
.utterance-time { position: absolute; top: 23px; left: 19px; width: 42px; color: #8a9692; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.english-text { margin: 0; font-family: Georgia, "Times New Roman", serif; color: var(--ink); font-size: 22px; line-height: 1.36; }
.russian-text { margin: 9px 0 0; color: #596b66; font-size: 20px; line-height: 1.45; }
.thinking-line { width: 100%; height: 2px; margin-top: 14px; overflow: hidden; background: rgba(33, 107, 93, 0.08); border-radius: 2px; }
.thinking-line span { display: block; width: 35%; height: 100%; background: var(--green); animation: thinking 1.25s ease-in-out infinite; }

.workspace-controls { min-height: 96px; padding: 14px 25px; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto auto auto; align-items: center; border-top: 1px solid var(--line); background: rgba(249, 248, 243, 0.84); }
.listen-button { grid-column: 2; grid-row: 1; min-width: 220px; display: flex; align-items: center; justify-content: center; gap: 11px; padding: 12px 24px; color: white; background: var(--green); border: 0; border-radius: 999px; box-shadow: 0 9px 23px rgba(33, 107, 93, 0.22); cursor: pointer; font-weight: 720; transition: 160ms ease; }
.listen-button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 12px 27px rgba(33, 107, 93, 0.25); }
.listen-button:focus-visible, .clear-button:focus-visible { outline: 3px solid rgba(220, 118, 95, 0.4); outline-offset: 3px; }
.listen-button:disabled { cursor: wait; opacity: 0.53; box-shadow: none; }
.listen-button.active { background: var(--coral); box-shadow: 0 9px 23px rgba(220, 118, 95, 0.24); }
.button-icon { width: 23px; height: 23px; display: grid; place-items: center; }
.button-icon svg { grid-area: 1 / 1; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.stop-icon { opacity: 0; }
.listen-button.active .mic-icon { opacity: 0; }
.listen-button.active .stop-icon { opacity: 1; fill: currentColor; stroke: none; }
.level-meter { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 3px; width: 100px; color: var(--green); opacity: 0.45; }
.level-meter span { width: 3px; height: 8px; border-radius: 2px; background: currentColor; transform: scaleY(0.28); transition: transform 70ms linear; }
.level-meter span:nth-child(2), .level-meter span:nth-child(4) { height: 15px; }
.level-meter span:nth-child(3) { height: 22px; }
.level-meter.level-1 span:nth-child(1),
.level-meter.level-2 span:nth-child(-n + 2),
.level-meter.level-3 span:nth-child(-n + 3),
.level-meter.level-4 span:nth-child(-n + 4),
.level-meter.level-5 span { transform: scaleY(1); }
.clear-button { grid-column: 3; grid-row: 1; justify-self: end; width: 40px; height: 40px; display: grid; place-items: center; color: #7b8985; background: transparent; border: 1px solid transparent; border-radius: 50%; cursor: pointer; transition: 150ms ease; }
.clear-button:hover { color: var(--coral); background: var(--coral-soft); }
.clear-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.microphone-picker { grid-column: 1 / -1; grid-row: 2; margin: 9px auto 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: #7d8985; font-size: 10px; }
.microphone-picker span { font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.microphone-picker select { max-width: min(370px, 70vw); padding: 4px 24px 4px 8px; color: #566661; background: rgba(255,255,255,.74); border: 1px solid rgba(33,107,93,.14); border-radius: 7px; font: inherit; text-overflow: ellipsis; }
.microphone-picker select:disabled { opacity: .62; }
.audio-diagnostic { grid-column: 1 / -1; grid-row: 3; margin-top: 7px; color: #7d8985; font-size: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.listener-mode .workspace-controls { grid-template-columns: 1fr auto; }
.listener-mode .level-meter, .listener-mode .listen-button, .listener-mode .microphone-picker { display: none; }
.listener-mode .clear-button { grid-column: 2; }
.listener-mode .audio-diagnostic { grid-row: 1; grid-column: 1; margin: 0; text-align: left; }

.trust-row { margin: 28px 10px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.trust-row article { display: flex; align-items: flex-start; gap: 13px; padding: 13px 5px; }
.feature-icon { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; color: var(--green); background: rgba(222, 236, 225, 0.8); border-radius: 12px; }
.feature-icon svg { width: 20px; }
.trust-row h3 { margin: 2px 0 5px; font-size: 13px; }
.trust-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

footer { width: min(970px, calc(100% - 48px)); margin: 35px auto 0; padding: 23px 0 30px; display: flex; justify-content: center; gap: 10px; color: #87918e; border-top: 1px solid var(--line); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.footer-dot { color: var(--coral); }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 22px; max-width: min(390px, calc(100% - 44px)); padding: 14px 17px; color: white; background: #843d36; border-radius: 12px; box-shadow: 0 12px 36px rgba(40, 30, 25, 0.2); font-size: 14px; line-height: 1.4; }

@keyframes orb-pulse { 0% { box-shadow: 0 0 0 0 rgba(220,118,95,.36); } 75%,100% { box-shadow: 0 0 0 8px rgba(220,118,95,0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes thinking { from { transform: translateX(-120%); } to { transform: translateX(340%); } }

@media (max-width: 720px) {
  .site-header, main, footer { width: min(100% - 28px, 970px); }
  .site-header { padding-top: 18px; }
  .privacy-pill span { display: none; }
  .privacy-pill { width: 39px; height: 39px; justify-content: center; padding: 0; }
  .brand-copy small { display: none; }
  .hero { padding: 33px 8px 26px; }
  .hero h1 { font-size: clamp(39px, 12vw, 56px); }
  .hero-copy { font-size: 15px; }
  .workspace { border-radius: 20px; }
  .workspace-topbar { padding: 0 16px; }
  .connection-status { max-width: 59%; }
  #status-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .captions { min-height: 330px; padding: 22px 16px; }
  .session-gate { padding: 25px 16px; }
  .role-card { min-height: 220px; }
  .share-strip { align-items: flex-start; flex-direction: column; }
  .share-link { width: 100%; }
  .share-actions { width: 100%; flex-wrap: wrap; }
  .listener-count { width: 100%; }
  .empty-state { min-height: 285px; }
  .utterance, .live-card { padding: 18px 17px 17px; }
  .utterance-time { position: static; width: auto; margin-bottom: 8px; }
  .english-text { font-size: 20px; }
  .workspace-controls { padding: 15px 14px; grid-template-columns: 44px 1fr 44px; gap: 8px; }
  .listen-button { min-width: 0; padding-inline: 13px; }
  .level-meter { width: 39px; overflow: hidden; }
  .trust-row { grid-template-columns: 1fr; gap: 5px; margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
