:root {
  --bg: #0b0d10;
  --panel: #15191f;
  --panel-2: #1d232b;
  --line: #303945;
  --text: #eef2f6;
  --muted: #96a2af;
  --accent: #2f9d7e;
  --accent-2: #d8753a;
  --danger: #d45757;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.shell {
  width: min(1500px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

#mobileToolsBtn {
  display: none;
}

.hidden-panel {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
}

.side,
.main {
  min-width: 0;
}

.panel {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-box {
  margin-bottom: 10px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #cdd6df;
  font-size: 13px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row {
  grid-template-columns: minmax(0, 1fr) 82px;
}

input,
textarea,
button {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: #0f1217;
  outline: none;
}

input { height: 40px; padding: 0 10px; }
textarea { resize: vertical; padding: 10px; line-height: 1.45; }

button {
  min-height: 40px;
  padding: 0 14px;
  color: white;
  background: var(--accent);
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { cursor: wait; opacity: 0.65; }
button.ghost { background: var(--panel-2); }
button.small { min-height: 30px; padding: 0 10px; font-size: 12px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.pager button {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

.pager span {
  color: var(--muted);
  font-size: 13px;
}

.bottom-pager {
  justify-content: center;
  margin: 18px 0 4px;
}

.bottom-pager span {
  min-width: 86px;
  text-align: center;
}

pre {
  overflow: auto;
  max-height: 210px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce5ee;
  background: #0f1217;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.player {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.watch-status {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.watch-status.is-error {
  border-color: rgba(212, 87, 87, 0.65);
  color: #ffd6d6;
  background: rgba(117, 29, 29, 0.36);
}

.watch-status.is-ok {
  border-color: rgba(47, 157, 126, 0.55);
  color: #d9fff3;
  background: rgba(20, 88, 70, 0.32);
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--panel-2);
}

.tab.active {
  background: var(--accent-2);
}

.pane {
  display: none;
  padding-top: 14px;
}

.pane.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #111820;
}

.card-title {
  min-height: 52px;
  padding: 9px;
  color: #edf4fa;
  font-size: 13px;
  line-height: 1.35;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.links {
  display: grid;
  gap: 8px;
}

.links button {
  width: 100%;
  min-height: 38px;
  text-align: left;
  background: var(--panel);
  word-break: break-all;
}

@media (max-width: 1040px) {
  .workspace { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 12px, 680px);
    padding-top: 6px;
  }

  #mobileToolsBtn { display: none; }

  .workspace {
    gap: 8px;
  }

  .side { display: block; }

  .panel {
    margin-bottom: 8px;
    padding: 10px;
  }

  .player {
    border-radius: 6px;
  }

  .tabs {
    margin-top: 8px;
    overflow-x: auto;
  }

  .tab {
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .pane {
    padding-top: 8px;
  }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: minmax(0, 1fr) 74px; }

  .card-title {
    min-height: 44px;
    padding: 7px;
    font-size: 12px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .bottom-pager {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 8px 0;
    margin: 10px 0 0;
    background: var(--bg);
  }

  .bottom-pager button {
    min-height: 36px;
  }

  pre {
    max-height: 150px;
  }
}
