:root {
  --bg: #0b0910;
  --panel: #15111d;
  --panel-2: #1d1728;
  --line: #2d2539;
  --text: #f8f4fb;
  --muted: #a99fb3;
  --accent: #ff4f8b;
  --accent-2: #ff7a59;
  --danger: #ff5555;
  --success: #6ee7a8;
  --shadow: 0 20px 70px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,79,139,.12), transparent 34rem),
    radial-gradient(circle at 90% 30%, rgba(255,122,89,.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.6px; }
.brand img { width: 32px; height: 32px; }
.brand span span { color: var(--accent); }
.online { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px rgba(110,231,168,.75); }

.start-screen {
  width: min(1200px, calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr .85fr;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
  padding: 54px 0 70px;
}
.eyebrow { margin: 0 0 16px; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; }
h1 { margin: 0; font-size: clamp(52px, 7vw, 92px); line-height: .92; letter-spacing: -.065em; }
.hero-copy { max-width: 620px; margin: 28px 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.rules-card { max-width: 680px; padding: 20px; background: rgba(21,17,29,.8); border: 1px solid var(--line); border-radius: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.rules-card label { display: flex; align-items: flex-start; gap: 11px; color: #d8d0df; line-height: 1.45; font-size: 14px; cursor: pointer; }
.rules-card input { margin-top: 3px; accent-color: var(--accent); width: 17px; height: 17px; flex: 0 0 auto; }
.primary-button, .secondary-button, .next-button, .control-button, .icon-button, .message-form button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.primary-button { margin-top: 22px; padding: 16px 26px; color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 34px rgba(255,79,139,.25); }
.primary-button:hover:not(:disabled), .next-button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: .42; cursor: not-allowed; }
.error-text { color: #ff9d9d; min-height: 1.2em; font-size: 13px; }
.legal-links { color: #726a7c; font-size: 12px; }
.legal-links a { color: #b8afc1; }
.preview-card { aspect-ratio: 4/5; max-height: 650px; background: linear-gradient(150deg, #21172b, #100d16); border: 1px solid var(--line); border-radius: 32px; padding: 18px; box-shadow: var(--shadow); }
.preview-placeholder { height: 100%; display: grid; place-content: center; text-align: center; gap: 8px; border: 1px dashed #3b304a; border-radius: 23px; color: var(--muted); padding: 30px; }
.preview-placeholder strong { color: var(--text); }
.camera-icon { width: 68px; height: 68px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: rgba(255,79,139,.1); font-size: 24px; }

.chat-screen { height: calc(100vh - 72px); min-height: 600px; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; }
.video-area { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; min-height: 0; }
.video-card { position: relative; overflow: hidden; min-height: 0; border-radius: 20px; background: #050407; border: 1px solid var(--line); }
.video-card video { width: 100%; height: 100%; display: block; object-fit: cover; background: #050407; }
.local-card video { transform: scaleX(-1); }
.video-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; background: radial-gradient(circle at center, #1f1929, #0b0910 70%); color: var(--muted); }
.video-placeholder strong { color: var(--text); font-size: 17px; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #32283e; border-top-color: var(--accent); animation: spin 1s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.video-meta { position: absolute; z-index: 3; top: 14px; padding: 7px 10px; border-radius: 10px; background: rgba(9,7,12,.72); backdrop-filter: blur(10px); color: #ddd5e4; font-size: 12px; }
.top-left { left: 14px; }
.top-right { right: 14px; }
.moderator-notice { position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); z-index: 4; padding: 9px 13px; border-radius: 999px; background: rgba(255,85,85,.92); color: white; font-size: 12px; font-weight: 800; white-space: nowrap; }

.chat-panel { min-height: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.chat-header { padding: 17px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.chat-header > div { display: grid; gap: 3px; }
.chat-header span { color: var(--muted); font-size: 12px; }
.icon-button { background: #2a2135; color: #ddd5e4; padding: 8px 10px; font-size: 12px; }
.messages { padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.message { max-width: 85%; padding: 10px 12px; border-radius: 13px; line-height: 1.4; word-break: break-word; font-size: 14px; }
.message.you { align-self: flex-end; background: linear-gradient(135deg, #d33f76, #d85d46); }
.message.stranger { align-self: flex-start; background: #292132; }
.system-message { text-align: center; color: #756d7d; font-size: 11px; margin: 8px 0; }
.message-form { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.message-form input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 11px; background: #0f0c14; color: var(--text); padding: 11px 12px; outline: none; }
.message-form input:focus { border-color: #664c76; }
.message-form button { background: var(--accent); color: white; padding: 0 13px; }

.controls { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; }
.control-button, .next-button { padding: 12px 18px; background: #211a2a; color: #ddd5e4; border: 1px solid #352a41; }
.next-button { min-width: 130px; color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; }
.control-button.off { background: #39202a; color: #ffb5c2; }
.control-button.danger { color: #ffadb3; }

.dialog { width: min(460px, calc(100% - 30px)); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; }
.dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog h2 { margin: 0 0 8px; }
.dialog p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog label { display: block; padding: 9px 0; color: #d9d2df; font-size: 14px; }
.dialog input { accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.dialog .primary-button { margin: 0; padding: 11px 15px; }
.secondary-button { background: #2a2135; color: #ddd5e4; padding: 11px 15px; }

.legal-page { width: min(800px, calc(100% - 40px)); margin: 60px auto 100px; }
.legal-page h1 { font-size: 52px; line-height: 1; }
.legal-page h2 { margin-top: 36px; }
.legal-page p, .legal-page li { color: #c0b7c9; line-height: 1.7; }

@media (max-width: 900px) {
  .start-screen { grid-template-columns: 1fr; padding-top: 38px; }
  .preview-card { display: none; }
  .chat-screen { height: auto; min-height: calc(100vh - 72px); grid-template-columns: 1fr; grid-template-rows: auto 320px auto; }
  .video-area { height: min(62vh, 650px); }
  .chat-panel { min-height: 320px; }
}

@media (max-width: 620px) {
  .topbar { height: 60px; padding: 0 16px; }
  .brand { font-size: 19px; }
  .brand img { width: 28px; }
  .start-screen { width: min(100% - 28px, 1200px); min-height: calc(100vh - 60px); }
  h1 { font-size: 53px; }
  .hero-copy { font-size: 16px; }
  .chat-screen { min-height: calc(100vh - 60px); padding: 9px; gap: 9px; }
  .video-area { grid-template-columns: 1fr; height: auto; }
  .remote-card { height: 48vh; min-height: 300px; }
  .local-card { position: absolute; z-index: 5; width: 112px; height: 150px; right: 18px; top: 78px; box-shadow: var(--shadow); }
  .local-card .video-meta { display: none; }
  .controls { position: sticky; bottom: 8px; z-index: 6; flex-wrap: wrap; }
  .control-button { padding: 10px 12px; font-size: 12px; }
  .next-button { flex: 1; }
}
