:root {
  --color-bg: #050505;
  --color-surface: #111111;
  --color-surface-strong: #191919;
  --color-text: #f7f7f7;
  --color-muted: #a8a8a8;
  --color-accent: #ffd21a;
  --color-border: #282828;
  --nav-height: 72px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--color-bg);
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell,
.admin-shell {
  width: 100%;
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 18px calc(var(--nav-height) + env(safe-area-inset-bottom) + 24px);
}

.admin-shell {
  padding-bottom: 24px;
}

.page-panel {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0 28px;
}

.language-switch {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 14px;
  z-index: 21;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  color: var(--color-muted);
  background: rgba(8, 8, 8, 0.94);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}

[dir="rtl"] .language-switch {
  right: auto;
  left: 14px;
}

.language-switch form {
  margin: 0;
}

.language-switch button {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 750;
}

.language-switch button.is-active {
  color: var(--color-accent);
}

.page-kicker {
  margin: 0 0 10px;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
}

.page-note {
  max-width: 32rem;
  margin: 14px 0 0;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.7;
}

.auth-panel {
  max-width: 420px;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.form label {
  display: grid;
  gap: 8px;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 650;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
}

.form textarea {
  resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: var(--color-accent);
}

.check-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--color-accent);
}

.upload-field {
  gap: 10px;
}

.upload-pair {
  display: grid;
  gap: 16px;
}

.upload-zone {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 128px;
  padding: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px dashed #5c5c5c;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.upload-zone.is-dragover,
.upload-zone:focus-within {
  background: var(--color-surface-strong);
  border-color: var(--color-accent);
}

.upload-zone__main {
  color: var(--color-accent);
  font-size: 15px;
  font-weight: 800;
}

.upload-zone__hint {
  color: var(--color-muted);
  font-size: 13px;
}

.upload-zone__current,
.upload-zone__meta,
.upload-zone__status {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.upload-zone__current {
  color: var(--color-text);
}

.upload-zone__current[hidden] {
  display: none;
}

.upload-progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: #050505;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.upload-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--color-accent);
}

.upload-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.upload-preview[hidden] {
  display: none;
}

.upload-preview--video {
  display: block;
  height: auto;
  background: #050505;
}

.upload-zone--cover {
  align-content: start;
  min-height: 0;
}

.upload-zone--video {
  min-height: 176px;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

.button-primary {
  color: #050505;
  background: var(--color-accent);
}

.button-secondary {
  color: var(--color-text);
  background: transparent;
  border-color: var(--color-border);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.status-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.status-list span {
  color: var(--color-muted);
}

.status-list strong {
  text-align: right;
}

[dir="rtl"] .status-list strong {
  text-align: left;
}

.flash-stack {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 8px;
}

.flash {
  margin: 0;
  padding: 12px 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.flash--success {
  border-color: var(--color-accent);
}

.flash--error {
  border-color: #d84d4d;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1040px;
  margin: 0 auto;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.admin-topbar > a {
  color: var(--color-accent);
  font-weight: 800;
}

.admin-topbar nav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--color-muted);
  font-size: 14px;
}

.admin-topbar button,
.table-actions button {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.wide-panel {
  max-width: 1040px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--color-surface);
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  white-space: nowrap;
}

.data-table th {
  color: var(--color-accent);
  background: var(--color-surface-strong);
  font-weight: 750;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 12px;
  color: var(--color-accent);
}

.catalog-panel {
  max-width: 1120px;
}

.category-nav {
  width: 100%;
  margin-top: 18px;
  overflow: hidden;
}

.category-nav__scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-nav__scroller::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 13px;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
  white-space: nowrap;
}

.category-chip.is-active {
  color: #050505;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.video-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
  margin-top: 24px;
}

.video-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  min-width: 0;
}

.video-card__cover {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  color: var(--color-accent);
  background: #0d0d0d;
  font-weight: 800;
}

.video-card__cover img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  max-width: 100%;
  min-height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.video-card__cover > span:not(.play-badge) {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.video-card__cover strong {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  color: #050505;
  background: var(--color-accent);
  border-radius: 6px;
  font-size: 12px;
}

.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding-left: 4px;
  color: #050505;
  background: var(--color-accent);
  border: 2px solid rgba(5, 5, 5, 0.72);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}

.video-card__body {
  display: grid;
  align-content: start;
  min-height: 64px;
  padding: 12px;
}

.video-card h2 {
  margin: 0;
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  min-height: 2.7em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

[dir="rtl"] .video-card h2,
[dir="rtl"] .video-card p,
[dir="rtl"] .page-panel,
[dir="rtl"] .form label,
[dir="rtl"] .access-panel p,
[dir="rtl"] .page-note {
  text-align: right;
}

.video-card p {
  margin: 0;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-section {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.recommendation-section h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.recommendation-grid {
  margin-top: 16px;
}

.video-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.page-panel > .video-player {
  margin-top: 22px;
}

.live-stage {
  position: relative;
  margin-top: 22px;
}

.danmaku-layer {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  z-index: 3;
  display: grid;
  gap: 8px;
  max-height: 45%;
  overflow: hidden;
  pointer-events: none;
}

.danmaku-item {
  justify-self: start;
  max-width: 92%;
  padding: 5px 9px;
  color: var(--color-accent);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 210, 26, 0.32);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.danmaku-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.danmaku-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
}

.danmaku-form input:focus {
  border-color: var(--color-accent);
}

.access-panel {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.access-panel p {
  margin: 0;
  color: var(--color-muted);
  line-height: 1.7;
}

.pagination {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin: 24px auto 0;
  pointer-events: auto;
}

.pagination__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.pagination__control,
.pagination__page,
.pagination__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.pagination__control,
.pagination__page {
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 210, 26, 0.28);
}

.pagination__control {
  min-width: 92px;
}

.pagination__page.is-current {
  color: #050505;
  background: var(--color-accent);
  border-color: var(--color-accent);
  cursor: default;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .pagination__control:hover,
  .pagination__page:hover {
    border-color: var(--color-accent);
  }
}

.pagination__control.is-disabled {
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  opacity: 0.45;
  pointer-events: none;
}

.pagination__ellipsis {
  min-width: 24px;
  padding: 0 2px;
  color: var(--color-muted);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #080808;
  border-top: 1px solid var(--color-border);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 650;
}

.bottom-nav__item.is-active {
  color: var(--color-accent);
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.bottom-nav__item:nth-child(1) .bottom-nav__icon {
  border-radius: 50%;
}

.bottom-nav__item:nth-child(2) .bottom-nav__icon {
  border-radius: 4px;
}

.bottom-nav__item:nth-child(3) .bottom-nav__icon {
  border-radius: 50% 50% 8px 8px;
}

@media (min-width: 768px) {
  .app-shell,
  .admin-shell {
    padding-right: 32px;
    padding-left: 32px;
  }

  h1 {
    font-size: 38px;
  }

  .upload-pair {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .play-badge {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
