:root {
  --ink: #171a18;
  --muted: #666d67;
  --paper: #f2f0e9;
  --card: #fbfaf6;
  --line: #d9d7cf;
  --green: #65e97d;
  --green-dark: #184b2a;
  --red: #ef594f;
  --yellow: #f0dc64;
  --shadow: 0 24px 70px rgba(26, 31, 27, 0.08);
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 20%, rgba(101, 233, 125, 0.13), transparent 30%),
    linear-gradient(rgba(23, 26, 24, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 26, 24, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 32px 32px, 32px 32px, auto;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { min-height: 100vh; width: min(1440px, 100%); margin: 0 auto; padding: 0 5vw; }

.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; border: 0; padding: 8px 0; background: transparent; font-size: 14px; font-weight: 900; letter-spacing: 0.13em; cursor: pointer; }
.brand-dot { width: 17px; height: 17px; border-radius: 50%; background: var(--green); border: 5px solid var(--ink); box-shadow: 0 0 0 3px var(--green); }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.install-button { border: 1px solid var(--ink); background: transparent; padding: 9px 12px; color: var(--ink); font-size: 10px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.install-button:hover { background: var(--ink); color: white; }
.privacy-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; color: var(--muted); }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(101, 233, 125, 0.18); }

.landing-grid { min-height: calc(100vh - 150px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.68fr); align-items: center; gap: clamp(56px, 9vw, 150px); padding: 80px 0 92px; }
.hero-copy { padding-bottom: 4vh; }
.eyebrow, .panel-label { margin: 0 0 22px; color: var(--green-dark); font-size: 11px; font-weight: 900; letter-spacing: 0.17em; }
.hero-copy h1 { margin: 0; max-width: 800px; font-size: clamp(50px, 6.5vw, 94px); line-height: 0.96; letter-spacing: -0.065em; font-weight: 820; }
.hero-copy h1 em { color: var(--green-dark); font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.hero-description { max-width: 590px; margin: 34px 0; color: var(--muted); font-size: clamp(17px, 1.45vw, 21px); line-height: 1.55; }
.signal-map { display: flex; align-items: center; gap: 12px; margin-top: 56px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; }
.signal-map i { display: block; width: clamp(28px, 5vw, 72px); height: 1px; background: var(--ink); position: relative; }
.signal-map i::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-top: 1px solid; border-right: 1px solid; transform: rotate(45deg); }

.create-card, .control-panel, .side-panel section { background: rgba(251, 250, 246, 0.94); border: 1px solid var(--line); box-shadow: var(--shadow); }
.create-card { padding: clamp(30px, 4vw, 50px); transform: rotate(0.6deg); }
.card-heading { display: flex; align-items: flex-start; gap: 17px; margin-bottom: 34px; }
.card-heading p, .recorder-header p { margin: 1px 0 6px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 0.13em; }
.card-heading h2, .recorder-header h2, .side-panel h2 { margin: 0; font-size: 23px; letter-spacing: -0.035em; }
.step-number { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; background: var(--ink); color: white; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; }

label { display: grid; gap: 9px; margin: 20px 0; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 15px 16px; outline: none; transition: border-color 160ms, box-shadow 160ms; }
input:focus, select:focus { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(101, 233, 125, 0.2); }
input::placeholder { color: #aaaea9; }

.primary-button, .record-button, .stop-button { width: 100%; border: 0; padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; font-weight: 850; cursor: pointer; transition: transform 150ms, box-shadow 150ms, opacity 150ms; }
.primary-button { margin-top: 26px; background: var(--green); color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.primary-button:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.primary-button:disabled, .record-button:disabled { opacity: 0.5; cursor: not-allowed; }
.microcopy { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: 11px; }
.error-message { padding: 11px 13px; margin: 18px 0 0; border-left: 3px solid var(--red); background: rgba(239, 89, 79, 0.1); color: #853029; font-size: 12px; line-height: 1.45; }

.room-layout { padding: 54px 0 90px; }
.room-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.room-heading .eyebrow { margin-bottom: 10px; }
.room-heading h1 { margin: 0; font-size: clamp(36px, 5vw, 70px); line-height: 1; letter-spacing: -0.055em; }
.room-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; white-space: nowrap; }
.room-status span { width: 10px; height: 10px; border-radius: 50%; background: #aeb3af; }
.room-status.live span { background: var(--red); box-shadow: 0 0 0 6px rgba(239, 89, 79, 0.13); animation: pulse 1.4s infinite; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr); align-items: start; gap: 24px; }
.control-panel { min-height: 600px; padding: clamp(28px, 4.5vw, 64px); }
.side-panel { display: grid; gap: 18px; }
.side-panel section { padding: 28px; box-shadow: none; }
.side-panel .panel-label { margin-bottom: 9px; }
.side-panel h2 { font-size: 24px; }
.side-panel p { color: var(--muted); font-size: 13px; line-height: 1.55; }

.join-flow { max-width: 610px; margin: 0 auto; }
.quality-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 23px 0; }
.quality-choice button { border: 1px solid var(--line); background: white; padding: 16px; text-align: left; cursor: pointer; }
.quality-choice button.selected { border-color: var(--green-dark); box-shadow: inset 0 -4px var(--green); }
.quality-choice strong, .quality-choice span { display: block; }
.quality-choice strong { font-size: 13px; }
.quality-choice span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.consent-row { grid-template-columns: 19px 1fr; align-items: start; gap: 11px; padding: 16px; border: 1px solid var(--line); background: #f5f4ee; text-transform: none; letter-spacing: 0; line-height: 1.45; }
.consent-row input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--green-dark); }

.recorder-card { max-width: 780px; margin: 0 auto; }
.recorder-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.state-badge { padding: 8px 11px; background: #e6e7e3; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.state-badge.recording { background: rgba(239, 89, 79, 0.12); color: #a02d25; }
.state-badge.ready, .state-badge.uploaded { background: rgba(101, 233, 125, 0.2); color: var(--green-dark); }
.meter { height: 144px; display: flex; align-items: center; gap: clamp(3px, 0.5vw, 7px); margin: 52px 0 24px; padding: 24px; background: var(--ink); overflow: hidden; }
.meter span { width: 100%; height: 14%; background: #39403b; transition: height 100ms, background 100ms; }
.meter span.active { height: calc(18% + var(--meter-level, 1%)); background: var(--green); }
.meter span:nth-child(3n).active { height: 78%; }
.meter span:nth-child(4n).active { height: 56%; }
.meter span:nth-child(5n).active { height: 91%; }
.meter.is-recording span.active { background: var(--red); }
.recorder-time { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.recorder-time strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(46px, 7vw, 82px); letter-spacing: -0.08em; }
.recorder-time span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.record-button, .stop-button { margin-top: 26px; justify-content: center; gap: 10px; }
.record-button { background: var(--ink); color: white; }
.record-button span, .stop-button span { width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.stop-button { background: #fff; border: 1px solid var(--ink); }
.stop-button span { border-radius: 1px; }
.stop-button.subtle { color: var(--muted); border-color: var(--line); }
.upload-note { margin: 22px 0 0; padding: 12px; background: rgba(240, 220, 100, 0.25); text-align: center; font-size: 12px; }
.download-local { display: block; margin-top: 16px; color: var(--green-dark); font-size: 12px; font-weight: 800; text-align: center; }
.room-error { max-width: 780px; margin: 20px auto 0; }

.invite-field { display: grid; grid-template-columns: 1fr auto; margin-top: 20px; }
.invite-field input { min-width: 0; padding: 12px; font-family: ui-monospace, monospace; font-size: 10px; }
.invite-field button { border: 0; background: var(--ink); color: white; padding: 0 15px; font-size: 11px; font-weight: 800; cursor: pointer; }
.invite-card ol { margin: 22px 0 0; padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.participants-heading { display: flex; align-items: center; justify-content: space-between; }
.participants-heading span { display: grid; place-items: center; min-width: 26px; height: 26px; background: var(--ink); color: white; font-family: ui-monospace, monospace; font-size: 11px; }
.participant-list { margin-top: 14px; }
.participant { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); }
.participant-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb3af; }
.participant-dot.ready, .participant-dot.uploaded { background: var(--green); }
.participant-dot.recording, .participant-dot.uploading { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 89, 79, 0.12); }
.participant strong, .participant small { display: block; }
.participant strong { font-size: 12px; }
.participant small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.participant a { color: var(--green-dark); font-size: 18px; font-weight: 900; text-decoration: none; }
.participant a span { font-size: 9px; }
.track-waiting { color: #a7aca8; font-size: 9px; font-weight: 800; }
.empty-state { padding: 16px 0; border-top: 1px solid var(--line); }
.safety-note { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 12px 8px; }
.safety-note > span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--ink); border-radius: 50%; font-family: Georgia, serif; font-style: italic; }
.safety-note p { margin: 2px 0; font-size: 11px; }

footer { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
footer span { font-weight: 900; letter-spacing: 0.1em; }
footer p { margin: 0; text-align: right; }

@keyframes pulse { 50% { transform: scale(0.75); opacity: 0.7; } }

@media (max-width: 920px) {
  .landing-grid, .workspace-grid { grid-template-columns: 1fr; }
  .landing-grid { gap: 48px; padding-top: 58px; }
  .create-card { transform: none; }
  .side-panel { grid-template-columns: 1fr 1fr; }
  .safety-note { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .app-shell { padding: 0 20px; }
  .topbar { height: 70px; }
  .privacy-pill { font-size: 0; }
  .privacy-pill::after { content: "LOCAL"; font-size: 10px; }
  .topbar-actions { gap: 10px; }
  .install-button { padding: 8px 10px; font-size: 9px; }
  .landing-grid { padding: 48px 0 72px; }
  .hero-copy h1 { font-size: 48px; }
  .signal-map { gap: 8px; }
  .create-card, .control-panel { padding: 25px; }
  .room-heading { align-items: flex-start; flex-direction: column; }
  .side-panel { grid-template-columns: 1fr; }
  .quality-choice { grid-template-columns: 1fr; }
  .recorder-header, .recorder-time { align-items: flex-start; flex-direction: column; }
  .recorder-time { gap: 4px; }
  .meter { height: 110px; padding: 16px; }
  footer { align-items: flex-start; flex-direction: column; padding: 22px 0; }
  footer p { text-align: left; }
}

@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; }
}
