/* Standalone styles for the review page. Pulls some variables from
   styles.css (already linked) and adds spreadsheet-style table chrome. */

.review-page { overflow: auto; user-select: text; }

.rv-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(10, 13, 20, 0.95);
  border-bottom: 1px solid var(--panel-edge);
  backdrop-filter: blur(8px);
}
.rv-header h1 {
  font-size: 18px;
  letter-spacing: 0.04em;
  margin: 0;
  font-weight: 800;
}
.rv-back {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
}
.rv-back:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.rv-controls {
  margin-left: auto;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.rv-controls label { display: inline-flex; align-items: center; gap: 6px; }
.rv-controls select {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
.rv-audio-state.unlocked { color: var(--good); }

.rv-tabs {
  position: sticky;
  top: 50px;
  z-index: 9;
  display: flex;
  gap: 4px;
  padding: 6px 16px;
  background: rgba(10, 13, 20, 0.95);
  border-bottom: 1px solid var(--panel-edge);
  backdrop-filter: blur(8px);
}
.rv-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
}
.rv-tab:hover { color: var(--text); }
.rv-tab.active {
  color: var(--gold);
  border-color: rgba(246, 196, 106, 0.45);
  background: rgba(246, 196, 106, 0.10);
}

.rv-main { padding: 20px; }
.rv-section { margin-bottom: 40px; }
.rv-section.hidden { display: none; }

/* Section heading */
.rv-h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

/* Spreadsheet-style table */
.rv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  line-height: 1.4;
  table-layout: auto;
}
.rv-table thead th {
  position: sticky;
  top: 92px;
  background: #161a24;
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-edge);
  white-space: nowrap;
  z-index: 5;
}
.rv-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
}
.rv-table tbody tr:hover td { background: rgba(255,255,255,0.04); }
.rv-table tbody tr.race-divider td {
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  border-top: 2px solid rgba(255,255,255,0.10);
}

.rv-num   { text-align: right; font-variant-numeric: tabular-nums; }
.rv-name  { font-weight: 700; color: var(--text); white-space: nowrap; }
.rv-emblem { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.rv-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.15); vertical-align: middle; }
.rv-thumb {
  width: 64px; height: 64px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background-color: rgba(255,255,255,0.04);
  cursor: zoom-in;
}
.rv-thumb:hover { border-color: var(--gold); }

/* Floating 3D model viewer that follows the cursor when a thumb is hovered. */
#rv-viewer {
  position: fixed;
  top: 100px;
  right: 24px;
  width: 320px;
  height: 320px;
  background: rgba(8, 10, 16, 0.92);
  border: 1px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 50;
  display: none;
  overflow: hidden;
}
#rv-viewer.open { display: block; }
#rv-viewer .rv-viewer-title {
  position: absolute;
  top: 8px; left: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
#rv-viewer .rv-viewer-state {
  position: absolute;
  bottom: 8px; left: 12px;
  font: 600 10px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--gold);
  letter-spacing: 0.06em;
  pointer-events: none;
}
#rv-viewer canvas { width: 100%; height: 100%; display: block; }

.rv-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  margin-right: 4px;
}
.rv-tag.flying    { background: rgba(108, 209, 255, 0.18); color: #6cd1ff; border-color: rgba(108, 209, 255, 0.4); }
.rv-tag.champion  { background: rgba(246, 196, 106, 0.18); color: var(--gold); border-color: rgba(246, 196, 106, 0.4); }
.rv-tag.summoned  { background: rgba(155, 108, 255, 0.18); color: #b78cff; border-color: rgba(155, 108, 255, 0.4); }
.rv-tag.legendary { background: rgba(246, 196, 106, 0.85); color: #2a1808; }
.rv-tag.special   { background: rgba(108, 209, 255, 0.85); color: #0a1422; }

.rv-mult {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rv-mult.good    { background: rgba(108, 210, 138, 0.18); color: var(--good); }
.rv-mult.bad     { background: rgba(255, 118, 118, 0.18); color: var(--bad); }
.rv-mult.neutral { color: var(--muted); }

/* Sound buttons */
.sfx-row { display: flex; gap: 4px; flex-wrap: wrap; }
.sfx-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.sfx-btn:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.25); }
.sfx-btn:active { transform: scale(0.96); }
.sfx-btn .sfx-ico { margin-right: 3px; }
.sfx-btn.locked { opacity: 0.45; cursor: not-allowed; }

/* Sound library grid */
.rv-sounds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.rv-sound-card {
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
}
.rv-sound-card h3 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.rv-sound-card .meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.rv-sound-card .files { display: flex; flex-direction: column; gap: 4px; }
.rv-sound-card .file-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.rv-sound-card .file-row .name { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Damage matrix */
.rv-matrix {
  border-collapse: collapse;
  font-size: 12px;
}
.rv-matrix th, .rv-matrix td {
  padding: 6px 12px;
  border: 1px solid var(--panel-edge);
  text-align: center;
}
.rv-matrix thead th { background: #161a24; }
.rv-matrix tbody th { background: rgba(255,255,255,0.04); text-align: left; font-weight: 700; }

/* ---- Yaw tuner modal --------------------------------------------- */
/* Opens from the "3D ↻" button in the Yaw column of the units table.
   Loads the unit's GLB into a small viewer with a clear forward arrow,
   plus rotate buttons that persist their value to localStorage via the
   shared cfYaw API. */
.yaw-btn {
  background: rgba(90, 169, 255, 0.18);
  color: #c8dcff;
  border: 1px solid rgba(90, 169, 255, 0.45);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.yaw-btn:hover { background: rgba(90, 169, 255, 0.30); }
#yaw-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}
#yaw-modal.open { display: flex; }
.ym-card {
  background: #131722;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 16px 18px;
  max-width: 520px;
  color: #e5ecf6;
  box-shadow: 0 14px 48px rgba(0,0,0,0.6);
}
.ym-title { font-size: 14px; margin-bottom: 8px; }
.ym-title .ym-name { font-weight: 700; }
.ym-title .ym-id { color: var(--muted); font-size: 11px; margin-left: 6px; }
.ym-view {
  width: 420px; height: 420px;
  margin: 8px 0;
  background: radial-gradient(circle at 50% 30%, #1f2535 0%, #0d0f17 80%);
  border-radius: 10px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ym-view canvas { display: block; }
.ym-bar {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin: 6px 2px;
}
.ym-bar .ym-cur { color: #88baff; }
.ym-bar .ym-eff { color: #f5d77a; }
.ym-buttons {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 6px 0 8px;
}
.ym-buttons button {
  background: rgba(255,255,255,0.06);
  color: #e5ecf6;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ym-buttons button:hover { background: rgba(255,255,255,0.14); }
.ym-buttons .ym-reset { background: rgba(244, 180, 90, 0.16); }
.ym-buttons .ym-close { background: rgba(120, 180, 255, 0.18); margin-left: auto; }
.ym-hint {
  font-size: 11px; color: var(--muted); line-height: 1.45;
}

/* ---- Clickable unit name cell (opens 3D yaw tuner) -------------- */
.rv-name.rv-clickable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}
.rv-name.rv-clickable:hover { color: #8ec6ff; }
.rv-3d-hint {
  font-size: 10px;
  background: rgba(90, 169, 255, 0.16);
  color: #88baff;
  border: 1px solid rgba(90, 169, 255, 0.42);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.0;
  transition: opacity 0.15s ease;
}
.rv-name.rv-clickable:hover .rv-3d-hint { opacity: 1; }
.ym-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 8px 2px -2px;
}
