/* Utluk 全局样式 — 绿色主题 / RTL / 维语字体 / 底栏 / 跟随系统亮暗模式 */
@font-face {
  font-family: "UyghurUI";
  src: url("../fonts/alkatipyazmatom.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "UyghurUINazuk";
  src: url("../fonts/alkatipyazmatom.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --c-primary: #25b05e;
  --c-accent: #25b05e;
  --c-search-border: #d4e8d0;
  --c-bg: #f7faf8;
  --c-bg-soft: #f0f9f2;
  --c-text: #111111;
  --c-muted: #888888;
  --c-border: #eeeeee;
  --c-card: #ffffff;
  --radius-poster: 12px;
  --radius-card: 14px;
  --radius-pill: 999px;
  --nav-h: 56px;
  --page-pad: 12px;
  --max-w: 480px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
  --poster-gap-x: 8px;
  --poster-gap-y: 14px;
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light) {
    --c-bg: #121212;
    --c-bg-soft: #1c1c1c;
    --c-text: #f0f0f0;
    --c-muted: #aaaaaa;
    --c-border: #2a2a2a;
    --c-card: #1c1c1c;
    --c-search-border: #2e8b3d;
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
}
html.theme-dark {
  --c-bg: #121212;
  --c-bg-soft: #1c1c1c;
  --c-text: #f0f0f0;
  --c-muted: #aaaaaa;
  --c-border: #2a2a2a;
  --c-card: #1c1c1c;
  --c-search-border: #2e8b3d;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  direction: rtl;
  -webkit-text-size-adjust: 100%;
  background: var(--c-bg);
}
body {
  direction: rtl;
  font-family: "UyghurUI", "UyghurUINazuk", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  min-height: 100vh;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font-family: inherit; border: none; outline: none; background: none; }
ul, ol { list-style: none; }

.page { min-height: 100vh; }
.page-pad { padding: var(--page-pad); }

/* 🟢 搜索框：跟随亮/暗模式 */
.search-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  direction: rtl;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--c-search-border);
  border-radius: 12px;
  background: var(--c-card);
}
.search-bar .ri-search-line {
  color: var(--c-primary);
  font-size: 20px;
  flex-shrink: 0;
}
.search-bar input {
  flex: 1; min-width: 0; height: 100%;
  direction: rtl; text-align: right; font-size: 15px;
  color: var(--c-text); unicode-bidi: plaintext;
  background: transparent; border: none; outline: none;
}
.search-bar input::placeholder {
  color: var(--c-muted); text-align: right; opacity: 1;
}
.search-bar input[type="search"]::-webkit-search-decoration,
.search-bar input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
}
.search-bar-wrap {
  padding: 12px var(--page-pad) 10px;
  background: var(--c-bg);
  transition: background 0.2s ease;
}

/* 🟢 分区标题行 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
  font-weight: bold;
  text-align: right;
  padding: 14px var(--page-pad) 10px;
  color: var(--c-text);
  position: relative;
  width: 100%;
}
.section-title::after {
  content: "";
  position: absolute;
  bottom: 6px; right: var(--page-pad);
  width: 30px; height: 3px;
  background: var(--c-primary);
  border-radius: 2px;
}
.section-title-text {
  flex: 0 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.section-more-link {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: normal;
  color: var(--c-primary);
  text-decoration: none;
  padding: 2px 6px;
  line-height: 1;
}
.section-more-link:active { opacity: 0.7; }

/* 🟢 全部电影底部“更多” */
.section-more-bottom-wrap {
  padding: 0 var(--page-pad) 20px;
  display: flex; justify-content: center;
}
.section-more-bottom {
  font-size: 13px;
  font-weight: bold;
  color: var(--c-primary);
  text-decoration: none;
  padding: 6px 14px;
}
.section-more-bottom:active { opacity: 0.7; }

/* 🟢 推荐区底部“更换”按钮 */
.section-swap-wrap {
  padding: 4px var(--page-pad) 8px;
  display: flex; justify-content: center;
}
.section-swap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 160px;
  height: 40px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--c-primary);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 176, 94, 0.25);
  box-sizing: border-box;
}
.section-swap-btn i { font-size: 16px; color: #fff; line-height: 1; }
.section-swap-btn:active { opacity: 0.85; transform: scale(0.98); }
.section-swap-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 电影卡片 */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--poster-gap-y) var(--poster-gap-x);
  padding: 0 var(--page-pad) 18px;
  align-items: start;
}
.poster-card {
  display: flex; flex-direction: column;
  width: 100%; min-width: 0;
  text-decoration: none; color: inherit;
}
.poster-card .cover {
  position: relative; width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-poster);
  overflow: hidden; background: #ececec;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.poster-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.poster-card .cover .cover-empty {
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #eee, #e2e2e2);
}
.poster-card .cover .badge {
  position: absolute; left: 5px; top: 5px;
  padding: 2px 6px; font-size: 10px; line-height: 1.2;
  color: #fff; background: rgba(0, 0, 0, 0.55);
  border-radius: 4px; z-index: 1;
}
.poster-card .title {
  margin-top: 8px; font-size: 12px;
  text-align: center; color: var(--c-text);
  line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 100%; padding: 0 2px; min-height: 1.35em;
}
.poster-card .meta {
  margin-top: 2px; font-size: 10px;
  color: var(--c-muted); text-align: center; line-height: 1.3;
}

.h-scroll {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 0 var(--page-pad) 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll .poster-card { flex: 0 0 108px; width: 108px; }

.empty-state {
  padding: 60px 24px; text-align: center;
  color: var(--c-muted); font-size: 14px;
}

.tabbar {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: var(--max-w);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--c-border);
  display: flex; z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: #999;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.tabbar a i { font-size: 22px; line-height: 1; }
.tabbar a.active { color: var(--c-primary); font-weight: bold; }
.tabbar.play-tabbar a { color: #555; }
.tabbar.play-tabbar a i { font-size: 20px; }

.btn-primary {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; height: 46px;
  background: var(--c-primary); color: #fff;
  border-radius: 10px; font-size: 15px; font-weight: bold;
}
.btn-primary i { font-size: 18px; }

.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.loading-wrap img { width: 36px; height: 36px; }

.skeleton-banner {
  margin: 8px var(--page-pad); height: 160px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0f0f0, #fafafa, #f0f0f0);
  background-size: 200% 100%;
}
.page-placeholder {
  padding: 40px var(--page-pad);
  text-align: center; color: var(--c-muted); font-size: 13px;
}

.dev-footer { display: none !important; }

/* ========== 🟢 暗黑模式补丁 ========== */
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) .tabbar { background: rgba(18, 18, 18, 0.96); }
  html:not(.theme-light) .search-bar-wrap { background: var(--c-bg); }
}
html.theme-dark .tabbar { background: rgba(18, 18, 18, 0.96); }
html.theme-dark .search-bar-wrap { background: var(--c-bg); }