:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --card: #fffefa;
  --card-2: #eee9e2;
  --text: #362a2c;
  --muted: #786b6c;
  --accent: #84334b;
  --accent-2: #63253a;
  --turquoise: #167b78;
  --turquoise-soft: #e1f0eb;
  --burgundy-soft: #f5e8ec;
  --green: #167b66;
  --red: #b33650;
  --border: #e5ddd5;
  --shadow: 0 8px 30px #51332506;
  font-family: var(--font-app);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; transition: background .18s, border-color .18s, box-shadow .18s, transform .18s; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--turquoise); outline-offset: 4px; }
button:active:not(:disabled) { transform: translateY(1px); }
::selection { background: #afd9d1; color: #173e3b; }
.hidden { display: none !important; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; }
h2 { margin-bottom: 8px; }
.muted, .setting p { color: var(--muted); line-height: 2; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 500; margin: 0 0 8px; }
input, select { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px #167b7814; }
input::placeholder { color: var(--muted); }
.primary, .secondary, .ghost { border: 1px solid transparent; border-radius: 12px; font-weight: 500; }
.primary { width: 100%; margin-top: 16px; padding: 14px 20px; background: var(--accent); color: #fffaf5; }
.primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: 0 5px 18px #84334b20; }
.secondary { padding: 12px 18px; background: var(--turquoise-soft); color: #165e5c; }
.secondary:hover:not(:disabled) { background: #cde5dd; }
.ghost { display: inline-flex; gap: 8px; align-items: center; justify-content: center; padding: 10px 14px; background: var(--card); border-color: var(--border); color: var(--text); font-size: 12px; }
.ghost:hover:not(:disabled) { border-color: #cab9b2; background: #f2ece6; }
.error { min-height: 1.5em; color: var(--red); font-size: 12px; line-height: 1.9; }
svg { display: block; width: 21px; height: 21px; flex-shrink: 0; }
.ghost svg { width: 16px; height: 16px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.status.online::before { background: var(--green); box-shadow: 0 0 0 4px #167b6610; }
.player-card { overflow: hidden; border: 1px solid #483639; border-radius: 20px; background: #181316; box-shadow: var(--shadow); color: #fff6ea; }
.video-wrap { position: relative; aspect-ratio: 16/9; display: grid; place-items: center; background: #100d0f; }
video { width: 100%; height: 100%; object-fit: contain; }
.movie-upload { margin-top: 18px; padding: 20px; }
.movie-upload summary { cursor: pointer; font-weight: 700; }
.movie-upload form { display: grid; gap: 10px; max-width: 580px; margin-top: 16px; }
.movie-upload input { min-width: 0; max-width: 100%; }
.movie-upload p, .movie-upload li { font-size: 13px; line-height: 1.9; }
.movie-upload progress { width: 100%; margin-top: 16px; accent-color: #167d78; }
.movie-upload-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.movie-upload-job { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; border-top: 1px solid #e7dddf; padding: 12px 0; font-size: 13px; }
.movie-upload-job small { flex-basis: 100%; }
.movie-upload-help { margin-top: 16px; }
.movie-upload code { display: inline-block; overflow-wrap: anywhere; }
video::cue { color: white; background: #000c; font-family: "Noto Sans Arabic", "Noto Sans", sans-serif; font-size: 1.08rem; }
.center-play { position: absolute; width: 68px; height: 68px; border: 1px solid #fff3; border-radius: 50%; background: #167b78e6; color: #fff; font-size: 25px; padding-right: 5px; backdrop-filter: blur(8px); }
.center-play,#play-toggle { display: grid; place-items: center; padding: 0; }
.center-play svg { width: 30px; height: 30px; }
#play-toggle svg { width: 22px; height: 22px; }
.player-error { position: absolute; inset: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 16px; gap: 12px; background: #181316ee; text-align: center; font-size: 13px; }
.player-error button { border: 1px solid #82c7ba; background: #167b78; color: white; border-radius: 12px; padding: 10px 16px; font: inherit; }
.buffering { position: absolute; inset-inline: 12px; bottom: 12px; width: fit-content; display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 999px; background: #161316db; font-size: 12px; }
.buffering span { width: 17px; height: 17px; border: 2px solid #fff4; border-top-color: #93d5c9; border-radius: 50%; animation: spin .75s linear infinite; }
.sync-notice { position: absolute; inset: 12px 12px auto; margin-inline: auto; width: fit-content; max-width: calc(100% - 24px); padding: 9px 13px; border: 1px solid #a0d7c84d; border-radius: 999px; background: #203431ed; color: #d7eee5; font-size: 12px; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.controls { display: flex; align-items: center; gap: 10px; padding: 16px; background: #271e23; }
.controls button { flex: 0 0 auto; border: 0; color: #f9eee2; background: transparent; }
.round { width: 40px; height: 40px; border-radius: 50%; background: #3b2c33 !important; }
.skip { color: #d6c6c8 !important; font-size: 12px; }
.timeline { flex: 1; min-width: 0; }
#seek { display: block; height: 5px; padding: 0; appearance: none; background: #59454e; accent-color: #82c7ba; cursor: pointer; }
#seek::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #82c7ba; }
.time { display: grid; grid-template-columns: 1fr auto 1fr; direction: ltr; align-items: center; padding-top: 10px; color: #c6b7ba; font-size: 11px; }
.time span:last-child { text-align: right; }
#buffer-ahead { direction: rtl; color: #c6b7ba; font-size: 10px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.setting { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting h2 { font-size: 13px; font-weight: 600; }
.setting p { margin: 0; font-size: 11px; }
.setting select { width: auto; min-width: 145px; max-width: 50%; padding: 10px 12px; font-size: 12px; }
.setting:last-child { grid-column: 1/-1; }
.chat-empty { margin: 0; color: var(--muted); font-size: 13px; text-align: center; padding: 30px 10px; line-height: 2; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 50; inset-inline: 16px; bottom: 25px; width: fit-content; max-width: calc(100% - 32px); margin: auto; padding: 12px 20px; border: 1px solid #fff2; border-radius: 14px; background: #4f2333; color: #fff5e9; box-shadow: 0 8px 30px #35172226; font-size: 12px; line-height: 1.9; }
.update-banner { position: fixed; z-index: 60; inset: max(12px,env(safe-area-inset-top)) 12px auto; width: min(620px,calc(100% - 24px)); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #a9cec1; border-radius: 15px; background: #e1f0eb; color: #174c44; box-shadow: 0 14px 45px #21433626; }
.update-banner span { line-height: 1.8; font-size: 13px; }
.update-banner button { white-space: nowrap; border: 1px solid #167b7866; }
@media (max-width: 700px) {
  .controls { gap: 5px; padding: 10px 7px; }
  .controls .round { width: 34px; height: 34px; }
  .settings-grid { grid-template-columns: 1fr; }
  .setting { padding: 16px; }
  .setting select { min-width: 125px; }
  .setting p { display: none; }
  .center-play { width: 58px; height: 58px; }
  .update-banner { align-items: stretch; flex-direction: column; }
  .update-banner button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.movie-pair-note { margin: 14px 0 0; padding: 12px 16px; border-radius: 12px; background: #f4e9df; color: #654632; font-size: 13px; line-height: 1.8; }
.center-play:disabled, #play-toggle:disabled { opacity: .4; cursor: not-allowed; }

/* Keep cinema selectors full-width below their labels at every screen size. */
#view-cinema .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#view-cinema .setting { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; align-items: start; min-width: 0; gap: 14px; }
#view-cinema .setting select {
  display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 44px;
  appearance: none; -webkit-appearance: none; border-radius: 12px;
  padding: 10px 14px 10px 38px; font-size: 13px; line-height: 1.8; text-align: start;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23786b6c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; background-size: 12px 12px;
}
@media (max-width: 700px) {
  #view-cinema .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
