/* tatarchat.ru — video roulette UI (tt/ru) */
:root {
  --bg: #070a12;
  --bg-2: #0d1424;
  --panel: rgba(19, 26, 43, 0.72);
  --stroke: rgba(255, 255, 255, 0.09);
  --text: #eef2ff;
  --muted: #94a3c4;
  --accent: #5b8cff;
  --accent-2: #9b5bff;
  --ok: #29d68a;
  --warn: #ffb020;
  --err: #ff5470;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(91, 140, 255, 0.20), transparent 60%),
    radial-gradient(900px 560px at 92% 8%, rgba(155, 91, 255, 0.16), transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

.app {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 16px clamp(10px, 2.2vw, 24px) 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 17px;
  margin: 0;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: block;
  flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(10, 86, 58, 0.45);
}

/* ---------- seo block ---------- */
.seo {
  margin: 18px auto 0;
  max-width: 900px;
  padding: 22px clamp(14px, 3vw, 28px);
  background: rgba(19, 26, 43, 0.55);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #c8d2ea;
}

.seo h2 { margin: 0 0 12px; font-size: 18px; color: var(--text); line-height: 1.35; }
.seo h3 { margin: 20px 0 8px; font-size: 15px; color: var(--text); }
.seo p { margin: 0 0 12px; }
.seo ul { margin: 0 0 12px; padding-left: 20px; }
.seo li { margin-bottom: 6px; }
.seo strong { color: var(--text); }

.seo details {
  border-top: 1px solid var(--stroke);
  padding: 9px 0;
}

.seo summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 13.5px;
}

.seo summary::marker { color: var(--accent); }
.seo details p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(91, 140, 255, 0.85);
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stats { display: inline-flex; gap: 8px; flex-wrap: wrap; }

.stat {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--stroke);
  padding: 6px 11px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.lang-switch {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.install-btn {
  appearance: none;
  border: 1px solid rgba(91, 140, 255, 0.45);
  background: rgba(91, 140, 255, 0.14);
  color: #cfe0ff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.12s ease;
}

.install-btn::before { content: '⬇'; font-size: 12px; }
.install-btn:hover { background: rgba(91, 140, 255, 0.26); transform: translateY(-1px); }
.install-btn[hidden] { display: none; }

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.main-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: min(56vh, 620px);
  border-radius: var(--radius);
  overflow: hidden;
  background: #05070d;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05070d;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.remote.visible { opacity: 1; }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 26px;
  background: radial-gradient(600px 320px at 50% 20%, rgba(91, 140, 255, 0.14), transparent 70%);
  transition: opacity 0.3s ease;
}

.placeholder.hidden { opacity: 0; pointer-events: none; }

.ph-icon {
  font-size: 44px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.85;
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

.ph-title { margin: 6px 0 0; font-size: clamp(16px, 2.2vw, 21px); font-weight: 650; }

.ph-sub {
  margin: 0;
  max-width: 520px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- picture in picture ---------- */
.pip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: clamp(104px, 21%, 220px);
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  background: #0a0e18;
  z-index: 3;
}

.local {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

.pip-label {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #dbe4ff;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ---------- status pill ---------- */
.status-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.72);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(12px);
  max-width: calc(100% - 28px);
}

.status-pill .spinner { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.status-pill[data-state="searching"] .spinner { background: var(--warn); animation: blink 1s ease-in-out infinite; }
.status-pill[data-state="connecting"] .spinner { background: var(--accent); animation: blink 0.7s ease-in-out infinite; }
.status-pill[data-state="live"] .spinner { background: var(--ok); box-shadow: 0 0 10px rgba(41, 214, 138, 0.8); }
.status-pill[data-state="error"] .spinner { background: var(--err); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.timer {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  border-left: 1px solid var(--stroke);
  padding-left: 8px;
  margin-left: 2px;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  backdrop-filter: blur(10px);
  min-width: 96px;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.22); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(91, 140, 255, 0.35);
}

.btn-danger {
  background: rgba(255, 84, 112, 0.14);
  border-color: rgba(255, 84, 112, 0.4);
  color: #ffc2cd;
}

.btn-icon { min-width: 52px; padding: 11px 12px; font-size: 17px; line-height: 1; }

.btn-icon.off {
  background: rgba(255, 84, 112, 0.16);
  border-color: rgba(255, 84, 112, 0.45);
  opacity: 1;
}

.btn-sm { min-width: 0; padding: 8px 16px; font-size: 13px; border-radius: 10px; }

.hint {
  margin: 0 auto;
  max-width: 720px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0.8;
}

/* ---------- chat ---------- */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  font-weight: 650;
  font-size: 14px;
}

.chat-state {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 120px;
  scrollbar-width: thin;
}

.chat-msg { display: flex; justify-content: flex-start; }
.chat-msg.mine { justify-content: flex-end; }

.chat-text {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--stroke);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-msg.mine .chat-text {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.9), rgba(155, 91, 255, 0.9));
  border-color: transparent;
  color: #fff;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--stroke);
}

.chat-form input {
  flex: 1 1 auto;
  min-width: 0;
  background: rgba(8, 12, 22, 0.6);
  border: 1px solid var(--stroke);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 11px;
}

.chat-form input:focus { outline: none; border-color: rgba(91, 140, 255, 0.65); }
.chat-form input:disabled { opacity: 0.45; }

.chat-send {
  appearance: none;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  width: 42px;
  border-radius: 11px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.report-btn {
  appearance: none;
  border: 1px solid rgba(255, 84, 112, 0.35);
  background: rgba(255, 84, 112, 0.12);
  color: #ffb3c1;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.report-btn:hover:not(:disabled) { background: rgba(255, 84, 112, 0.24); }
.report-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- adult check + report modal ---------- */
.adult-check {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  cursor: pointer;
  user-select: none;
}

.adult-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

.report-reasons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 12px;
}

.report-reason {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 10px 8px;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.report-reason:hover { background: rgba(255, 255, 255, 0.09); }

.report-reason.active {
  background: rgba(255, 84, 112, 0.18);
  border-color: rgba(255, 84, 112, 0.6);
  color: #ffd7de;
}

.report-comment {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  background: rgba(8, 12, 22, 0.6);
  border: 1px solid var(--stroke);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 11px;
}

.report-comment:focus { outline: none; border-color: rgba(91, 140, 255, 0.6); }

.report-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---------- legal footer ---------- */
.legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  padding-top: 4px;
}

.legal a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted rgba(148, 163, 196, 0.4);
}

.legal a:hover { color: var(--text); }
.legal .sep { opacity: 0.5; }

.legal .age {
  border: 1px solid rgba(255, 176, 32, 0.55);
  color: var(--warn);
  border-radius: 6px;
  padding: 0 6px;
  font-weight: 700;
  font-size: 10.5px;
}

/* ---------- captcha modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 7, 14, 0.82);
  backdrop-filter: blur(8px);
}

.modal.open { display: flex; }

.modal-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(23, 31, 51, 0.98), rgba(13, 19, 33, 0.98));
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-title { margin: 0 0 6px; font-size: 18px; }
.modal-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.captcha-expr {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  padding: 14px 0 18px;
  background: linear-gradient(135deg, #7fa5ff, #c39bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.captcha-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.captcha-opt {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.captcha-opt:hover:not(:disabled) {
  background: rgba(91, 140, 255, 0.18);
  border-color: rgba(91, 140, 255, 0.5);
  transform: translateY(-1px);
}

.captcha-opt:disabled { opacity: 0.45; cursor: default; }

.captcha-msg {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--warn);
}

.captcha-retry { margin-top: 12px; }

/* ---------- cookie bar ---------- */
.cookie-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 55;
  width: min(680px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(13, 19, 33, 0.96);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.cookie-bar[hidden] { display: none; }

.cookie-text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.cookie-actions { display: inline-flex; align-items: center; gap: 12px; }

.cookie-link { color: var(--accent); font-size: 12.5px; text-decoration: none; }
.cookie-link:hover { text-decoration: underline; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: rgba(12, 17, 29, 0.95);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 12px 18px;
  border-radius: 12px;
  max-width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 70;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { border-color: rgba(255, 84, 112, 0.5); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .chat { min-height: 260px; max-height: 44vh; }
  .stage { min-height: 48vh; }
}

@media (max-width: 640px) {
  .app { padding: 10px 8px 14px; gap: 9px; }
  .stage { min-height: 42vh; border-radius: 14px; }
  .controls { gap: 7px; }
  .btn { flex: 1 1 auto; min-width: 0; padding: 12px 12px; font-size: 14px; }
  .btn-icon { flex: 0 0 auto; min-width: 46px; }
  .hint { font-size: 11px; }
  .pip { right: 10px; bottom: 10px; width: 33%; }
  .captcha-options { grid-template-columns: 1fr; }
  .cookie-bar { bottom: 10px; padding: 11px 13px; }
  .legal { font-size: 10.5px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
