*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --primary: #2463eb;
  --page-bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #eef1f4;
  --text: #1e2732;
  --text-muted: #75808d;
  --border: #e1e5ea;
  --shadow: 0 8px 24px rgba(27, 39, 51, 0.08);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html {
  min-width: 280px;
  min-height: 100%;
  background: #dde2e8;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: #dde2e8;
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--text);
}

.boot-state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: #6d7784;
  font-size: 14px;
}

.boot-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 2px solid #cdd3da;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: short-nav-spin 0.75s linear infinite;
}

@keyframes short-nav-spin {
  to { transform: rotate(360deg); }
}

.fatal-state {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.fatal-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid #d6dce3;
  border-radius: 50%;
  background: #ffffff;
  color: #7b8591;
  font-size: 22px;
  font-weight: 700;
}

.fatal-state h1 {
  max-width: 100%;
  margin: 0;
  color: #26313d;
  font-size: 20px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.fatal-state p {
  max-width: 360px;
  margin: 10px 0 0;
  color: #7b8591;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.retry-button {
  min-width: 112px;
  min-height: 42px;
  margin-top: 24px;
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.retry-button:active {
  transform: scale(0.98);
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 18px;
  font-weight: 750;
  line-height: 1;
}

.site-heading {
  min-width: 0;
  flex: 1;
}

.site-title {
  max-width: 100%;
  margin: 0;
  color: inherit;
  font-size: 18px;
  font-weight: 720;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.site-subtitle {
  max-width: 100%;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-refresh {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: #657282;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.page-refresh:hover {
  background: #f0f2f5;
}

.page-content {
  padding: 16px 16px calc(36px + env(safe-area-inset-bottom));
}

.site-banner {
  width: 100%;
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-muted);
  box-shadow: var(--shadow);
  line-height: 0;
}

.site-banner img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.nav-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group {
  min-width: 0;
}

.nav-group-title {
  margin: 0 4px 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-link {
  position: relative;
  min-width: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.nav-link:hover {
  border-color: color-mix(in srgb, var(--link-color) 42%, var(--border));
  box-shadow: 0 5px 16px rgba(29, 40, 52, 0.08);
}

.nav-link:active {
  transform: scale(0.99);
}

.nav-link:focus-visible,
.page-refresh:focus-visible,
.video-mask:focus-visible,
.video-refresh:focus-visible,
.share-button:focus-visible,
.retry-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}

.link-accent {
  width: 4px;
  align-self: stretch;
  flex: 0 0 4px;
  border-radius: 3px;
  background: var(--link-color);
}

.link-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--link-color) 12%, var(--surface));
  color: var(--link-color);
  font-size: 18px;
  font-weight: 750;
  line-height: 1;
}

.link-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.link-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.link-title {
  max-width: 100%;
  color: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.link-description {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-arrow {
  flex: 0 0 auto;
  color: #a5adb7;
  font-size: 21px;
  line-height: 1;
}

.site-notice {
  margin: 22px 0 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.notice-title {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

.notice-copy {
  margin: 0;
  color: #596574;
  font-size: 13.5px;
  line-height: 1.85;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.site-footer {
  margin-top: 24px;
  color: #98a1ac;
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.site-footer p {
  margin: 0;
  overflow-wrap: anywhere;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

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

.media-section {
  margin-bottom: 20px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #050607;
  box-shadow: 0 6px 20px rgba(7, 10, 14, 0.2);
}

.video-element {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #050607;
  object-fit: contain;
}

.video-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background-color: #101419;
  background-position: center;
  background-size: cover;
  cursor: pointer;
}

.video-mask::before {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  content: "";
}

.play-symbol {
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.56);
}

.play-symbol::after {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid #ffffff;
  content: "";
}

.share-mask {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 18, 24, 0.9);
}

.share-box {
  width: min(100%, 300px);
  text-align: center;
}

.share-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #1686d9;
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.share-title {
  margin: 0 0 16px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.share-button,
.video-refresh {
  min-height: 42px;
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.share-button:active,
.video-refresh:active {
  transform: scale(0.98);
}

.video-refresh {
  min-width: 136px;
  display: block;
  margin: 12px auto 0;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 6px;
  background: rgba(22, 28, 36, 0.94);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  overflow-wrap: anywhere;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 商务简洁 */
body[data-theme="business-clean"] {
  --page-bg: #edf1f5;
  --surface: #ffffff;
  --surface-muted: #e1e7ed;
  --text: #182536;
  --text-muted: #7a8796;
  --border: #dbe2e9;
}

body[data-theme="business-clean"] .site-header {
  min-height: 92px;
  padding: 22px 20px;
  border: 0;
  background: var(--primary);
  color: #ffffff;
}

body[data-theme="business-clean"] .site-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
}

body[data-theme="business-clean"] .site-subtitle {
  color: rgba(255, 255, 255, 0.72);
}

body[data-theme="business-clean"] .page-content {
  padding: 18px 18px calc(38px + env(safe-area-inset-bottom));
}

body[data-theme="business-clean"] .nav-group-title {
  margin-left: 2px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  color: #26384d;
  font-size: 13px;
}

body[data-theme="business-clean"] .nav-link {
  min-height: 74px;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 14px 16px;
}

body[data-theme="business-clean"] .link-accent {
  display: none;
}

body[data-theme="business-clean"] .link-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  background: var(--link-color);
  color: #ffffff;
}

body[data-theme="business-clean"] .link-arrow {
  color: var(--primary);
}

/* 暗色极客 */
body[data-theme="dark-geek"] {
  --page-bg: #111419;
  --surface: #191d23;
  --surface-muted: #232831;
  --text: #f5f7fa;
  --text-muted: #808a98;
  --border: #292f38;
  background: #090b0e;
  color-scheme: dark;
}

body[data-theme="dark-geek"] .app-shell {
  border-color: #20252d;
}

body[data-theme="dark-geek"] .site-header {
  border-color: #252a32;
  background: #12151a;
}

body[data-theme="dark-geek"] .site-title,
body[data-theme="dark-geek"] .link-title {
  color: #ffffff;
}

body[data-theme="dark-geek"] .site-mark {
  color: #08110c;
}

body[data-theme="dark-geek"] .nav-link:hover {
  box-shadow: none;
}

body[data-theme="dark-geek"] .link-icon {
  background: color-mix(in srgb, var(--link-color) 18%, #191d23);
}

body[data-theme="dark-geek"] .site-notice {
  background: #191d23;
}

body[data-theme="dark-geek"] .notice-copy {
  color: #a5adb8;
}

body[data-theme="dark-geek"] .site-footer {
  color: #646e7c;
}

/* 编辑风格，对应原 glassmorphism 模板代码 */
body[data-theme="glassmorphism"] {
  --page-bg: #f7f8f8;
  --surface: #ffffff;
  --surface-muted: #edf1ef;
  --text: #25302c;
  --text-muted: #737f7a;
  --border: #dce2df;
}

body[data-theme="glassmorphism"] .site-header {
  min-height: 132px;
  display: block;
  padding: 28px 24px 22px;
  text-align: center;
}

body[data-theme="glassmorphism"] .site-mark {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
}

body[data-theme="glassmorphism"] .site-title,
body[data-theme="glassmorphism"] .link-title {
  font-family: Georgia, "Songti SC", "Microsoft YaHei", serif;
}

body[data-theme="glassmorphism"] .site-title {
  font-size: 25px;
}

body[data-theme="glassmorphism"] .site-subtitle {
  margin-top: 7px;
  font-family: Georgia, "Songti SC", serif;
  font-style: italic;
}

body[data-theme="glassmorphism"] .page-content {
  padding: 20px 22px calc(40px + env(safe-area-inset-bottom));
}

body[data-theme="glassmorphism"] .nav-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 5px;
  color: var(--primary);
}

body[data-theme="glassmorphism"] .nav-group-title::after {
  height: 1px;
  flex: 1;
  background: var(--border);
  content: "";
}

body[data-theme="glassmorphism"] .nav-list {
  gap: 0;
}

body[data-theme="glassmorphism"] .nav-link {
  min-height: 70px;
  padding: 13px 4px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-theme="glassmorphism"] .nav-link:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: translateX(3px);
}

body[data-theme="glassmorphism"] .link-accent {
  display: none;
}

body[data-theme="glassmorphism"] .link-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 6px;
  background: var(--link-color);
  color: #ffffff;
  font-size: 15px;
}

body[data-theme="glassmorphism"] .link-title {
  font-size: 17px;
}

body[data-theme="glassmorphism"] .link-description {
  font-family: Georgia, "Songti SC", serif;
  font-style: italic;
}

/* 多彩清爽 */
body[data-theme="rainbow-gradient"] {
  --page-bg: #f1f5f3;
  --surface: #ffffff;
  --surface-muted: #e5ece8;
  --text: #21312a;
  --text-muted: #73827b;
  --border: #dfe7e3;
}

body[data-theme="rainbow-gradient"] .site-header {
  min-height: 124px;
  display: block;
  padding: 22px 20px 17px;
  border: 0;
  background: transparent;
  text-align: center;
}

body[data-theme="rainbow-gradient"] .site-mark {
  width: 50px;
  height: 50px;
  margin: 0 auto 9px;
  border-radius: 8px;
}

body[data-theme="rainbow-gradient"] .site-title {
  font-size: 20px;
}

body[data-theme="rainbow-gradient"] .site-subtitle {
  margin-top: 4px;
}

body[data-theme="rainbow-gradient"] .page-content {
  padding-top: 6px;
}

body[data-theme="rainbow-gradient"] .nav-group-title {
  color: #53665d;
}

body[data-theme="rainbow-gradient"] .nav-link {
  border: 0;
  box-shadow: 0 2px 10px rgba(27, 45, 36, 0.07);
}

body[data-theme="rainbow-gradient"] .link-accent {
  display: none;
}

body[data-theme="rainbow-gradient"] .link-icon {
  background: var(--link-color);
  color: #ffffff;
}

body[data-theme="rainbow-gradient"] .link-arrow {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf2ef;
  color: #6d7e75;
}

/* 影视入口 */
body[data-theme="movie-portal"] {
  --page-bg: #eef2f7;
  --surface: #ffffff;
  --surface-muted: #e2e8f0;
  --text: #1d2939;
  --text-muted: #667487;
  --border: #dce3ec;
}

body[data-theme="movie-portal"] .app-shell {
  padding-top: 14px;
}

body[data-theme="movie-portal"] .site-header {
  min-height: 62px;
  margin: 0 14px 16px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(25, 39, 58, 0.04);
}

body[data-theme="movie-portal"] .site-mark {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  border-radius: 50%;
  background: #d9413c;
  font-size: 0;
}

body[data-theme="movie-portal"] .site-mark::after {
  color: #ffffff;
  content: "!";
  font-size: 17px;
  font-weight: 850;
}

body[data-theme="movie-portal"] .site-title {
  font-size: 20px;
  font-weight: 800;
}

body[data-theme="movie-portal"] .site-subtitle {
  display: none;
}

body[data-theme="movie-portal"] .page-refresh {
  display: flex;
}

body[data-theme="movie-portal"] .page-content {
  padding: 0 14px calc(38px + env(safe-area-inset-bottom));
}

body[data-theme="movie-portal"] .nav-groups {
  gap: 0;
}

body[data-theme="movie-portal"] .nav-group-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-theme="movie-portal"] .nav-list {
  gap: 4px;
}

body[data-theme="movie-portal"] .nav-link {
  min-height: 68px;
  justify-content: center;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--link-color);
  text-align: center;
}

body[data-theme="movie-portal"] .nav-link:hover {
  border: 0;
  box-shadow: none;
}

body[data-theme="movie-portal"] .link-accent,
body[data-theme="movie-portal"] .link-arrow,
body[data-theme="movie-portal"] .link-description {
  display: none;
}

body[data-theme="movie-portal"] .link-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  background: var(--link-color);
  color: #ffffff;
}

body[data-theme="movie-portal"] .link-copy {
  flex: 0 1 auto;
}

body[data-theme="movie-portal"] .link-title {
  color: var(--link-color);
  font-size: 27px;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
}

body[data-theme="movie-portal"] .site-notice {
  border: 0;
  background: transparent;
  text-align: center;
}

body[data-theme="movie-portal"] .notice-title {
  font-size: 21px;
  font-weight: 800;
}

body[data-theme="movie-portal"] .notice-copy {
  color: #27364a;
  font-size: 16px;
  font-weight: 650;
  text-align: left;
}

@media (min-width: 521px) {
  .app-shell {
    border-right: 1px solid rgba(90, 104, 120, 0.15);
    border-left: 1px solid rgba(90, 104, 120, 0.15);
  }
}

@media (max-width: 360px) {
  .site-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .nav-link {
    gap: 10px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .link-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  body[data-theme="movie-portal"] .link-title {
    font-size: 24px;
  }
}

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