/* DOS TUI Theme — 电脑报 1992 Turbo Vision style
   Adapted from CPCW dos.css for the HDD software archive. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  background: #0c0e14;
  min-height: 100vh;
  font: 14px/1 'IBM Plex Mono', 'Fira Mono', 'DejaVu Sans Mono', 'Liberation Mono', monospace;
  color: #b0b8c4;
}

a { color: #7abac0; text-decoration: none; }
a:hover { background: #4a7a80; color: #101820; }
a:visited { color: #9a7aaa; }

/* ── Screen frame ── */
.tv {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Menu bar ── */
.tv-menu {
  background: #8090a0;
  color: #101820;
  display: flex;
  padding: 3px 0;
  user-select: none;
}
.tv-menu span {
  padding: 0 8px;
}
.tv-menu span:hover {
  background: #4a7a5a;
  color: #e0e8e0;
}
.tv-menu a {
  color: inherit;
  text-decoration: none;
}
.tv-menu a:hover {
  background: transparent;
}
.tv-menu a:visited {
  color: inherit;
}
.tv-menu .tv-menu-r {
  margin-left: auto;
  background: transparent;
}
.tv-menu .tv-menu-r:hover {
  background: transparent;
  color: #101820;
}

/* ── Desktop (blue area) ── */
.tv-desktop {
  flex: 1;
  background: #1a2744;
  padding: 8px;
}

/* ── Window ── */
.tv-win {
  border: 2px solid #5a8a90;
  background: #1a2744;
  position: relative;
  box-shadow: 4px 4px 0 #0a0e18;
}

.tv-win-title {
  position: absolute;
  top: -2px; left: 16px;
  transform: translateY(-50%);
  background: #1a2744;
  padding: 0 6px;
  color: #d8dce4;
  font-weight: bold;
  white-space: nowrap;
}

.tv-body {
  padding: 6px 10px;
}

/* ── Header fields ── */
.tv-hdr {
  margin-bottom: 6px;
}
.tv-field {
  display: flex;
  gap: 4px;
  padding: 1px 0;
}
.tv-lbl {
  color: #d8dce4;
  min-width: 10ch;
  flex-shrink: 0;
}
.tv-val {
  color: #d4c87a;
}
.tv-val-dim {
  color: #6a9aa0;
}

/* ── Divider ── */
.tv-hr {
  border: none;
  border-top: 1px solid #5a8a90;
  margin: 4px 0 6px;
}

/* ── List (BBS-style) ── */
.tv-list {
  border: 1px solid #5a8a90;
  background: #142038;
}
.tv-list-hdr {
  background: #4a7a80;
  color: #101820;
  padding: 2px 8px;
  font-weight: bold;
  display: flex;
}
.tv-list-hdr span:first-child {
  min-width: 5ch;
}
.tv-list-hdr span:nth-child(2) {
  flex: 1;
}
.tv-list-hdr span:nth-child(3) {
  width: 10ch;
  text-align: right;
}

.tv-sec {
  background: #4a7a80;
  color: #101820;
  padding: 2px 8px;
  font-weight: bold;
}

.tv-row {
  display: block;
  text-decoration: none;
  color: #b0b8c4;
  padding: 4px 8px;
}
.tv-row:nth-child(odd) { background: #142038; }
.tv-row:nth-child(even) { background: #1a2744; }
.tv-row:hover {
  background: #4a7a80;
  color: #101820;
}
.tv-row-line {
  display: flex;
  gap: 4px;
  align-items: baseline;
}
.tv-row-n {
  color: #d8dce4;
  min-width: 5ch;
  text-align: right;
}
.tv-row:hover .tv-row-n { color: #101820; }
.tv-row-t {
  color: #d4c87a;
  flex: 1;
}
.tv-row:hover .tv-row-t { color: #101820; }
.tv-row-c {
  color: #8a98a8;
  flex-shrink: 0;
}
.tv-row:hover .tv-row-c { color: #101820; }
.tv-row-d {
  color: #6aaa6a;
  flex-shrink: 0;
}
.tv-row:hover .tv-row-d { color: #101820; }
.tv-row-sub {
  color: #6a9aa0;
  padding-left: 6ch;
  line-height: 1.4;
}
.tv-row:hover .tv-row-sub { color: #1a2744; }

/* ── Navigation ── */
.tv-nav {
  border-top: 1px solid #5a8a90;
  margin-top: 6px;
  padding-top: 4px;
  text-align: center;
  color: #506070;
}
.tv-nav a {
  color: #7abac0;
  text-decoration: none;
}
.tv-nav a:hover {
  background: #4a7a80;
  color: #101820;
}

/* ── Status bar ── */
.tv-status {
  background: #8090a0;
  color: #101820;
  display: flex;
  padding: 3px 0;
}
.tv-status span {
  padding: 0 8px;
  white-space: nowrap;
}
.tv-status kbd {
  color: #e0e4e8;
  background: #1a2030;
  font: inherit;
  padding: 0 2px;
}
.tv-status a {
  color: #101820;
  text-decoration: none;
}
.tv-status a:hover {
  background: #4a7a5a;
  color: #e0e8e0;
}

/* ── Entry card (software listing on CD page) ── */
.entry-card {
  border-bottom: 1px solid #2a3a54;
  padding: 6px 8px;
}
.entry-card:last-child { border-bottom: none; }

.entry-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1em;
  align-items: baseline;
}
.entry-num {
  color: #d8dce4;
  font-weight: bold;
  min-width: 4ch;
}
.entry-name {
  color: #d4c87a;
  font-weight: bold;
}
.entry-version {
  color: #6aaa6a;
}
.entry-disks {
  color: #6a9aa0;
}
.entry-price {
  color: #cc6666;
}

.entry-desc {
  color: #8a98a8;
  margin-top: 3px;
  padding-left: 5ch;
  line-height: 1.6;
}

/* ── LLM description ── */
.entry-llm {
  color: #6aaa6a;
  border: 1px solid #5a8a90;
  padding: 4px 8px;
  margin: 4px 0 4px 5ch;
  background: #142038;
  line-height: 1.5;
}
.entry-llm p { margin: 0.3em 0; }

/* ── Actions row (file listing button + QC) ── */
.entry-actions {
  margin: 4px 0 2px 5ch;
  display: flex;
  align-items: center;
  gap: 8px;
}

.metadata-btn {
  background: #4a7a80;
  border: 1px solid #5a8a90;
  color: #101820;
  padding: 2px 10px;
  cursor: pointer;
  font: inherit;
  font-weight: bold;
}
.metadata-btn:hover {
  background: #7abac0;
  color: #0a0e18;
}

.metadata-panel {
  background: #142038;
  border: 1px solid #5a8a90;
  padding: 4px;
  margin: 4px 0 4px 5ch;
}

/* ── Download section ── */
.entry-downloads {
  margin: 4px 0 0 5ch;
}

.dl-section {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.dl-label {
  color: #d4c87a;
  font-weight: bold;
  min-width: 4ch;
  flex-shrink: 0;
}

.dl-files {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.file-link {
  color: #7abac0;
  text-decoration: none;
  border: 1px solid #5a8a90;
  padding: 2px 8px;
  background: #142038;
}
.file-link:hover {
  background: #4a7a80;
  color: #101820;
  text-decoration: none;
}
.file-link:visited { color: #7abac0; }
.vol-tag {
  color: #6a9aa0;
  font-size: 0.85em;
}

/* ── QC Status ── */
.qc-pass { color: #6aaa6a; }
.qc-fail { color: #cc6666; }
.qc-warn { color: #d4c87a; }

/* ── README / FILE_ID.DIZ in entry card ── */
.entry-readme {
  border: 1px solid #5a8a90;
  margin: 4px 0 4px 5ch;
  background: #142038;
}
.readme-hdr {
  background: #4a7a80;
  color: #101820;
  padding: 2px 8px;
  font-weight: bold;
}
.readme-text {
  color: #6aaa6a;
  padding: 4px 8px;
  margin: 0;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.readme-collapsed {
  max-height: 14em;
  overflow: hidden;
  position: relative;
}
.readme-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3em;
  background: linear-gradient(transparent, #142038);
}
.entry-readme.expanded .readme-collapsed {
  max-height: none;
  overflow: visible;
}
.entry-readme.expanded .readme-collapsed::after {
  display: none;
}
.readme-toggle {
  color: #7abac0;
  cursor: pointer;
  font-weight: normal;
}
.readme-toggle:hover {
  background: #4a7a80;
  color: #101820;
}

/* ── DOS dir listing ── */
.disk-listing {
  margin-bottom: 4px;
}

.disk-header {
  color: #d4c87a;
  font-weight: bold;
  margin: 6px 0 2px;
  border-bottom: 1px solid #3a5a60;
  padding-bottom: 1px;
}
.disk-header:first-child { margin-top: 0; }
.volume-label { color: #6a9aa0; font-weight: normal; }

.dir-listing {
  color: #b0b8c4;
  margin: 0;
  line-height: 1.3;
  white-space: pre;
}

/* ── Tree view ── */
.tree-root {
  padding: 2px 0;
}
.tree-dir {
  margin-left: 16px;
}
.tree-dir-name {
  color: #d4c87a;
  cursor: pointer;
  padding: 1px 4px;
  user-select: none;
}
.tree-dir-name:hover {
  background: #2a3a54;
}
.tree-arrow {
  display: inline-block;
  width: 1.2em;
  text-align: center;
  color: #5a8a90;
}
.tree-dir-children {
  border-left: 1px solid #3a5a60;
  margin-left: 6px;
}
.tree-files {
  margin-left: 16px;
}
.tree-root > .tree-files {
  margin-left: 0;
}

.error { color: #cc6666; }

/* ── Overview / AI summary ── */
.overview-banner {
  color: #6aaa6a;
  border: 1px solid #5a8a90;
  padding: 4px 8px;
  margin-bottom: 6px;
  background: #142038;
  line-height: 1.5;
}
.overview-banner p { margin: 0.3em 0; }

/* ── Format legend ── */
.format-legend {
  border: 1px solid #5a8a90;
  padding: 4px 8px;
  margin-bottom: 6px;
  color: #8a98a8;
  line-height: 1.6;
}
.format-legend strong { color: #d4c87a; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .tv-win { box-shadow: none; }
  .tv-body { padding: 4px 6px; }

  .entry-header {
    flex-direction: column;
    gap: 0.15em;
  }
  .entry-desc,
  .entry-llm,
  .entry-downloads,
  .metadata-panel {
    padding-left: 0;
    margin-left: 0;
  }
}
