/* HamFilm Mobile-first minimal UI — v5 */
:root {
  color-scheme: dark;
  --bg: #111114;
  --surface: #19191e;
  --surface-soft: #202026;
  --line: rgba(255,255,255,.09);
  --text: #f4f1f3;
  --muted: #a9a3aa;
  --dim: #77727a;
  --pink: #e7aec7;
  --pink-ink: #2b1e25;
  --green: #8fdbb4;
  --page-width: 1000px;
  font-family: Tahoma, "Noto Sans Arabic", "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; min-height: 100%; margin: 0; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, "Noto Sans Arabic", "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header, .page-wrap { width: min(calc(100% - 32px), var(--page-width)); margin-inline: auto; }
.site-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 9px; }
.brand-mark { width: 33px; height: 33px; flex: 0 0 33px; display: grid; place-items: center; border-radius: 10px; background: var(--pink); color: var(--pink-ink); font-size: 17px; }
.brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.brand-text strong { font-size: 14px; font-weight: 700; }
.brand-text small { color: var(--muted); font-size: 9px; }
.header-actions { min-width: 0; display: flex; align-items: center; gap: 11px; }
.connection-status { min-width: 0; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.connection-status i, .online-dot, .sync-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; display: inline-block; background: #77727a; }
.connection-status.connected i, .online-dot { background: var(--green); }

.button { min-height: 39px; min-width: 0; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; transition: background .15s, border-color .15s; }
.button:active { opacity: .84; }
.button-primary { background: var(--pink); color: var(--pink-ink); }
.button-secondary, .button-dark { background: var(--surface-soft); border-color: var(--line); color: var(--text); }
.button:disabled { opacity: .4; cursor: not-allowed; }

.page-wrap { padding-top: 14px; }
.room-bar {
  min-width: 0;
  margin: 0 0 22px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.35fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.room-info { min-width: 0; display: flex; align-items: center; gap: 9px; }
.room-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 9px; background: #29242b; color: var(--pink); font-size: 19px; }
.room-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.room-copy small { color: var(--muted); font-size: 9px; }
.room-copy strong { min-width: 0; color: var(--text); font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.room-actions { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px; }
.join-field { min-width: 0; width: 100%; height: 39px; display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #111115; }
.join-field input { width: 0; min-width: 0; flex: 1 1 auto; padding: 0 10px; border: 0; outline: 0; background: transparent; color: var(--text); text-align: center; letter-spacing: .6px; font-size: 16px; }
.join-field input::placeholder { color: var(--dim); font-size: 11px; letter-spacing: 0; }
.join-field .button { height: 100%; min-height: 0; padding-inline: 12px; border: 0; border-radius: 0; }
.room-actions > .button { height: 39px; }

.watch-section { min-width: 0; padding-bottom: 20px; }
.watch-heading { min-width: 0; margin: 0 1px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.watch-heading > div:first-child { min-width: 0; }
.eyebrow { color: #b8aab2; font-size: 8px; letter-spacing: 1.4px; direction: ltr; display: inline-block; }
.watch-heading h1 { margin: 3px 0 0; font-size: 19px; line-height: 1.4; font-weight: 700; }
.watch-heading h1 span { color: var(--pink); }
.viewer-pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 30px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.viewer-pill strong { color: var(--text); font-size: 11px; }

.cinema-panel { min-width: 0; }
.video-frame {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 12px;
  background: #050507;
}
.video-backdrop { position: absolute; inset: 0; background: #09090c; }
.video-frame video { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; max-width: 100%; object-fit: contain; background: #000; }
.video-topline { position: absolute; z-index: 3; top: 9px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.video-brand, .video-room-tag { color: rgba(255,255,255,.72); font-size: 8px; letter-spacing: 1px; text-shadow: 0 1px 5px #000; }
.video-brand b { color: var(--pink); }
.empty-screen { position: absolute; z-index: 2; inset: 0; padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-play { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid rgba(231,174,199,.5); border-radius: 50%; color: var(--pink); background: rgba(231,174,199,.07); font-size: 13px; }
.empty-screen h2 { margin: 9px 0 4px; font-size: clamp(12px,2vw,16px); }
.empty-screen p { max-width: 92%; margin: 0 0 10px; color: #aaa4ab; font-size: clamp(9px,1.3vw,11px); line-height: 1.8; }
.empty-screen .button { min-height: 34px; font-size: 10px; }

/* No chat panel: each message floats directly over the movie. */
.live-chat-overlay { position: absolute; z-index: 4; inset: 0; display: block; overflow: hidden; padding: 0; pointer-events: none; }
.live-chat-top { display: none !important; }
.chat-messages {
  position: absolute;
  right: 12px;
  bottom: 42px;
  width: min(390px, 86%);
  max-height: 69%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 7px;
  overflow: hidden;
  padding: 0;
  direction: rtl;
  pointer-events: none;
}
.chat-empty { display: none !important; }
.message {
  max-width: min(88%, 360px);
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.32));
  animation: bubbleIn .22s ease-out both;
}
.message.mine { align-self: flex-end; align-items: flex-end; }
.message-meta { display: flex; align-items: center; gap: 6px; padding-inline: 7px; color: rgba(255,255,255,.94); font-size: 9px; text-shadow: 0 1px 4px #000; }
.message-meta strong { font-weight: 700; }
.message-time { color: rgba(255,255,255,.7); font-size: 8px; }
.message-bubble {
  max-width: 100%;
  padding: 6px 11px;
  border: 0;
  border-radius: 15px 15px 15px 4px;
  background: rgba(8,8,12,.46);
  color: #fff;
  font-size: clamp(10px,1.6vw,12px);
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 1px 8px rgba(0,0,0,.12);
}
.message.mine .message-bubble { border-radius: 15px 15px 4px 15px; background: rgba(117,65,88,.58); }
.message-fade { opacity: 0; transform: translateY(-7px); transition: opacity .9s ease, transform .9s ease; }

.video-details { min-width: 0; padding: 9px 2px 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.movie-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.movie-meta strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.movie-url-hint { max-width: 100%; color: var(--dim); font-size: 9px; direction: ltr; text-align: right; overflow-wrap: anywhere; }
.sync-state { min-width: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; text-align: left; }
.sync-state.synced .sync-dot { background: var(--green); }

.below-video-tools { min-width: 0; display: flex; align-items: center; gap: 8px; }
.chat-compose { min-width: 0; height: 43px; flex: 1 1 auto; display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.chat-compose:focus-within { border-color: rgba(231,174,199,.5); }
.chat-compose input { width: 0; min-width: 0; height: 100%; flex: 1 1 auto; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.chat-compose input::placeholder { color: var(--dim); font-size: 11px; }
.send-button { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 8px; background: var(--pink); color: var(--pink-ink); font-size: 15px; transform: scaleX(-1); }
.choose-movie { min-height: 43px; }
.watch-hint { margin: 7px 2px 0; color: var(--dim); font-size: 9px; line-height: 1.7; }
.site-footer { min-height: 44px; margin-top: 8px; padding: 8px 2px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }
.site-footer b { color: var(--pink); }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; padding: max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); display: grid; place-items: center; overflow-y: auto; background: rgba(5,5,8,.78); backdrop-filter: blur(7px); }
.modal-card { position: relative; width: min(440px,100%); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px 19px 20px; border: 1px solid var(--line); border-radius: 15px; background: #1b1b21; text-align: center; }
.modal-close { position: absolute; top: 8px; left: 9px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: #25252b; color: #eee; font-size: 20px; }
.modal-mark { margin-bottom: 4px; color: var(--pink); font-size: 25px; }
.modal-card h2 { margin: 7px 0 5px; font-size: 17px; }
.modal-card > p { margin: 0 auto 15px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.modal-card label { display: block; margin: 0 0 6px; color: #ddd5db; text-align: right; font-size: 11px; }
.modal-card input { width: 100%; min-width: 0; height: 44px; margin-bottom: 11px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: #111115; color: #fff; font-size: 16px; }
.modal-card input:focus { border-color: rgba(231,174,199,.6); }
.modal-card input::placeholder { color: var(--dim); font-size: 12px; }
.modal-submit { width: 100%; min-height: 43px; margin-top: 3px; }
.name-card > small { display: block; margin-top: 10px; color: var(--dim); font-size: 9px; }
.movie-form { text-align: right; }
.movie-form input { direction: ltr; text-align: left; }
.suggestion-block { margin-bottom: 13px; text-align: right; }
.suggestion-heading { display: flex; justify-content: space-between; margin-bottom: 7px; color: #ddd5db; font-size: 10px; }
.suggestion-heading span, .url-note { color: var(--dim); font-size: 9px; }
.suggestion-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.suggestion-card { min-width: 0; min-height: 48px; padding: 6px 3px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; color: #fff; }
.suggestion-card strong { font-size: 9px; direction: ltr; }
.poster-rose { background: #49303d; }
.poster-blue { background: #2e3c4e; }
.poster-gold { background: #4b3d2c; }
.poster-violet { background: #40364e; }
.url-note { margin: 0 0 10px; line-height: 1.7; }
.toast { position: fixed; z-index: 70; right: 50%; bottom: max(14px,env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 28px); padding: 9px 13px; border: 1px solid rgba(231,174,199,.2); border-radius: 10px; background: #29232b; color: #f4edf1; text-align: center; font-size: 11px; opacity: 0; transform: translate(50%,10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(50%,0); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .site-header, .page-wrap { width: calc(100% - 24px); }
  .site-header { min-height: 56px; }
  .brand-mark { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; font-size: 15px; }
  .brand-text strong { font-size: 13px; }
  .brand-text small { font-size: 8px; }
  .header-actions { gap: 8px; }
  .connection-status { width: 8px; overflow: hidden; gap: 0; font-size: 0; }
  .connection-status i { width: 7px; height: 7px; }
  .header-actions .button { min-height: 35px; padding-inline: 10px; font-size: 10px; }
  .page-wrap { padding-top: 10px; }
  .room-bar { grid-template-columns: minmax(0,1fr); gap: 9px; margin-bottom: 16px; padding: 10px; border-radius: 11px; }
  .room-info { gap: 8px; }
  .room-icon { width: 30px; height: 30px; flex-basis: 30px; font-size: 17px; }
  .room-copy { flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: 7px; }
  .room-copy small { font-size: 9px; }
  .room-copy strong { font-size: 10px; }
  .room-actions { grid-template-columns: minmax(0,1fr) auto; gap: 6px; }
  .join-field, .room-actions > .button { height: 37px; }
  .join-field input { font-size: 16px; }
  .join-field input::placeholder { font-size: 10px; }
  .join-field .button { padding-inline: 11px; font-size: 10px; }
  .room-actions > .button { min-height: 37px; padding-inline: 10px; font-size: 10px; }
  .watch-heading { margin-bottom: 8px; }
  .watch-heading h1 { font-size: 16px; }
  .eyebrow { font-size: 7px; }
  .viewer-pill { gap: 5px; padding: 5px 7px; font-size: 9px; }
  .viewer-pill strong { font-size: 10px; }
  .video-frame { border-radius: 9px; }
  .video-topline { top: 7px; left: 8px; right: 8px; }
  .video-brand, .video-room-tag { font-size: 7px; }
  .empty-play { width: 37px; height: 37px; font-size: 11px; }
  .empty-screen h2 { margin-top: 7px; font-size: 12px; }
  .empty-screen p { margin-bottom: 7px; font-size: 9px; }
  .empty-screen .button { min-height: 31px; padding-inline: 11px; font-size: 9px; }
  .chat-messages { right: 8px; bottom: 36px; width: 88%; max-height: 68%; gap: 5px; }
  .message { max-width: 86%; }
  .message-meta { gap: 5px; font-size: 8px; }
  .message-time { font-size: 7px; }
  .message-bubble { padding: 5px 9px; border-radius: 13px 13px 13px 4px; font-size: 10px; }
  .message.mine .message-bubble { border-radius: 13px 13px 4px 13px; }
  .video-details { padding: 7px 1px 6px; gap: 6px; }
  .movie-meta strong { font-size: 11px; }
  .movie-url-hint, .sync-state { font-size: 8px; }
  .below-video-tools { gap: 6px; }
  .chat-compose { height: 40px; border-radius: 9px; }
  .chat-compose input { font-size: 16px; }
  .chat-compose input::placeholder { font-size: 10px; }
  .send-button { width: 32px; height: 32px; flex-basis: 32px; }
  .choose-movie { min-height: 40px; padding-inline: 9px; font-size: 10px; }
  .watch-hint { font-size: 8px; }
  .site-footer { min-height: 38px; margin-top: 4px; justify-content: center; font-size: 8px; }
}

@media (max-width: 380px) {
  .site-header, .page-wrap { width: calc(100% - 20px); }
  .room-actions { grid-template-columns: minmax(0,1fr); }
  .room-actions > .button { width: 100%; }
  .video-details { align-items: flex-start; flex-direction: column; }
  .sync-state { white-space: normal; }
  .below-video-tools { display: grid; grid-template-columns: minmax(0,1fr); }
  .choose-movie { width: 100%; }
  .suggestion-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Safety-consent control from Live Safety v8 */
.scan-consent { display:flex; align-items:flex-start; gap:9px; margin:12px 0 14px; padding:10px 12px; border:1px solid rgba(218,164,190,.25); border-radius:12px; background:rgba(218,164,190,.06); color:var(--muted); font-size:12px; line-height:1.8; }
.scan-consent input { flex:0 0 auto; width:17px; height:17px; margin:3px 0 0; accent-color:#d88dbb; }
.scan-consent span { min-width:0; }

/* Small, readable SEO content that does not compete with the cinema UI. */
.seo-section { margin:18px 0 8px; padding:15px 0 4px; border-top:1px solid var(--line); color:var(--muted); }
.seo-section h2 { margin:0 0 8px; color:var(--text); font-size:14px; line-height:1.8; }
.seo-section > p { max-width:78ch; margin:0 0 9px; font-size:11px; line-height:2; }
.seo-feature-list { display:flex; flex-wrap:wrap; gap:6px 16px; margin:8px 0 9px; padding:0 18px 0 0; color:#d8cbd2; font-size:10px; line-height:1.9; }
.seo-section .seo-note { color:var(--dim); font-size:10px; }
.seo-guide-link { display:inline-block; margin:3px 0 8px; color:var(--pink); font-size:11px; text-decoration:underline; text-underline-offset:3px; }
.seo-faq { margin-top:7px; border-top:1px solid var(--line); }
.seo-faq h3 { margin:10px 0 4px; color:var(--text); font-size:12px; }
.seo-faq details { padding:8px 0; border-bottom:1px solid var(--line); }
.seo-faq summary { color:#e9dfe5; cursor:pointer; font-size:11px; line-height:1.8; }
.seo-faq details p { margin:5px 0 0; color:var(--muted); font-size:10px; line-height:1.9; }
.site-footer a { color:var(--pink); text-decoration:underline; text-underline-offset:3px; }

/* Reading page */
.info-page { max-width:820px; padding-bottom:28px; }
.guide-nav { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:54px; border-bottom:1px solid var(--line); }
.guide-nav a { color:var(--pink); font-size:11px; }
.guide-content { padding:20px 0 34px; }
.guide-content h1 { margin:0 0 10px; color:var(--text); font-size:clamp(21px,4vw,30px); line-height:1.6; }
.guide-lead { margin:0 0 20px; color:#d4c7cf; font-size:13px; line-height:2.1; }
.guide-section { margin:17px 0; }
.guide-section h2 { margin:0 0 7px; color:var(--text); font-size:16px; line-height:1.8; }
.guide-section p, .guide-section li { color:var(--muted); font-size:12px; line-height:2.15; }
.guide-section ul, .guide-section ol { padding-right:22px; }
.guide-callout { margin:14px 0; padding:12px 14px; border-right:3px solid var(--pink); border-radius:9px; background:var(--surface); color:#ddd1d8; font-size:11px; line-height:2; }
.guide-steps { display:grid; gap:9px; margin:12px 0; }
.guide-step { padding:11px 13px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.guide-step strong { display:block; margin-bottom:3px; color:var(--text); font-size:12px; }
.guide-step p { margin:0; }
.guide-back { display:inline-flex; align-items:center; margin-top:12px; padding:10px 14px; border-radius:9px; background:var(--pink); color:var(--pink-ink) !important; font-size:11px; font-weight:700; }
@media (max-width:760px) {
  .seo-section { margin-top:12px; padding-top:11px; }
  .seo-section h2 { font-size:13px; }
  .seo-section > p { font-size:10px; }
  .seo-feature-list { gap:4px 12px; font-size:9px; }
  .seo-faq summary { font-size:10px; }
  .guide-content { padding-top:14px; }
  .guide-content h1 { font-size:21px; }
  .guide-lead { font-size:12px; }
  .guide-section h2 { font-size:14px; }
  .guide-section p, .guide-section li { font-size:11px; }
}
