:root {
  color-scheme: dark;
  --background: #100e17;
  --surface: #1a1724;
  --surface-raised: #211c2c;
  --border: #383044;
  --text: #fcf6f0;
  --muted: #bbb0c5;
  --accent: #ffbd8a;
  --accent-ink: #291607;
  --radius: 22px;
  font: 16px/1.65 "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); min-width: 280px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
a, button, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { line-height: 1.32; }
h1 { font-size: clamp(2.25rem, 6vw, 4.9rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.header { position: sticky; z-index: 5; top: 0; background: #100e17ed; border-bottom: 1px solid #30283a; backdrop-filter: blur(16px); }
.header-inner, .shell { width: min(100% - 3rem, 1200px); margin-inline: auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1.3rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 800; font-size: 1.45rem; line-height: 1.1; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .71rem; margin-top: .2rem; white-space: nowrap; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 14px; }
.brand-mark .icon { width: 1.55rem; height: 1.55rem; }
.desktop-nav, .account { display: flex; align-items: center; gap: .9rem; }
.desktop-nav a { color: var(--muted); font-size: .88rem; padding: .55rem .5rem; white-space: nowrap; }
.desktop-nav a.active, .desktop-nav a:hover { color: var(--accent); }
.account { gap: .35rem; }
.account form { margin: 0; }
.admin-link { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; font-size: .9rem; color: var(--accent); padding: .65rem .45rem; }
.mobile-nav { display: none; }
.shell { padding-block: 1.65rem 4rem; }
.button, button:not(.media-card) {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem .9rem; border-radius: 12px; background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border); font-weight: 650; cursor: pointer;
  transition: background-color .16s, border-color .16s, transform .16s;
}
.button:hover, button:not(.media-card):hover { background: #30263b; border-color: #74607d; }
.button.primary, button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:hover, button.primary:hover { background: #ffd4b5; }
button.quiet { background: transparent; border-color: transparent; }
button.danger { color: #ffb0b6; }
button:disabled { opacity: .58; cursor: wait; }
.hero { isolation: isolate; position: relative; overflow: hidden; min-height: 400px; display: flex; align-items: center; background: #221828; border: 1px solid #423349; border-radius: 28px; padding: clamp(1.7rem, 6vw, 4.7rem); margin-bottom: 2.7rem; }
.hero-copy { position: relative; width: min(100%, 34rem); }
.eyebrow { display: flex; align-items: center; gap: .5rem; color: var(--accent); font-weight: 700; font-size: .84rem; margin-bottom: .55rem; }
.eyebrow span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 span, .login-panel h1 span { color: var(--accent); }
.hero-copy > p:not(.eyebrow), .page-intro > p:not(.eyebrow) { max-width: 35rem; color: #e0d3e2; margin: .9rem 0 1.2rem; font-size: 1.03rem; }
.hero-art { z-index: -1; position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(270deg, #211727 16%, #221726d9 40%, #21182700 79%),
  radial-gradient(ellipse at 14% 60%, #985d72 0%, #4b2a56 40%, #241a2c 72%); }
.hero-art div { position: absolute; border: 1px solid #ffc7966b; border-radius: 2rem; width: 36%; height: 67%; left: 9%; top: 18%; transform: rotate(-17deg); background: linear-gradient(145deg, #ffb87935, #e38aa008 60%); box-shadow: 0 2rem 5rem #140f1b55; }
.hero-art div:nth-child(2) { transform: rotate(-8deg) translate(12%, -10%); background: #b078ae28; }
.hero-art div:nth-child(3) { transform: rotate(5deg) translate(29%, -13%); background: #fdaa8640; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.section-head .eyebrow { margin-bottom: .2rem; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.category-tile { --hue: #ffb48f; --wash: #633747; position: relative; overflow: hidden; display: grid; align-content: space-between; gap: .85rem; min-height: 198px; padding: 1.15rem; border: 1px solid #514157; border-radius: var(--radius); background: linear-gradient(155deg, var(--wash), var(--surface) 78%); transition: transform .22s, border-color .22s; }
.category-tile:hover, .media-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.category-tile.series, .page-intro.series { --hue: #d8b5ff; --wash: #4e3b6c; }
.category-tile.photos, .page-intro.photos { --hue: #a7e3d8; --wash: #26494b; }
.category-tile.videos, .page-intro.videos { --hue: #a8ccff; --wash: #303f66; }
.tile-number { position: absolute; inset-inline-end: 1rem; top: .85rem; color: var(--hue); font-weight: 700; font-size: .79rem; opacity: .75; }
.tile-icon { color: var(--hue); }
.tile-icon .icon { width: 2rem; height: 2rem; }
.category-tile p { color: #e0d4df; font-size: .87rem; margin-top: .32rem; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; color: var(--hue); font-size: .82rem; }
.page-intro { --wash: #432b44; margin-bottom: 1.6rem; padding: clamp(1.25rem, 4.4vw, 3rem); border-radius: var(--radius); border: 1px solid #4b3c53; background: linear-gradient(135deg, var(--wash), #211928 80%); }
.page-intro h1, .watch h1 { font-size: clamp(1.9rem, 5vw, 3.5rem); overflow-wrap: anywhere; }
.breadcrumb { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: .3rem; color: var(--accent); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-bottom: 1.55rem; }
.search { flex: 1 1 12rem; display: flex; align-items: center; gap: .55rem; padding-inline: .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; padding-inline: 0; background: transparent; }
input, select { background: #14111c; border: 1px solid #4c4058; border-radius: 10px; color: var(--text); min-height: 44px; padding: .55rem .65rem; width: 100%; min-width: 0; }
input::placeholder { color: #ad9eb7; }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .9rem; }
.media-card { display: grid; text-align: start; min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: 0; overflow: hidden; border-radius: 16px; cursor: pointer; transition: transform .22s, border-color .22s; }
.media-art { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; background: linear-gradient(140deg,#413352,#20182c); color: var(--muted); }
.photo-grid .media-art { aspect-ratio: 4 / 3; }
.media-art img { display: block; width: 100%; height: 100%; position: absolute; object-fit: cover; }
.media-art > .icon { width: 2.1rem; height: 2.1rem; }
.media-label { display: grid; gap: .15rem; padding: .6rem .75rem; min-height: 45px; overflow-wrap: anywhere; }
.media-label b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.media-label small { color: var(--muted); }
.play-badge { position: absolute; bottom: .5rem; inset-inline-start: .5rem; background: #100e17e6; border: 1px solid #ffffff30; border-radius: 100%; width: 2.15rem; height: 2.15rem; display: grid; place-items: center; }
.offline-badge { position: absolute; top: .35rem; inset-inline-end: .35rem; border-radius: .45rem; background: #100e17ed; color: #fff; padding: .13rem .4rem; font-size: .7rem; }
.empty { border: 1px dashed #51445c; border-radius: var(--radius); padding: clamp(1.5rem,5vw,3rem); text-align: center; color: var(--muted); }
.empty h1, .empty h3 { color: var(--text); margin-bottom: .5rem; }
.empty h1 { font-size: 1.8rem; }
.empty .icon { width: 2rem; height: 2rem; margin-bottom: .5rem; }
.empty .button { margin-top: 1rem; }
.panel, .login-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem,3vw,1.65rem); min-width: 0; }
.login-panel { max-width: 33rem; margin: min(9vh, 5rem) auto 0; padding: clamp(1.35rem,5vw,2.5rem); background: linear-gradient(145deg,#302137,var(--surface) 68%); }
.login-panel h1 { font-size: clamp(1.9rem,6vw,3.3rem); }
.login-panel > p:not(.eyebrow) { margin: .7rem 0 1.25rem; }
.dev-login { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.stack { display: grid; align-content: start; gap: .8rem; }
.stack label, .inline-form label { display: grid; gap: .32rem; font-size: .92rem; color: #e2d7e7; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1rem; align-items: start; }
.panel > h2 { margin-bottom: .8rem; }
.panel.stack > h2 { margin-bottom: 0; }
.source, .user-card { border-top: 1px solid var(--border); padding-top: .8rem; display: grid; gap: .45rem; min-width: 0; }
.source b { overflow-wrap: anywhere; text-align: left; font-size: .9rem; }
.source-meta, .root-options, .inline-form { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.source form { justify-self: start; }
.root-options button { max-width: 100%; overflow-wrap: anywhere; }
.inline-form { align-items: end; }
.inline-form label { flex: 1 1 6.6rem; }
.user-card .section-head { margin: 0; }
summary { cursor: pointer; padding: .4rem 0; }
.user-card details form { padding-block: .35rem; }
.pill { display: inline-block; padding: .16rem .65rem; border: 1px solid #5c5367; border-radius: 100px; font-size: .78rem; color: #e2d6ea; }
.notice { padding: .8rem 1rem; background: #203e35; color: #dcf7e9; border: 1px solid #3f7460; border-radius: 12px; margin-bottom: .8rem; }
.notice.error { background: #49282e; color: #ffd4d7; border-color: #794b56; }
#directory-path { overflow-wrap: anywhere; margin-block: .25rem .65rem; font-size: .85rem; }
#directory-list { padding: 0; list-style: none; display: grid; gap: .25rem; max-height: 19rem; overflow: auto; }
#directory-list button { justify-content: start; width: 100%; text-align: start; overflow-wrap: anywhere; }
.lightbox { color: var(--text); border: 1px solid #675873; border-radius: var(--radius); background: #100e17; width: min(96vw, 1000px); max-height: 92dvh; padding: .65rem; overflow: auto; }
.lightbox[open] { animation: reveal .22s ease both; }
.lightbox::backdrop { background: #08070eea; backdrop-filter: blur(8px); }
.light-head, .light-foot { display: flex; justify-content: space-between; align-items: center; gap: .55rem; padding: .25rem; }
.light-head p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.light-foot { justify-content: center; }
.light-stage { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: .3rem; padding: .45rem 0; }
.light-stage img { width: 100%; height: min(63dvh, 680px); object-fit: contain; user-select: none; touch-action: pan-y; }
.light-stage img.transitioning { animation: reveal .22s ease both; }
.photo-map { display: block; width: 100%; background: #17273f; border-radius: 13px; }
.photo-map path { fill: #57746e; fill-rule: evenodd; }
.photo-map circle { fill: #ffd49b; }
.photo-map text { fill: #241605; font-size: 2.35px; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.photo-map a:hover circle, .photo-map a:focus circle { fill: #fff; }
.map-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-block: .8rem; }
.watch h1 { margin-bottom: .8rem; }
.screen { position: relative; overflow: hidden; border-radius: var(--radius); background: #050507; border: 1px solid var(--border); }
.screen video { width: 100%; max-height: 72vh; min-height: 12rem; aspect-ratio: 16/9; display: block; object-fit: contain; background: #060508; }
.screen-overlay { position: absolute; inset: 0; background: #100d1ab8; display: grid; place-content: center; justify-items: center; gap: .5rem; text-align: center; padding: 1rem; }
.player-message { color: #f0deef; font-size: .92rem; }
.player-tools { display: flex; align-items: end; flex-wrap: wrap; gap: .55rem; padding-block: .75rem; }
.player-tools label { display: flex; align-items: center; gap: .45rem; }
.reveal { animation: reveal .38s cubic-bezier(.22,.7,.25,1) both; }
@keyframes reveal { from { opacity: .15; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .header-inner, .shell { width: min(100% - 1.75rem,1200px); }
  .shell { padding-bottom: calc(6.3rem + env(safe-area-inset-bottom)); }
  .mobile-nav { position: fixed; z-index: 5; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); left: 0; right: 0; bottom: 0; padding: .22rem .28rem calc(.22rem + env(safe-area-inset-bottom)); background: #17131ff5; border-top: 1px solid var(--border); backdrop-filter: blur(18px); }
  .mobile-nav a { display: grid; justify-items: center; align-content: center; gap: .16rem; min-height: 54px; text-align: center; line-height: 1.22; border-radius: 10px; color: var(--muted); font-size: .72rem; padding: .16rem; }
  .mobile-nav a.active { color: var(--accent); background: #3a2a37; }
  .category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
  .media-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
  .admin-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 520px) {
  .header-inner { min-height: 61px; gap: .4rem; }
  .hero { min-height: 340px; margin-bottom: 1.6rem; padding: 1.2rem; }
  .hero-art { opacity: .78; }
  .hero-art div { width: 53%; height: 54%; top: 23%; left: 3%; }
  .category-tile { min-height: 173px; padding: .8rem; }
  .category-tile p { font-size: .8rem; }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .media-label { padding: .5rem; font-size: .85rem; }
  .light-stage { grid-template-columns: 38px minmax(0,1fr) 38px; }
  .light-stage button:not(.media-card) { min-height: 44px; padding-inline: .35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.media-art.cover-art { aspect-ratio: 2 / 3; }
.catalog-entry { grid-template-columns: 70px minmax(0, 1fr); gap: .8rem; }
.catalog-entry > img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; }
.series-heading { display: grid; grid-template-columns: clamp(76px, 16vw, 140px) minmax(0, 1fr); align-items: center; gap: 1rem; }
.series-heading > img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; }
.series-heading h1 { overflow-wrap: anywhere; }
