* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #10131a;
  --panel: #182233;
  --panel-2: #202d42;
  --line: #304057;
  --text: #f3f6fb;
  --muted: #aeb8c7;
  --accent: #e34f64;
  --accent-2: #2f8f83;
  --warn: #d9a441;
}
body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: #f4b8c1; text-decoration: none; }
a:hover { text-decoration: underline; }
.app { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100vh; min-height: 0; }
.sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--line); }
.title-row, .top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
h1 { font-size: 19px; font-weight: 700; letter-spacing: 0; }
.summary { color: var(--muted); font-size: 12px; white-space: nowrap; }
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}
.logout-link {
  color: #f4b8c1;
  text-decoration: none;
}
.logout-link:hover { text-decoration: underline; }
.tool-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
.search-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #101928;
  color: var(--text);
  padding: 0 12px;
}
.btn {
  height: 38px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: #2b3a53; }
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: #f06176; }
.btn.ghost { border: 1px solid var(--line); background: transparent; }
.subject-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.subject-tab {
  min-height: 32px;
  border-radius: 8px;
  background: #101928;
  color: var(--text);
  padding: 5px 9px;
  font-size: 13px;
}
.subject-tab.active { background: var(--accent); }
.subject-tab.blocked { opacity: .48; text-decoration: line-through; }
.subject-tab.done::after { content: " ✓"; color: #8de0a6; }
.mask-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #141d2c;
}
.mask-panel label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}
.mask-panel input { accent-color: var(--accent); }
.list-status { padding: 10px 16px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.video-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 20px;
}
.video-item {
  position: relative;
  width: 100%;
  text-align: left;
  border-radius: 8px;
  background: #101928;
  color: var(--text);
  padding: 11px 12px;
  margin-bottom: 8px;
}
.video-item:hover { background: #26364f; }
.video-item.playing { background: var(--accent); }
.video-item.resume { outline: 1px solid var(--warn); }
.video-title { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.video-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.video-item.playing .video-meta { color: rgba(255,255,255,.78); }
.progress-bar { height: 4px; overflow: hidden; border-radius: 99px; margin-top: 9px; background: rgba(255,255,255,.13); }
.progress-fill { height: 100%; width: 0; background: var(--accent-2); }
.player-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  padding: 18px 20px 16px;
}
.video-shell {
  position: relative;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}
video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
}
.empty-state { color: #7f8999; text-align: center; padding: 20px; }
.empty-state h2 { font-size: 24px; margin-bottom: 8px; }
.countdown {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: none;
  max-width: min(720px, calc(100% - 28px));
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(16, 19, 26, .9);
  color: var(--text);
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.countdown.show { display: block; }
.now-playing { min-width: 0; flex: 0 0 auto; }
.now-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.now-playing h2 { font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-start; }
.speed-select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101928;
  color: var(--text);
  padding: 0 8px;
}
.hint { margin-top: 10px; color: #7f8999; font-size: 12px; }
.seek-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.seek-slider {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 99px;
  background: #314057;
  cursor: pointer;
  overflow: hidden;
  outline: none;
}
.seek-slider:focus-visible { box-shadow: 0 0 0 2px rgba(227,79,100,.55); }
.seek-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  pointer-events: none;
}
.time-readout { min-width: 44px; font-variant-numeric: tabular-nums; }

.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.panel h1 { margin-bottom: 8px; font-size: 26px; }
.panel p { color: var(--muted); margin-bottom: 18px; }
label { display: block; margin: 14px 0 6px; color: #c8d2e1; }
input, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #101928;
  color: var(--text);
}
.panel input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
}
.btn.block { width: 100%; margin-top: 18px; }
.error { margin-top: 14px; color: #ff9cab; }
.ok { margin-top: 14px; color: #8de0a6; }
.admin-wrap {
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
}
.admin-panel {
  width: min(860px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 24px;
}
.admin-panel p { color: var(--muted); margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; margin-top: 18px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
th { color: var(--muted); }

@media (max-width: 820px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 44vh) minmax(420px, 56vh); min-height: 100vh; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .player-area { min-height: 0; padding: 12px; }
  .video-shell { max-height: none; }
  .now-row { grid-template-columns: 1fr; }
  .controls { justify-content: flex-start; }
}
