:root {
  --ink: #121713;
  --paper: #f4f1e9;
  --acid: #d8ff57;
  --sage: #738176;
  --line: rgba(18, 23, 19, .15);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.landing { min-height: 100vh; padding: 28px 5vw 40px; overflow: hidden; position: relative; }
.landing::after { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: var(--acid); filter: blur(90px); opacity: .22; right: -180px; top: 10%; z-index: -1; }
nav, header { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: baseline; color: inherit; text-decoration: none; font-family: Georgia, serif; font-size: 27px; font-weight: 700; letter-spacing: -.04em; }
.brand span { color: #7b9c18; }
.version-number { margin-left: 7px; color: #778078; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 9px; font-weight: 750; letter-spacing: .06em; }
.nav-note { color: var(--sage); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.hero { width: min(1040px, 100%); margin: 9vh auto 0; }
.eyebrow { display: flex; gap: 9px; align-items: center; color: #62705f; font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow i, .room-status i { width: 8px; height: 8px; border-radius: 50%; background: #8eb815; box-shadow: 0 0 0 5px rgba(142,184,21,.14); }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(58px, 9vw, 120px); font-weight: 400; line-height: .82; letter-spacing: -.065em; margin: 28px 0 32px; }
h1 em { color: #71806e; font-weight: 400; }
.lede { font-family: Georgia, serif; font-size: 21px; line-height: 1.5; color: #586158; max-width: 620px; }
.create-card { margin-top: 42px; background: rgba(255,255,255,.68); border: 1px solid rgba(255,255,255,.9); border-radius: 22px; box-shadow: 0 25px 80px rgba(29,37,30,.1); padding: 22px; max-width: 650px; }
.create-card > label:not(:first-child) { margin-top: 18px; }
label { display: block; color: #536052; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 9px; }
input, select, textarea { width: 100%; background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 10px 2px 13px; }
input:focus, textarea:focus { border-color: #779417; }
.create-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; align-items: end; margin-top: 24px; }
.create-row select { grid-column: 1; }
.create-row button, .join-panel button { background: var(--ink); color: white; border: 0; border-radius: 999px; padding: 15px 20px; font-weight: 700; }
.create-row button span { color: var(--acid); margin-left: 8px; }
.error { color: #a33; min-height: 1em; margin: 12px 0 0; font-size: 13px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 30px; color: #687167; font-size: 12px; }

.room { height: 100vh; height: 100dvh; min-height: 560px; overflow: hidden; background: #ece9df; padding: 22px; }
.room > header { height: 64px; max-width: 1400px; margin: auto; padding: 0 14px; }
.room-status { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #657064; }
.share-button, .copy-link, .verify-button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 10px 18px; font-size: 13px; font-weight: 650; }
.verify-button { background: rgba(216,255,87,.24); border-color: rgba(121,151,24,.28); }
.room-actions { display: flex; align-items: center; gap: 8px; }
.danger-button { border: 1px solid rgba(150,45,45,.28); color: #8a2f2f; background: rgba(255,255,255,.25); border-radius: 999px; padding: 10px 18px; font-size: 13px; font-weight: 650; }
.danger-button:hover { background: rgba(150,45,45,.08); }
.room-grid { max-width: 1400px; height: calc(100vh - 108px); height: calc(100dvh - 108px); min-height: 452px; margin: auto; display: grid; grid-template-columns: 290px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.38); }
aside { border-right: 1px solid var(--line); padding: 38px 30px; display: flex; flex-direction: column; }
.room-mark { width: 52px; height: 52px; display: grid; place-items: center; background: var(--acid); border-radius: 16px; font-family: Georgia, serif; font-size: 25px; }
aside h2 { font-family: Georgia, serif; font-size: 28px; margin: 22px 0 6px; }
aside > p { color: #667066; font-size: 13px; line-height: 1.55; }
.security-card { display: flex; gap: 12px; padding: 16px; background: rgba(216,255,87,.22); border: 1px solid rgba(121,151,24,.2); border-radius: 14px; margin-top: 22px; }
.lock { color: #78961c; font-size: 23px; }
.security-card strong, .security-card small { display: block; }
.security-card strong { font-size: 13px; }
.security-card small { color: #66705f; font-size: 11px; line-height: 1.45; margin-top: 4px; }
.copy-link { margin-top: auto; }
aside .fine-print { font-size: 10px; opacity: .75; }
.conversation { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.voice-panel { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; margin: 14px max(22px, 6vw) 0; padding: 11px 13px; border: 1px solid rgba(121,151,24,.24); border-radius: 16px; background: rgba(255,255,255,.72); box-shadow: 0 8px 30px rgba(20,26,21,.04); }
.voice-panel.voice-active { background: rgba(216,255,87,.16); }
.voice-heading { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; min-width: 150px; }
.voice-heading > div { display: grid; gap: 2px; }
.voice-heading strong { font-size: 13px; }
.voice-heading small { color: #687168; font-size: 10px; }
.voice-icon { display: grid; place-items: center; width: 58px; height: 38px; border-radius: 999px; background: var(--acid); }
.voice-icon svg { width: 48px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-icon .voice-icon-divider { opacity: .28; }
.voice-members { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.voice-member { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; max-width: 150px; padding: 6px 9px; border-radius: 999px; background: #eef0e8; color: #4f594f; font-size: 10px; font-weight: 700; }
.voice-member span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-member b { color: #668017; font-size: 10px; }
.voice-member i { width: 7px; height: 7px; border-radius: 50%; background: #7f9873; box-shadow: 0 0 0 3px rgba(127,152,115,.12); }
.voice-member.muted i { background: #9c9f98; box-shadow: none; }
.voice-member.speaking { background: rgba(216,255,87,.5); color: #34410f; }
.voice-member.speaking i { background: #7c9d13; box-shadow: 0 0 0 4px rgba(124,157,19,.18); animation: voice-pulse 1s infinite; }
.voice-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.voice-actions button { border-radius: 999px; padding: 8px 12px; font-size: 11px; font-weight: 750; }
.voice-primary { border: 0; background: var(--ink); color: white; }
.voice-primary:disabled { cursor: not-allowed; opacity: .5; }
.voice-secondary { border: 1px solid rgba(121,151,24,.32); background: var(--acid); color: var(--ink); }
.voice-leave { border: 1px solid rgba(150,45,45,.24); background: transparent; color: #8a2f2f; }
@keyframes voice-pulse { 50% { transform: scale(1.25); } }
.live-video-area { flex: 0 1 300px; min-height: 150px; max-height: 36%; margin: 10px max(22px, 6vw) 0; }
.live-video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; height: 100%; overflow-x: auto; }
.live-video-area.video-count-1 .live-video-grid { grid-template-columns: minmax(220px, 520px); justify-content: center; }
.live-video-tile { position: relative; min-width: 0; height: 100%; overflow: hidden; border-radius: 16px; background: #0c100d; box-shadow: 0 10px 30px rgba(10,14,11,.16); }
.live-video-tile video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; background: #0c100d; }
.live-video-tile.mirror video { transform: scaleX(-1); }
.live-video-tile > span { position: absolute; left: 9px; bottom: 9px; max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 8px; border-radius: 999px; background: rgba(10,14,11,.72); color: white; font-size: 10px; font-weight: 700; backdrop-filter: blur(6px); }
.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 42px max(26px, 8vw) 24px; }
.day-marker { color: #899087; font-size: 10px; text-align: center; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 28px; }
.message { max-width: 620px; margin: 0 0 22px; }
.message.mine { margin-left: auto; text-align: right; }
.message-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; color: #747c74; font-size: 11px; }
.message.mine .message-meta { justify-content: flex-end; }
.message-meta strong { color: #404941; }
.signature-badge { color: #668017; font-weight: 750; }
.signature-badge.legacy { color: #9a6b36; }
.bubble { display: inline-block; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; background: white; padding: 13px 16px; border-radius: 5px 18px 18px 18px; line-height: 1.5; box-shadow: 0 8px 30px rgba(20,26,21,.05); }
.mine .bubble { background: var(--ink); color: #f7f8f3; border-radius: 18px 5px 18px 18px; }
.attachment-bubble { width: min(420px, 72vw); padding: 8px; white-space: normal; overflow: hidden; }
.message-image { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; background: rgba(0,0,0,.05); }
.message-audio { display: block; width: 100%; min-height: 42px; }
.message-video { display: block; width: 100%; max-height: 420px; border-radius: 12px; background: #080a09; }
.attachment-details { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 6px 3px; color: #667066; font-size: 10px; }
.mine .attachment-details { color: #c5cec5; }
.attachment-details a { color: #617c0f; font-weight: 750; text-decoration: none; }
.mine .attachment-details a { color: var(--acid); }
.attachment-loading { display: block; padding: 14px 10px; color: #6d766d; font-size: 12px; }
.attachment-failed { color: #9a3939; }
.media-status { flex: 0 0 auto; margin: 0 max(22px, 6vw) 8px; color: #61730e; font-size: 11px; font-weight: 700; }
.recording-progress { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; margin: 0 max(22px, 6vw) 8px; color: #7f2929; font-size: 11px; font-weight: 750; }
.recording-progress > span:first-child { flex: 0 0 auto; min-width: 166px; }
.recording-progress-meter { flex: 1 1 auto; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(162,58,58,.14); }
.recording-progress-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: #a23a3a; transition: width .2s linear; }
.composer { flex: 0 0 auto; margin: 0 max(22px, 6vw) 26px; background: white; box-shadow: 0 15px 45px rgba(22,28,23,.1); border-radius: 18px; padding: 10px 10px 10px 18px; display: flex; align-items: end; gap: 12px; }
.composer textarea { flex: 1 1 auto; min-width: 0; resize: none; max-height: 130px; border: 0; padding: 11px 0; }
.composer button { flex: 0 0 auto; border: 0; width: 42px; height: 42px; border-radius: 50%; font-size: 22px; }
.composer-tool { background: #eef0e8; color: #596359; }
.composer-tool:hover { background: #e2e7d7; }
.camera-button { color: #536052; font-size: 17px !important; }
.record-button { color: #a23a3a; font-size: 16px !important; }
.record-button.recording { background: #a23a3a; color: white; animation: recording-pulse 1.2s infinite; }
.send-button { background: var(--acid); color: var(--ink); }
@keyframes recording-pulse { 50% { box-shadow: 0 0 0 7px rgba(162,58,58,.13); } }
.join-panel { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(244,241,233,.84); backdrop-filter: blur(14px); z-index: 3; padding: 30px; }
.join-panel > div { width: min(420px, 100%); background: white; border-radius: 22px; padding: 34px; box-shadow: 0 25px 80px rgba(20,25,21,.12); }
.tiny-label { color: #78911f; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.join-panel h2 { font-family: Georgia, serif; font-size: 40px; margin: 14px 0 8px; }
.join-panel p { color: #687168; }
.join-panel button { width: 100%; margin-top: 22px; }
.room-error { padding: 18px; text-align: center; color: #8a2f2f; }
.identity-panel { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(18,23,19,.48); backdrop-filter: blur(10px); }
.camera-panel { position: fixed; inset: 0; z-index: 22; display: grid; place-items: center; padding: 24px; background: rgba(18,23,19,.72); backdrop-filter: blur(10px); }
.identity-dialog { position: relative; width: min(560px, 100%); max-height: min(720px, calc(100vh - 48px)); overflow-y: auto; padding: 34px; border-radius: 24px; background: var(--paper); box-shadow: 0 30px 100px rgba(10,14,11,.28); }
.camera-dialog { position: relative; width: min(720px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 28px; border-radius: 24px; background: var(--paper); box-shadow: 0 30px 100px rgba(10,14,11,.34); }
.camera-dialog h2 { margin: 9px 0 5px; font-family: Georgia, serif; font-size: 32px; }
.camera-dialog > p { margin: 0 42px 18px 0; color: #657064; font-size: 13px; line-height: 1.5; }
.camera-preview-wrap { overflow: hidden; aspect-ratio: 16 / 9; border-radius: 16px; background: #080a09; }
.camera-preview-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; }
.camera-preview-wrap video.mirror { transform: scaleX(-1); }
.camera-status { min-height: 20px; margin: 10px 0; color: #657064; font-size: 12px; text-align: center; }
.camera-actions { display: flex; justify-content: center; gap: 10px; }
.camera-actions button { min-width: 140px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font-weight: 700; }
.camera-actions .record-video { background: var(--ink); color: white; }
.camera-actions .switch-capture-camera { border-color: rgba(121,151,24,.36); background: rgba(216,255,87,.35); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.camera-actions .record-video.recording { background: #a23a3a; border-color: #a23a3a; }
.identity-dialog h2 { margin: 10px 0 8px; font-family: Georgia, serif; font-size: 36px; }
.identity-dialog > p { margin: 0; color: #657064; font-size: 13px; line-height: 1.55; }
.identity-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; }
.participants { display: grid; gap: 10px; margin-top: 24px; }
.participants-empty { margin: 0; color: #7d857c; font-size: 12px; }
.participant { padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.55); }
.participant-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.participant-head strong { font-size: 14px; }
.participant-head span { color: #668017; font-size: 11px; font-weight: 750; }
.safety-code { display: block; width: 100%; margin-top: 11px; padding: 10px 12px; border: 0; border-radius: 9px; background: #171c18; color: #f4f6ee; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .08em; text-align: left; }
.participant-note { display: block; margin-top: 7px; color: #778078; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #111; color: white; border-radius: 999px; padding: 11px 18px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .landing { padding: 22px; }
  .hero { margin-top: 8vh; }
  .create-row { grid-template-columns: 1fr; }
  .create-row select, .create-row button { grid-column: 1; }
  .trust-row { display: grid; gap: 10px; }
  .room { height: 100vh; height: 100dvh; min-height: 0; padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .room > header { height: 58px; }
  .room-status { display: none; }
  .danger-button, .share-button, .verify-button { padding: 9px 10px; font-size: 10px; }
  .room-actions { gap: 5px; }
  .identity-dialog { padding: 28px 22px; }
  .camera-panel { padding: 10px; }
  .camera-dialog { max-height: calc(100dvh - 20px); padding: 22px 16px 16px; border-radius: 18px; }
  .camera-dialog h2 { font-size: 26px; }
  .camera-dialog > p { margin-right: 38px; }
  .camera-actions { flex-wrap: wrap; }
  .camera-actions button { min-width: 0; flex: 1 1 30%; padding: 11px 10px; font-size: 12px; }
  .camera-actions .switch-capture-camera { flex-basis: 100%; }
  .room-grid { grid-template-columns: 1fr; height: calc(100vh - 78px); height: calc(100dvh - 78px - env(safe-area-inset-bottom)); border-radius: 18px; min-height: 0; }
  aside { display: none; }
  .messages { padding: 30px 18px 20px; }
  .voice-panel { position: relative; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 7px; margin: 8px 10px 0; padding: 8px 9px; }
  .voice-heading { min-width: 0; }
  .voice-members { min-height: 29px; order: initial; }
  .voice-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin: 0; }
  .voice-actions button { min-height: 38px; padding: 7px 8px; font-size: 10px; touch-action: manipulation; }
  .voice-actions button:only-child { grid-column: 1 / -1; }
  .voice-leave { grid-column: 2; grid-row: 1; }
  .live-video-area { position: relative; z-index: 1; flex: 0 0 156px; min-height: 0; max-height: none; margin: 8px 10px 0; overflow: hidden; }
  .live-video-grid, .live-video-area.video-count-1 .live-video-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(190px, 78vw); justify-content: start; }
  .live-video-grid { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
  .live-video-tile { border-radius: 13px; }
  .media-status { margin: 0 14px 7px; }
  .recording-progress { margin: 0 14px 7px; gap: 8px; }
  .recording-progress > span:first-child { min-width: 147px; }
  .composer { margin: 0 12px 14px; gap: 7px; padding-left: 9px; }
  .composer textarea { height: 40px; min-height: 40px; padding: 9px 0; overflow-y: auto; font-size: 16px; line-height: 22px; }
  .composer button { width: 38px; height: 38px; }
  .attachment-bubble { width: min(380px, 76vw); }
}
