@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --bg: #121214;
  --card: #1a1a1f;
  --card-2: #22222a;
  --accent: #dab3f9;
  --accent-dim: rgba(218, 179, 249, 0.28);
  --text: #f5f5f7;
  --muted: #9a9aa8;
  --border: #2c2c36;
  --green: #3ddc97;
  --danger: #ff6b8a;
  --lena: #ffb796;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; min-height: 100dvh; }

a { color: var(--accent); text-decoration: none; }

.bg-glow {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(218, 179, 249, 0.2), transparent 70%),
    var(--bg);
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  box-shadow: 0 0 48px var(--accent-dim), 0 20px 60px rgba(0,0,0,.5);
  border: 1px solid rgba(218, 179, 249, 0.12);
}

.card.wide { max-width: 720px; }

.brand-heart {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
}

.brand-title {
  font-family: "Playfair Display", Georgia, serif;
  text-align: center;
  font-size: clamp(2rem, 6vw, 2.4rem);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-tag {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
  margin-bottom: 28px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.field-hint {
  float: right;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.input {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-dim);
}

.input svg, .input .icon {
  color: var(--muted);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.input input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.input input::placeholder { color: #6b6b7a; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: transform .1s, opacity .15s, background .15s, filter .15s;
  text-decoration: none;
  color: inherit;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #1a1222;
  padding: 14px 18px;
  font-size: 1.05rem;
  margin-top: 8px;
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 10px;
}

.btn-outline:hover { background: rgba(218, 179, 249, 0.08); }

.btn-accent {
  background: var(--accent);
  color: #1a1222;
  padding: 10px 14px;
  font-weight: 700;
}

.footer-note {
  text-align: center;
  color: #8a7a9a;
  font-size: 0.8rem;
  margin-top: 20px;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
  min-height: 1.2em;
}

/* Create page */
.create-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.create-header .logo-mark {
  width: 28px;
  height: 28px;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.create-header .name {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
}

.create-title {
  font-size: clamp(1.45rem, 4vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.create-sub {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.success-block { display: none; }
.success-block.show { display: block; }

.success-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.check {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1222;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.link-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-row .input { flex: 1; min-width: 180px; }

.access-note {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  margin-top: 24px;
}

/* ========== Room / watch layout ========== */
.room-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #101012;
  flex-shrink: 0;
  min-height: 52px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.topbar-brand .heart { color: var(--accent); font-size: 1.05rem; }

.topbar-brand .brand-name {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
}

.topbar .vsep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(61, 220, 151, 0.7);
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 1fr);
  min-height: 0;
  min-width: 0;
}

.player-wrap {
  position: relative;
  background: #000;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.player-stage {
  flex: 1;
  position: relative;
  background: #050508;
  min-height: 180px;
}

.player-stage iframe,
.player-stage video,
.player-stage #ytplayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.28);
  cursor: pointer;
  z-index: 2;
}

.play-overlay.hidden { display: none; }

.play-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(218, 179, 249, 0.92);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: 0 0 36px var(--accent-dim);
  padding-left: 0;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  background: #121214;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.progress {
  width: 100%;
  height: 5px;
  background: #2a2a36;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  touch-action: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.controls-row button {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 4px 6px;
  line-height: 1;
  flex-shrink: 0;
}

.time {
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0.9;
}

.ctrl-right {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.ctrl-right button { color: var(--accent); opacity: 0.9; }

/* Chat */
.chat {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #16161a;
  min-height: 0;
  min-width: 0;
}

.chat-header {
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar.kira { background: rgba(218,179,249,0.28); color: var(--accent); }
.avatar.lena { background: rgba(255,183,150,0.28); color: var(--lena); }

.msg-body { min-width: 0; flex: 1; }

.msg-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.msg-name { font-weight: 600; font-size: 0.9rem; }
.msg-name.kira { color: var(--accent); }
.msg-name.lena { color: var(--lena); }

.msg-time { color: var(--muted); font-size: 0.75rem; }

.msg-bubble {
  background: #22222a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  color: #e4e4ec;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #121214;
}

.chat-input input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* avoid iOS zoom */
  outline: none;
}

.chat-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  color: #1a1222;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: #0e0e10;
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.statusbar .watching {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.statusbar .sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.statusbar .sync-ok {
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-badge {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ========== Mobile / tablet ========== */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 42dvh) minmax(0, 1fr);
  }

  .chat {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .topbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .topbar .vsep { display: none; }

  .online-label { display: none; }

  .btn-outline {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .copy-label-full { display: none; }

  .play-circle {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  .statusbar {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .card { padding: 28px 18px 22px; }

  .main {
    grid-template-rows: minmax(180px, 38dvh) minmax(0, 1fr);
  }

  .topbar-brand .brand-name { font-size: 0.95rem; }

  .pill { padding: 5px 9px; font-size: 0.78rem; }

  .controls { padding: 8px 10px 10px; }

  .chat-header { padding: 10px 12px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .main {
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: 1fr;
  }
  .chat { border-left: 1px solid var(--border); border-top: none; }
}


/* ========== Inline SVG icons ========== */
.icon-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.icon-svg.icon-sm { width: 15px; height: 15px; }
.icon-svg.icon-lg { width: 32px; height: 32px; }
.icon-svg.icon-xl { width: 48px; height: 48px; }
.icon-svg.icon-accent { color: var(--accent); }
.icon-svg.icon-muted { color: var(--muted); }
.icon-svg.icon-play { width: 28px; height: 28px; margin-left: 3px; color: #1a1222; }

.brand-heart .icon-svg { color: var(--accent); width: 32px; height: 32px; }

.create-header .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--accent);
}
.create-header .logo-mark .icon-svg { width: 26px; height: 26px; }
.create-header a.name { text-decoration: none; color: #fff; }
.create-header .who {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 4px;
}

.input .icon .icon-svg,
.input .icon-svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.check .icon-svg { width: 18px; height: 18px; color: #1a1222; }

.btn .icon-svg { width: 16px; height: 16px; }

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.topbar-brand {
  text-decoration: none;
}
.topbar-brand .heart {
  display: inline-flex;
  color: var(--accent);
}
.topbar-brand .heart .icon-svg { width: 18px; height: 18px; }

.pill .icon-svg { color: var(--accent); }

.play-circle {
  font-size: 0;
  padding-left: 0;
}
.play-circle .icon-svg { color: #1a1222; }

.controls-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.controls-row button .icon-svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.send-btn .icon-svg {
  width: 18px;
  height: 18px;
  color: #1a1222;
}

.statusbar .watching .icon-svg { color: var(--accent); }

.avatar .icon-svg { width: 16px; height: 16px; }

/* ========== Home / rooms list ========== */
.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.home-head .btn-accent { white-space: nowrap; }

.rooms-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.rooms-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-card {
  display: block;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.room-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-dim);
  background: #262630;
}

.room-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.room-card-title {
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.room-card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
  min-width: 0;
}
.room-kind {
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}
.room-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.room-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #7a7a8a;
  font-size: 0.75rem;
}

.rooms-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.rooms-empty .icon-svg { margin: 0 auto 12px; }

@media (max-width: 600px) {
  .home-head { flex-direction: column; align-items: stretch; }
  .home-head .btn-accent { width: 100%; }
}
