/* partyLine — direction D: light, camera-first. Tokens match docs/design/wireframes. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1b1a17;
  --muted: #8b8a83;
  --border: #e5e3dd;
  --accent: #1b1a17;
  --success: #2f9e6b;
  --warning: #d9822b;
  --error: #c9503c;
  --radius-lg: 24px;
  --radius-chip: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

/* The `hidden` attribute must always beat the display rules below. */
[hidden] { display: none !important; }

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: max(env(safe-area-inset-top), 16px) 16px max(env(safe-area-inset-bottom), 16px);
  gap: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  padding: 7px 14px;
  font-size: 14px;
}

.top { display: flex; justify-content: center; position: relative; }
.who { position: absolute; left: 0; }

.timer { background: var(--ink); color: #fff; border: none; }
.timer #rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff5f4d;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.preview {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
#video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);  /* mirror the front preview; the recorded stream stays unmirrored */
}
.preview-hint, .preview-live {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px;
}

.dock { display: flex; align-items: center; justify-content: center; gap: 28px; }

.record {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  display: grid; place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.record:active { transform: scale(0.94); }
.record .glyph-circle { width: 26px; height: 26px; border-radius: 50%; background: #fff; }
.record .glyph-square { width: 22px; height: 22px; border-radius: 6px; background: #fff; }

.flip {
  width: 52px; height: 52px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  position: relative;
}
.flip-placeholder { width: 52px; }

.hint { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }

.upload {
  position: absolute;
  bottom: 118px; left: 50%; translate: -50%;
  background: #fff;
  border: 1px solid var(--warning);
  color: var(--warning);
}

.reconnect {
  position: absolute;
  bottom: 118px; left: 50%; translate: -50%;
  background: #fff;
  border: 1px solid var(--muted);
  color: var(--muted);
}

.timer.warn { background: var(--warning); border: none; }

.panel {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.panel h1 { margin: 0; font-size: 30px; }
.panel h2 { margin: 0; font-size: 22px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.primary {
  margin-top: 8px;
  border: none;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  font-size: 16px;
  cursor: pointer;
}
