/* =========================================================
   SameScene — style.css
   Cozy movie-night for two. Dark by default.
   ========================================================= */

/* ---------- Fonts (self-hosted, SIL OFL 1.1 — see /fonts/OFL-*.txt) ----------
   Variable fonts from Google Fonts, latin + latin-ext subsets (latin-ext holds
   Turkish ğ Ğ ş Ş İ; ı is in latin). One file serves every weight. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Surfaces (plum-black cinema) */
  --bg: #14101a;
  --bg-deep: #0d0a11;
  --surface: #1d1823;
  --surface-2: #272030;
  --surface-3: #332a3d;
  --border: rgba(255, 236, 240, 0.09);
  --border-strong: rgba(255, 236, 240, 0.18);

  /* Text  (contrast on --bg: text 15.6:1, muted 7.9:1, faint 4.8:1) */
  --text: #f6eeea;
  --text-muted: #bdb0b7;
  --text-faint: #8f8290;

  /* Accent: rose / coral */
  --accent: #ff7a8f;          /* text & highlights on dark (7.2:1 on --bg) */
  --accent-strong: #d63d5c;   /* fills behind white text (5.9:1) */
  --accent-hover: #e04a68;
  --accent-soft: rgba(255, 122, 143, 0.14);
  --accent-glow: rgba(255, 107, 129, 0.35);
  --on-accent: #ffffff;

  /* Semantic */
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.14);

  /* Type */
  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;

  /* Space (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;
  --s-16: 64px;

  /* Shape & depth */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

  --tap: 44px;
  --gutter: 16px;
  --header-h: 64px;

  --t-fast: 150ms ease;
  --t-med: 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(214, 61, 92, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(120, 70, 160, 0.16), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }

::selection { background: var(--accent-strong); color: var(--on-accent); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Focus: always visible for keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
}
.brand-mark { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand-mark-play { fill: var(--bg); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-sm { min-height: var(--tap); }
.brand-sm .brand-mark { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-base);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: #3d3347; }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
  padding: 0 var(--s-4);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-block { width: 100%; }
.btn-icon { padding: 0; width: var(--tap); }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-base); /* ≥16px avoids iOS zoom */
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--text-faint); opacity: 1; }
.input:hover { border-color: rgba(255, 236, 240, 0.28); }
.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.input-row { display: flex; gap: var(--s-2); }
.input-row .input { flex: 1; }

/* ---------- Card ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 40%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

/* =========================================================
   LANDING
   ========================================================= */
.landing {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
  min-height: 100dvh;
}

.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-4);
  padding-top: var(--s-6);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.25rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
  white-space: nowrap; /* "yan yana." / "same scene." stay on one line */
}

.hero-sub {
  max-width: 46ch;
  color: var(--text-muted);
  font-size: var(--fs-lg);
}

.entry {
  width: 100%;
  max-width: 420px;
  margin-top: var(--s-4);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  text-align: left;
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-faint);
  font-size: var(--fs-sm);
  margin: var(--s-1) 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* How it works */
.steps { display: flex; flex-direction: column; gap: var(--s-4); }
.steps-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-xl);
  text-align: center;
}
.steps-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--s-4);
  row-gap: 2px;
  align-items: start;
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.step-num {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
}
.step-head { font-size: var(--fs-base); font-weight: 600; }
.step-text { color: var(--text-muted); font-size: var(--fs-sm); }

.landing-foot {
  margin-top: auto;
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-sm);
}

@media (min-width: 720px) {
  .steps-list { grid-template-columns: repeat(3, 1fr); }
  .step { grid-template-columns: 1fr; padding: var(--s-5); }
  .step-num { grid-row: auto; margin-bottom: var(--s-2); }
}

/* =========================================================
   ROOM
   ========================================================= */
.room {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Header */
.room-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-2) var(--gutter);
  border-bottom: 1px solid var(--border);
  background: rgba(20, 16, 26, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.code-chip-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.code-chip-value {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
}

/* Online users */
.user-list {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  min-width: 0;
}
.user-list::-webkit-scrollbar { display: none; }

li.user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  max-width: 180px;
  height: 32px;
  padding: 0 var(--s-3) 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text);
}
li.user .user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
li.user.me {
  background: var(--accent-soft);
  border-color: rgba(255, 122, 143, 0.35);
}
li.user.me .user-name::after {
  content: " (sen)";
  color: var(--text-muted);
  font-weight: 400;
}
.dot {
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

/* Main grid */
.room-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  padding: var(--s-4) var(--gutter) var(--s-6);
  min-height: 0;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}

/* URL bar */
.url-form {
  position: relative;
  display: flex;
  gap: var(--s-2);
}
.url-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.url-input { flex: 1; padding-left: 44px; }
.url-form .btn { padding: 0 var(--s-6); }

/* Source bar: [ link form ........ ][ Bilgisayarımdan aç ] */
.source-bar {
  display: flex;
  align-items: stretch;
  gap: var(--s-2);
}
.source-bar .url-form { flex: 1 1 auto; min-width: 0; }
.file-btn { flex: none; padding: 0 var(--s-4); }
.file-btn .icon { color: var(--accent); }
.file-btn-short { display: none; }

/* Host banner ("Video senin bilgisayarından yayınlanıyor…") — text set by app.js */
.host-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 40px;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 122, 143, 0.32);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.35;
}
.host-banner::before {           /* "live" dot */
  content: "";
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: live-pulse 1.8s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 122, 143, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(255, 122, 143, 0); }
}

/* Player */
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 80px -30px var(--accent-glow);
  isolation: isolate;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-4);
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(214, 61, 92, 0.16), transparent 65%),
    var(--bg-deep);
}
.empty-icon {
  width: 56px; height: 56px;
  margin-bottom: var(--s-2);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  opacity: 0.9;
}
.empty-icon .fill { fill: var(--accent); stroke: none; }
.empty-title { font-weight: 600; font-size: var(--fs-lg); }
.empty-hint { color: var(--text-muted); font-size: var(--fs-sm); max-width: 44ch; }

/* Two ways to start: link / file */
.empty-ways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  width: 100%;
  max-width: 460px;
  margin: var(--s-1) 0;
}
.empty-way {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.empty-way .icon { color: var(--accent); }
.empty-way-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.empty-way-text strong { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.empty-way-sub { font-size: var(--fs-xs); color: var(--text-muted); }

.player-media,
#ytHost,
#filePlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
#filePlayer,
#streamPlayer { object-fit: contain; background: #000; }

/* ---------- Peer stream (viewer) ---------- */
.stream-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  max-width: calc(100% - 32px);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  background: rgba(13, 10, 17, 0.82);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}
.stream-notice::before {         /* subtle spinner */
  content: "";
  flex: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 122, 143, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.stream-notice:empty { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Bottom overlay control bar */
.stream-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto;
  grid-template-areas:
    "seek seek seek seek seek seek"
    "play time .    mute vol  fs";
  align-items: center;
  column-gap: var(--s-1);
  padding: var(--s-6) var(--s-2) var(--s-1);
  background: linear-gradient(to top, rgba(8, 6, 10, 0.92) 0%, rgba(8, 6, 10, 0.6) 55%, transparent 100%);
  color: #fff;
  transition: opacity var(--t-med);
}
.stream-spacer { display: none; }
#streamSeek { grid-area: seek; }
#streamPlayBtn { grid-area: play; }
#streamTime { grid-area: time; }
#streamMuteBtn { grid-area: mute; }
#streamVolume { grid-area: vol; }
#streamFullscreenBtn { grid-area: fs; }

/* Desktop mouse: fade the bar while the pointer is away from the player */
@media (hover: hover) and (pointer: fine) {
  .player:not(:hover):not(:focus-within) .stream-controls { opacity: 0; }
}

.stream-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.stream-btn:hover { background: rgba(255, 255, 255, 0.14); }
.stream-btn:active { background: rgba(255, 255, 255, 0.22); }
.stream-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

.stream-ic {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.ic-play,
.ic-pause,
.stream-ic .solid { fill: currentColor; }
.ic-play { stroke-width: 1.5; }
.ic-pause { stroke: none; }

/* Icon state toggles (classes set by app.js) */
.ic-pause,
.ic-muted { display: none; }
#streamPlayBtn.is-playing .ic-play { display: none; }
#streamPlayBtn.is-playing .ic-pause { display: block; }
#streamMuteBtn.is-muted .ic-sound { display: none; }
#streamMuteBtn.is-muted .ic-muted { display: block; }

.stream-time {
  padding: 0 var(--s-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Ranges: native, tinted with the accent (filled progress in Chrome/Edge/Firefox/Safari) */
.stream-range {
  margin: 0;
  min-width: 0;
  height: 28px;
  accent-color: var(--accent);
  background: transparent;
  cursor: pointer;
}
.stream-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.stream-seek { width: 100%; padding: 0 var(--s-2); }
.stream-volume { width: 88px; }

/* Fullscreen: player fills the screen */
#playerWrap:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#playerWrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#playerWrap::backdrop { background: #000; }
#playerWrap:fullscreen .stream-controls { padding: var(--s-12) var(--s-6) var(--s-4); }
#playerWrap:fullscreen .stream-ic { width: 28px; height: 28px; }
#playerWrap:fullscreen .stream-time { font-size: var(--fs-base); }
#ytPlayer,
#ytHost iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.reaction-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  container-type: size;
}

/* Floating reactions (created by app.js; left:NN% set inline) */
.floating-reaction {
  --drift: 14px;
  position: absolute;
  bottom: 8%;
  font-family: var(--font-emoji);
  font-size: clamp(28px, 6cqw, 48px);
  line-height: 1;
  transform: translateX(-50%);
  will-change: transform, opacity;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  animation: float-up 2.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  user-select: none;
}
.floating-reaction:nth-child(even) { --drift: -16px; animation-duration: 2.7s; }
.floating-reaction:nth-child(3n) { --drift: 6px; animation-duration: 2.3s; }

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
  12% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift) * -0.4), -8cqh) scale(1.1);
  }
  45% {
    transform: translate(calc(-50% + var(--drift)), -32cqh) scale(1);
  }
  75% {
    opacity: 0.9;
    transform: translate(calc(-50% - var(--drift) * 0.5), -54cqh) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift) * 0.6), -70cqh) scale(0.95);
  }
}

/* Autoplay-blocked overlay */
.tap-to-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 64px;
  max-width: calc(100% - 32px);
  padding: 0 var(--s-8);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent-strong);
  color: var(--on-accent);
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  /* dims the whole player behind the button (clipped by .player) */
  box-shadow: 0 0 0 100vmax rgba(8, 6, 10, 0.62), 0 12px 40px -8px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}
.tap-to-play:hover { background: var(--accent-hover); }
.tap-to-play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.04); }
}

/* Controls row: reactions + sync pill */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.reaction-bar {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.reaction-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-family: var(--font-emoji);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.reaction-btn:hover { background: var(--surface-3); transform: translateY(-2px) scale(1.08); }
.reaction-btn:active { transform: scale(0.9); }

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.sync-status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.sync-status[data-state="synced"] {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.3);
}
.sync-status[data-state="syncing"] {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.3);
}
.sync-status[data-state="syncing"]::before { animation: blink 1s ease-in-out infinite; }
.sync-status[data-state="offline"] {
  color: var(--err);
  background: var(--err-soft);
  border-color: rgba(248, 113, 113, 0.3);
}

@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- Chat ---------- */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.chat-title {
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.chat-messages:focus-visible { outline-offset: -2px; }

.chat-form {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input { flex: 1; }

/* Messages (created by app.js) */
.msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: flex-start;
  max-width: 85%;
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-top-left-radius: 4px;
  animation: msg-in 200ms ease-out;
}
.msg-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
}
.msg-name:empty { display: none; }
.msg-text {
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg-time {
  align-self: flex-end;
  font-size: 0.6875rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.msg-time:empty { display: none; }

.msg.mine {
  align-self: flex-end;
  background: var(--accent-strong);
  border-color: transparent;
  border-top-left-radius: var(--r-md);
  border-top-right-radius: 4px;
}
.msg.mine .msg-name { display: none; }
.msg.mine .msg-text { color: var(--on-accent); }
.msg.mine .msg-time { color: rgba(255, 255, 255, 0.82); }

.msg.system {
  align-self: center;
  max-width: 100%;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  padding: 2px var(--s-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  text-align: center;
}
.msg.system .msg-name { display: none; }
.msg.system .msg-text { font-size: var(--fs-xs); color: var(--text-muted); }
.msg.system .msg-time { align-self: baseline; font-size: 0.625rem; }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity var(--t-med), transform var(--t-med), visibility 0s linear 250ms;
}
.toast:empty { padding: 0; border: 0; }
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity var(--t-med), transform var(--t-med), visibility 0s;
}

/* ---------- Name modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(8, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 200ms ease-out;
}
.modal-card {
  width: 100%;
  max-width: 380px;
  padding: var(--s-8) var(--s-6) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop-in 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.modal-mark { width: 40px; height: 40px; margin: 0 auto var(--s-1); }
.modal-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-xl);
}
.modal-text { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--s-2); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ---------- i18n + compliance UI ---------- */

/* TR / EN switch (landing header + room header) */
.lang-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: var(--tap);
  height: var(--tap);
  padding: 0 var(--s-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.lang-toggle:hover { background: var(--surface-2); border-color: rgba(255, 236, 240, 0.28); }

/* "(sen)" after my own name in the user list */
:root:lang(en) li.user.me .user-name::after { content: " (you)"; }

/* Consent line under "Create room" */
.consent-note {
  margin-top: calc(var(--s-1) * -1);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
  text-align: center;
}
.consent-note a { color: var(--accent); text-underline-offset: 2px; }

/* "Report" mail link in the room header (same look as the copy button) */
.report-btn { text-decoration: none; }
.report-btn .icon { width: 18px; height: 18px; }

/* "Anyone with the link can join…" under the reactions */
.room-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  color: var(--text-faint);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
.room-hint .icon { width: 14px; height: 14px; margin-top: 2px; }

/* Peer-to-peer consent dialog */
.p2p-card { max-width: 440px; text-align: left; padding-top: var(--s-6); }
.p2p-card .modal-text { margin-bottom: 0; }
.p2p-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.p2p-list li {
  position: relative;
  padding-left: var(--s-5);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.p2p-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.55em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.p2p-more { color: var(--text-muted); font-size: var(--fs-xs); }
.p2p-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.p2p-actions .btn { flex: 1 1 auto; white-space: normal; line-height: 1.2; text-align: center; }

/* =========================================================
   Responsive
   ========================================================= */

/* Desktop: player left (~70%), chat right, fill viewport */
@media (min-width: 901px) {
  :root { --gutter: 24px; }

  .room { height: 100dvh; min-height: 0; }
  .room-header { flex-wrap: nowrap; position: static; min-height: var(--header-h); }
  .room-meta { margin-left: var(--s-6); }
  .user-list { margin-left: auto; justify-content: flex-end; }

  .room-main {
    grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr);
    grid-template-rows: minmax(0, 1fr);
    gap: var(--s-6);
    padding-top: var(--s-5);
    padding-bottom: var(--s-5);
    overflow: hidden;
  }
  .stage { overflow-y: auto; min-height: 0; }

  /* keep 16:9 fully visible on short, wide screens */
  .player {
    width: min(100%, calc((100dvh - 240px) * 16 / 9));
    margin-inline: auto;
  }
  .source-bar,
  .host-banner,
  .controls-row,
  .room-hint {
    width: min(100%, calc((100dvh - 240px) * 16 / 9));
    margin-inline: auto;
  }
  /* host banner visible: give it room so the player still fits */
  .stage:has(#hostBanner:not([hidden])) .player,
  .stage:has(#hostBanner:not([hidden])) .source-bar,
  .stage:has(#hostBanner:not([hidden])) .host-banner,
  .stage:has(#hostBanner:not([hidden])) .controls-row,
  .stage:has(#hostBanner:not([hidden])) .room-hint {
    width: min(100%, calc((100dvh - 292px) * 16 / 9));
  }

  .chat { height: auto; max-height: 100%; }
}

/* Tablet / phone: stacked */
@media (max-width: 900px) {
  .user-list { order: 3; width: 100%; }
}

@media (max-width: 640px) {
  .empty-icon { display: none; }
  .empty-state { gap: var(--s-2); padding: var(--s-3); }
}

@media (max-width: 600px) {
  .file-btn { padding: 0 var(--s-3); }
  .file-btn-long { display: none; }
  .file-btn-short { display: inline; }
}

@media (max-width: 480px) {
  .brand-sm .brand-name { font-size: var(--fs-base); }
  .code-chip-label { display: none; }
  .btn-ghost span { display: none; }            /* icon-only copy button */
  .btn-ghost { padding: 0; width: var(--tap); }
  .entry { padding: var(--s-5); }
  .url-form .btn { padding: 0 var(--s-4); }
  .reaction-bar { width: 100%; justify-content: space-between; }
  .reaction-btn { font-size: 20px; }
  .chat { height: 380px; }
  .player { border-radius: var(--r-md); }

  /* empty state must fit a ~184px-tall player at 360px */
  .empty-title { font-size: var(--fs-base); }
  .empty-ways { margin: 0; }
  .empty-way { padding: var(--s-2); gap: var(--s-2); }
  .empty-way .icon { width: 18px; height: 18px; }
  .empty-way-sub { display: none; }
  .empty-hint { font-size: var(--fs-xs); line-height: 1.35; }

  /* compact stream bar */
  .stream-controls { padding: var(--s-2) var(--s-1) 2px; column-gap: 0; }
  .stream-range { height: 24px; }
  .stream-time { font-size: var(--fs-xs); padding: 0 var(--s-1); }
  #streamVolume { display: none; }
  .stream-notice { padding: var(--s-2) var(--s-4); font-size: var(--fs-xs); }
  .host-banner { padding: var(--s-2) var(--s-3); }
}

@media (max-width: 359px) {
  .reaction-btn { width: 40px; } /* extremely narrow fallback only */
}

/* =========================================================
   Motion preferences
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .tap-to-play,
  .host-banner::before,
  .stream-notice::before,
  .sync-status[data-state="syncing"]::before,
  .msg,
  .modal,
  .modal-card { animation: none !important; }
  .reaction-btn:hover { transform: none; }

  /* Reactions still need animationend so app.js can remove them:
     replace the rise with a short, stationary fade. */
  .floating-reaction,
  .floating-reaction:nth-child(even),
  .floating-reaction:nth-child(3n) {
    bottom: 30%;
    animation: reaction-fade 1.2s ease-out forwards;
  }
}
@keyframes reaction-fade {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}
