/* IraShorts - palette and typography aligned with irablogging.com */
:root {
  --bg: #0b1120;
  --bg-soft: #111827;          /* irablogging dark surface */
  --bg-card: #172033;
  --line: #263149;
  --text: #f3f4f6;
  --muted: #98a2b8;
  --accent: #4f46e5;           /* irablogging indigo */
  --accent-strong: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.16);
  --gold: #e3a72f;             /* logo gold */
  --gold-soft: rgba(227, 167, 47, 0.15);
  --ok: #46d369;
  --danger: #e50914;
  --radius: 14px;
  --pill: 9999px;
  --max: 1120px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 14px;
  height: 68px;
}
.logo { display: flex; align-items: center; gap: 10px; flex: none; }
.logo img { height: 44px; width: auto; display: block; }
.logo .suffix {
  font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: .4px; padding-left: 10px; border-left: 1px solid var(--line);
}

.search-form { margin-left: auto; display: flex; flex: 1; max-width: 340px; }
.search-form input {
  width: 100%; padding: 9px 15px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--pill) 0 0 var(--pill); border-right: none;
  color: var(--text); font-size: 14px; outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
  padding: 0 16px; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; font-weight: 600; font-size: 14px;
  border-radius: 0 var(--pill) var(--pill) 0; cursor: pointer;
}

/* ----------------------------------------------------------------- layout */

main { padding: 22px 0 60px; }
.section-title {
  font-size: 15px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted); margin: 30px 0 14px; font-weight: 700;
}
.section-title:first-child { margin-top: 6px; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 620px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, 1fr); } }

/* ------------------------------------------------------------ story cards */

.card { display: block; }
.poster {
  position: relative; aspect-ratio: 9 / 16; overflow: hidden;
  border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line);
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center; padding: 12px; text-align: center;
  background: linear-gradient(160deg, #24304d, #131b2c);
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.badge {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
  padding: 3px 8px; border-radius: var(--pill); font-size: 11px; font-weight: 600;
}
.badge.featured { left: auto; right: 8px; top: 8px; bottom: auto; background: var(--gold); color: #18140a; }
.card h3 { font-size: 14px; margin: 9px 0 3px; line-height: 1.3; font-weight: 650; }
.card p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------- story page */

.story-cols { display: grid; gap: 18px; }
@media (min-width: 700px) { .story-cols { grid-template-columns: 210px 1fr; gap: 28px; } }
.story-cols h1 { font-size: 26px; margin: 0 0 12px; line-height: 1.2; letter-spacing: -0.4px; }
@media (min-width: 700px) { .story-cols h1 { font-size: 32px; } }
.story-cols .desc { color: var(--muted); line-height: 1.6; font-size: 15px; margin: 0 0 18px; max-width: 62ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: var(--pill); font-size: 12px; color: var(--muted);
}
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 11px 22px; border-radius: var(--pill); font-weight: 600; font-size: 14px;
  border: none; cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c40810; }
.btn.small { padding: 7px 13px; font-size: 12.5px; }

.episode-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.episode-row {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; transition: border-color .15s;
}
.episode-row:hover { border-color: var(--accent); }
.episode-row.active { border-color: var(--accent); background: var(--accent-soft); }
.ep-thumb {
  width: 62px; height: 92px; flex: none; border-radius: 8px; overflow: hidden;
  background: #1b2438; display: grid; place-items: center;
  color: var(--muted); font-size: 17px; font-weight: 800;
}
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-info { min-width: 0; flex: 1; }
.ep-info .num { font-size: 11.5px; color: var(--gold); font-weight: 700; letter-spacing: .6px; }
.ep-info h4 { margin: 3px 0 5px; font-size: 14.5px; font-weight: 600; }
.ep-info .sub { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- player */

.player-page { max-width: 460px; margin: 0 auto; padding: 0 16px; }
.player-shell {
  position: relative; width: 100%; aspect-ratio: 9 / 16;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
.player-shell video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player-shell.no-video { display: grid; place-items: center; color: var(--muted); font-size: 14px; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
  opacity: 1; transition: opacity .25s;
}
.controls.hidden { opacity: 0; pointer-events: none; }

.progress { height: 16px; display: flex; align-items: center; cursor: pointer; }
.progress-track { position: relative; height: 4px; width: 100%; background: rgba(255,255,255,.28); border-radius: 3px; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--gold); border-radius: 3px; }
.progress-knob {
  position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin-left: -6px;
  transform: translateY(-50%); border-radius: 50%; background: #fff;
}

.control-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.control-row .time { font-size: 11.5px; color: #dfe3ee; margin-left: 4px; font-variant-numeric: tabular-nums; }
.control-row .spacer { flex: 1; }
.ctl {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: none; color: #fff; cursor: pointer; border-radius: 8px; padding: 0;
}
.ctl:hover { background: rgba(255,255,255,.14); }
.ctl:disabled { opacity: .3; cursor: default; }
.ctl svg { width: 19px; height: 19px; fill: currentColor; }
.volume-wrap { display: flex; align-items: center; }
.volume-wrap input[type="range"] {
  width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: var(--accent); height: 4px;
}
.volume-wrap:hover input[type="range"], .volume-wrap:focus-within input[type="range"] { width: 66px; opacity: 1; margin: 0 6px; }

.big-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.35); border: none; color: #fff; cursor: pointer;
}
.big-play svg { width: 62px; height: 62px; fill: var(--gold); opacity: .95; filter: drop-shadow(0 2px 12px rgba(0,0,0,.6)); }
.big-play.hidden { display: none; }

.up-next {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center;
  background: rgba(0,0,0,.82); padding: 20px;
}
.up-next.show { display: grid; }
.up-next .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }
.up-next h4 { margin: 8px 0 16px; font-size: 17px; }

.player-meta { padding: 14px 0 6px; }
.player-meta .story-link { font-size: 12.5px; color: var(--muted); }
.player-meta h1 { font-size: 18px; margin: 5px 0 8px; }
.player-nav { display: flex; gap: 10px; margin: 12px 0 22px; }
.player-nav a, .player-nav span { flex: 1; text-align: center; }
.player-nav span.btn { opacity: .35; }

/* ------------------------------------------------------------------ admin */

.admin-header { background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.admin-header .wrap { display: flex; align-items: center; gap: 14px; height: 64px; flex-wrap: wrap; }
.admin-header .logo img { height: 34px; }
.admin-nav { display: flex; gap: 16px; font-size: 14px; margin-left: auto; align-items: center; }
.admin-nav a { color: var(--muted); font-weight: 600; }
.admin-nav a.on, .admin-nav a:hover { color: var(--text); }
.admin-nav form { display: inline; }
.admin-nav button { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; font-weight: 600; }

.page-head { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .spacer { flex: 1; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.data th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; }
table.data tr:hover td { background: var(--bg-soft); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.pill { padding: 3px 9px; border-radius: var(--pill); font-size: 11px; font-weight: 700; }
.pill.live { background: rgba(70,211,105,.16); color: var(--ok); }
.pill.draft { background: rgba(154,146,173,.16); color: var(--muted); }

.form-card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; max-width: 620px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="password"], .field textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 9px; color: var(--text);
  font: inherit; font-size: 14px; outline: none;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field input[type="file"] { font-size: 13px; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.preview-thumb { width: 70px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }

.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 8px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
}
.stat .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.stat .v { font-size: 24px; font-weight: 750; margin-top: 5px; letter-spacing: -0.5px; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; }

.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.funnel-row .lab { width: 92px; flex: none; color: var(--muted); }
.funnel-row .bar { flex: 1; height: 22px; background: var(--bg-card); border-radius: 6px; overflow: hidden; }
.funnel-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.funnel-row .val { width: 96px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; color: var(--muted); padding: 46px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.error-msg { background: rgba(229,9,20,.14); color: #ff8a92; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; margin-bottom: 14px; }
.footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ================================================================ nav links */

.site-header .wrap { gap: 12px; }
.main-nav { display: none; gap: 22px; margin-left: 14px; font-size: 14px; font-weight: 500; }
.main-nav a { color: var(--muted); transition: color .15s; white-space: nowrap; }
.main-nav a:hover, .main-nav a.on { color: var(--text); }
@media (min-width: 860px) { .main-nav { display: flex; } }

/* ================================================================ spotlight */

.spotlight {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.spot-slide { position: relative; display: none; }
@media (min-width: 780px) { .spot-slide { min-height: 380px; } }
.spot-slide.on { display: block; }
.spot-backdrop {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(26px) saturate(1.25); transform: scale(1.2); opacity: .5;
}
.spot-backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 8%, rgba(11,17,32,.72) 55%, rgba(11,17,32,.35));
}
.spot-inner {
  position: relative; display: grid; gap: 22px; align-items: center;
  grid-template-columns: 1fr; padding: 22px 0 34px;
}
@media (min-width: 780px) { .spot-inner { grid-template-columns: 1fr 208px; padding: 40px 0 44px; } }
.spot-eyebrow {
  font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 10px;
}
.spot-title { font-size: 30px; line-height: 1.12; margin: 0 0 12px; letter-spacing: -0.6px; }
@media (min-width: 780px) { .spot-title { font-size: 40px; } }
.spot-desc {
  color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 18px; max-width: 54ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.spot-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spot-poster { display: none; }
@media (min-width: 780px) {
  .spot-poster {
    display: block; aspect-ratio: 9/16; border-radius: var(--radius); overflow: hidden;
    border: 1px solid rgba(255,255,255,.14); box-shadow: 0 22px 50px rgba(0,0,0,.55);
    transform: rotate(2deg);
  }
  .spot-poster img { width: 100%; height: 100%; object-fit: cover; }
}
.spot-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; gap: 7px; justify-content: center; }
.spot-dots button {
  width: 22px; height: 4px; border-radius: 3px; border: none; padding: 0; cursor: pointer;
  background: rgba(255,255,255,.28);
}
.spot-dots button.on { background: var(--gold); width: 34px; }

/* =============================================================== genre chips */

.chip-row { display: flex; gap: 9px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-link {
  flex: none; padding: 8px 15px; border-radius: var(--pill); font-size: 13px; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
  transition: all .15s;
}
.chip-link:hover { color: var(--text); border-color: var(--accent); }
.chip-link.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-static {
  display: inline-block; padding: 5px 11px; border-radius: var(--pill); font-size: 12px;
  background: var(--gold-soft); color: var(--gold); font-weight: 600;
}

/* ===================================================================== rails */

.rail-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.rail-head h2 { font-size: 19px; margin: 0; letter-spacing: -0.3px; }
.rail-head a.more { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.rail-head a.more:hover { color: var(--gold); }

.rail-wrap { position: relative; }
.rail {
  display: flex; gap: 14px; overflow-x: auto; scroll-behavior: smooth;
  scroll-snap-type: x proximity; padding-bottom: 6px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: 0 0 148px; scroll-snap-align: start; }
@media (min-width: 620px) { .rail > * { flex-basis: 168px; } }
.rail-btn {
  position: absolute; top: 50%; transform: translateY(-60%);
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(11,17,32,.9); color: var(--text); cursor: pointer;
  display: none; place-items: center; z-index: 5; font-size: 17px; line-height: 1;
}
.rail-btn:hover { background: var(--accent); border-color: var(--accent); }
.rail-btn.prev { left: -18px; }
.rail-btn.next { right: -18px; }
@media (min-width: 900px) { .rail-wrap:hover .rail-btn { display: grid; } }

/* card tweaks inside rails */
.card .poster { transition: transform .18s, border-color .18s; }
.card:hover .poster { transform: translateY(-3px); border-color: var(--accent); }
.card .genre-line {
  font-size: 11.5px; color: var(--gold); margin-top: 3px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.poster .play-dot {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(11,17,32,.4); opacity: 0; transition: opacity .18s;
}
.poster .play-dot svg { width: 40px; height: 40px; fill: #fff; filter: drop-shadow(0 2px 10px rgba(0,0,0,.6)); }
.card:hover .play-dot { opacity: 1; }

/* ranked rail - the numeral sits inside the poster, never over the caption */
.poster .rank {
  position: absolute; right: 10px; top: 2px; z-index: 3;
  font-size: 54px; font-weight: 800; line-height: .8; letter-spacing: -3px;
  color: rgba(11,17,32,.35); -webkit-text-stroke: 2px rgba(255,255,255,.92);
  paint-order: stroke fill; pointer-events: none;
}
.card:hover .poster .rank { -webkit-text-stroke-color: var(--gold); }
.rail.ranked .badge.featured { top: auto; bottom: 8px; right: 8px; }

/* ============================================================== genre tiles */

.genre-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .genre-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .genre-grid { grid-template-columns: repeat(4, 1fr); } }
.genre-tile {
  position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-card);
  padding: 18px 16px; min-height: 96px; display: flex; flex-direction: column; justify-content: flex-end;
  transition: border-color .15s, transform .15s;
}
.genre-tile::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent 62%);
}
.genre-tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.genre-tile h3 { position: relative; margin: 0 0 4px; font-size: 15px; }
.genre-tile span { position: relative; font-size: 12px; color: var(--muted); }

/* ============================================================== story hero */

.story-hero-wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.story-hero-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(30px) saturate(1.2); transform: scale(1.25); opacity: .42;
}
.story-hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,17,32,.5), var(--bg));
}
.story-top { position: relative; padding: 26px 0 30px; }

/* ============================================================ episode grid */

.ep-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .ep-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 980px) { .ep-grid { grid-template-columns: repeat(6, 1fr); } }
.ep-card .shot {
  position: relative; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden;
  background: #1b2438; border: 1px solid var(--line); display: grid; place-items: center;
  color: var(--muted); font-size: 20px; font-weight: 800; transition: border-color .15s;
}
.ep-card:hover .shot { border-color: var(--accent); }
.ep-card .shot img { width: 100%; height: 100%; object-fit: cover; }
.ep-card .shot .n {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.72);
  padding: 2px 7px; border-radius: var(--pill); font-size: 11px; font-weight: 700; color: #fff;
}
.ep-card .shot .len {
  position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.72);
  padding: 2px 7px; border-radius: var(--pill); font-size: 10.5px; color: #fff; font-weight: 600;
}
.ep-card .cap { font-size: 12.5px; margin-top: 6px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-card .cap-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
