/* 검수·적용 콘솔 + 공용 모달/토스트 — 다크 기본, prefers-color-scheme: light 지원 */
:root {
  --rv-bg: #1b1f24; --rv-panel: #22272e; --rv-panel2: #1b2027; --rv-line: #313943; --rv-text: #dfe6ec;
  --rv-mute: #8b98a5; --rv-accent: #2f9e77; --rv-accent-fg: #fff; --rv-gold: #e8c56a; --rv-warn: #e0a36a;
  --rv-bad: #e07a7a; --rv-good: #8fe0a8; --rv-focus: #66c7a8; --rv-slot: #45474d; --rv-grass: #6a9a3c;
  --rv-chk1: #262b31; --rv-chk2: #1f242a; --rv-input: #171b20; --rv-btn: #2c3440; --rv-btn-line: #3a4552;
}
@media (prefers-color-scheme: light) {
  :root {
    --rv-bg: #f4f6f8; --rv-panel: #ffffff; --rv-panel2: #f0f3f6; --rv-line: #d3dbe3; --rv-text: #1c2430;
    --rv-mute: #566472; --rv-accent: #1f7a5a; --rv-accent-fg: #fff; --rv-gold: #8a6212; --rv-warn: #9a5a12;
    --rv-bad: #b3302f; --rv-good: #1c7a3c; --rv-focus: #0b6b4c; --rv-chk1: #e6eaee; --rv-chk2: #f6f8fa;
    --rv-input: #ffffff; --rv-btn: #eef2f6; --rv-btn-line: #c5cfd9;
  }
  body { background: var(--rv-bg) !important; color: var(--rv-text) !important; }
  header .sub, .sub { color: var(--rv-mute) !important; }
  nav button { background: var(--rv-panel) !important; color: var(--rv-mute) !important; border-color: var(--rv-line) !important; }
  nav button.on { background: var(--rv-accent) !important; color: #fff !important; border-color: var(--rv-accent) !important; }
  .chip, .card, .toolbar input[type=search], .toolbar select { background: var(--rv-panel) !important; border-color: var(--rv-line) !important; color: var(--rv-text) !important; }
  .chip.on { background: var(--rv-accent) !important; color: #fff !important; }
  .card .meta, .card .size { color: var(--rv-text) !important; }
  .card .img, canvas { background: repeating-conic-gradient(var(--rv-chk1) 0 25%, var(--rv-chk2) 0 50%) 0 0 / 20px 20px !important; }
  .badge { background: var(--rv-panel2) !important; }
  #lb .box, #regen .box { background: var(--rv-panel) !important; border-color: var(--rv-line) !important; color: var(--rv-text) !important; }
  .btn { background: var(--rv-btn) !important; color: var(--rv-text) !important; border-color: var(--rv-btn-line) !important; }
}

#review { padding: 14px 24px 60px; color: var(--rv-text); }
#review.hidden { display: none; }
#review *, .ag-modal * { box-sizing: border-box; }
#review button:focus-visible, #review input:focus-visible, #review select:focus-visible, .ag-modal :focus-visible,
#review .slot:focus-visible, #review .cand:focus-visible { outline: 2px solid var(--rv-focus); outline-offset: 2px; }
.rv-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.rv-tab { background: var(--rv-panel); color: var(--rv-text); border: 1px solid var(--rv-line); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rv-tab[aria-selected=true] { border-color: var(--rv-accent); box-shadow: inset 0 -3px 0 var(--rv-accent); font-weight: 600; }
.rv-pill { font-size: 11px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--rv-line); color: var(--rv-mute); white-space: nowrap; }
.rv-pill.warn { color: var(--rv-warn); border-color: var(--rv-warn); }
.rv-pill.gen { color: var(--rv-gold); border-color: var(--rv-gold); }
.rv-pill.good { color: var(--rv-good); border-color: var(--rv-good); }
.rv-pill.bad { color: var(--rv-bad); border-color: var(--rv-bad); }
.rv-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.rv-bar input[type=search], .rv-bar select { background: var(--rv-input); color: var(--rv-text); border: 1px solid var(--rv-line);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; }
.rv-bar input[type=search] { flex: 0 1 220px; width: auto; }
.rv-bar select { width: auto; }
.rv-fchips { display: flex; gap: 6px; flex-wrap: wrap; }
.rv-chip { background: var(--rv-panel); color: var(--rv-text); border: 1px solid var(--rv-line); border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; cursor: pointer; }
.rv-chip[aria-pressed=true] { background: var(--rv-accent); border-color: var(--rv-accent); color: var(--rv-accent-fg); }
.rv-spacer { flex: 1; }
.rv-btn { background: var(--rv-btn); color: var(--rv-text); border: 1px solid var(--rv-btn-line); border-radius: 8px; padding: 6px 12px;
  cursor: pointer; font-size: 12.5px; font-family: inherit; }
.rv-btn:hover { filter: brightness(1.12); }
.rv-btn.primary { background: var(--rv-accent); border-color: var(--rv-accent); color: var(--rv-accent-fg); }
.rv-btn.gold { border-color: var(--rv-gold); color: var(--rv-gold); }
.rv-btn:disabled { opacity: .5; cursor: not-allowed; }
.rv-info { background: var(--rv-panel2); border: 1px solid var(--rv-line); border-radius: 10px; padding: 8px 12px; font-size: 12.5px;
  color: var(--rv-mute); margin-bottom: 12px; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.rv-info b { color: var(--rv-text); font-weight: 600; }
.rv-bg { display: inline-flex; border: 1px solid var(--rv-line); border-radius: 8px; overflow: hidden; }
.rv-bg button { background: var(--rv-panel); color: var(--rv-mute); border: 0; padding: 6px 10px; font-size: 12px; cursor: pointer; }
.rv-bg button[aria-pressed=true] { background: var(--rv-accent); color: var(--rv-accent-fg); }

.rv-list { display: flex; flex-direction: column; gap: 10px; }
.slot { background: var(--rv-panel); border: 1px solid var(--rv-line); border-radius: 12px; padding: 12px;
  display: grid; grid-template-columns: 190px 230px 1fr auto; gap: 14px; align-items: start; scroll-margin: 90px; }
.slot.sel { border-color: var(--rv-focus); box-shadow: 0 0 0 1px var(--rv-focus); }
.slot.busy { opacity: .7; }
.slot h3 { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.slot .sid { color: var(--rv-mute); font-size: 11.5px; overflow-wrap: anywhere; }
.slot .gp { color: var(--rv-mute); font-size: 11px; overflow-wrap: anywhere; margin-top: 2px; }
.slot .state { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.slot .applied { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.slot .stage { display: flex; align-items: center; justify-content: center; min-width: 96px; min-height: 80px; padding: 8px;
  border-radius: 8px; border: 1px solid var(--rv-line); }
.bg-slot .stage, .bg-slot .cimg { background: var(--rv-slot); }
.bg-grass .stage, .bg-grass .cimg { background: var(--rv-grass); }
.bg-checker .stage, .bg-checker .cimg { background: repeating-conic-gradient(var(--rv-chk1) 0 25%, var(--rv-chk2) 0 50%) 0 0 / 16px 16px; }
.slot .stage img { image-rendering: auto; display: block; }
.stages { display: flex; gap: 8px; flex-wrap: wrap; }
.slot .cap { font-size: 11px; color: var(--rv-mute); }
.cands { display: flex; gap: 10px; flex-wrap: wrap; }
.cand { background: var(--rv-panel2); border: 2px solid var(--rv-line); border-radius: 10px; padding: 6px; width: 100%; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: center; color: var(--rv-text); font-family: inherit; text-align: center; }
.cand:hover { border-color: var(--rv-gold); }
.cand.on { border-color: var(--rv-accent); }
.cand.hid { opacity: .55; }
.cand .cimg { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; }
.cand img { max-width: 100%; max-height: 96px; object-fit: contain; }
/* 세로형 타일(256×312) — 원본 비율 유지 썸네일 */
.slot.tall .cand .cimg { height: 148px; }
.slot.tall .cand img { max-height: 144px; }
.cand .meta { font-size: 11px; color: var(--rv-mute); }
.cand .num { font-weight: 700; color: var(--rv-text); }
.cwrap { width: 118px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.cwrap .mini { display: flex; gap: 4px; justify-content: center; }
.mini button { background: none; border: 0; color: var(--rv-mute); font-size: 11px; cursor: pointer; text-decoration: underline; padding: 2px 4px; }
.ph { background: repeating-linear-gradient(135deg, var(--rv-panel2), var(--rv-panel2) 6px, var(--rv-line) 6px, var(--rv-line) 7px);
  color: var(--rv-mute); font-size: 11px; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 80px; width: 100%; }
.acts { display: flex; flex-direction: column; gap: 6px; min-width: 112px; }
.gen-note { font-size: 12px; color: var(--rv-gold); border: 1px dashed var(--rv-gold); border-radius: 8px; padding: 6px 8px; }
.rv-empty, .rv-error { text-align: center; padding: 48px 12px; color: var(--rv-mute); }
.rv-error b { color: var(--rv-bad); display: block; margin-bottom: 8px; }
.rv-skel { height: 130px; border-radius: 12px; background: linear-gradient(100deg, var(--rv-panel) 40%, var(--rv-panel2) 50%, var(--rv-panel) 60%) 0 0 / 200% 100%;
  animation: rvshim 1.1s infinite; }
@keyframes rvshim { to { background-position-x: -200%; } }
@media (prefers-reduced-motion: reduce) { .rv-skel { animation: none; } }

.cmp { display: flex; gap: 8px; align-items: center; }
.cmp .arrow { color: var(--rv-mute); }
.hist { margin: 0; padding: 0 0 0 4px; list-style: none; max-height: 50vh; overflow: auto; font-size: 12.5px; }
.hist li { border-left: 2px solid var(--rv-line); padding: 4px 0 8px 10px; }
.hist .at { color: var(--rv-mute); font-size: 11px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kbd { font-family: ui-monospace, monospace; border: 1px solid var(--rv-line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; background: var(--rv-panel2); }
.zoom { max-width: min(80vw, 520px); max-height: 60vh; image-rendering: auto; }
.zoomstage { display: flex; justify-content: center; padding: 14px; border-radius: 10px; overflow: auto; }

/* 공용 모달·토스트 */
.ag-modal { position: fixed; inset: 0; z-index: 90; background: rgba(8,10,14,.72); display: flex; align-items: center; justify-content: center; padding: 12px; }
.ag-box { background: var(--rv-panel); color: var(--rv-text); border: 1px solid var(--rv-line); border-radius: 14px; padding: 18px; width: min(94vw, 460px); max-height: 90vh; overflow: auto; }
.ag-box h2 { margin: 0 0 8px; font-size: 16px; }
.ag-body { font-size: 13px; color: var(--rv-text); }
.ag-body p { margin: 4px 0 8px; }
.ag-field { display: block; font-size: 12px; color: var(--rv-mute); margin: 10px 0 0; }
.ag-field input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--rv-line); background: var(--rv-input); color: var(--rv-text); font-size: 14px; }
.ag-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.ag-btn { background: var(--rv-btn); color: var(--rv-text); border: 1px solid var(--rv-btn-line); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px; font-family: inherit; }
.ag-btn.primary { background: var(--rv-accent); border-color: var(--rv-accent); color: var(--rv-accent-fg); }
.ag-btn.danger { background: var(--rv-bad); border-color: var(--rv-bad); color: #fff; }
.ag-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 95; background: var(--rv-panel); color: var(--rv-text);
  border: 1px solid var(--rv-accent); padding: 10px 16px; border-radius: 10px; font-size: 13px; max-width: 92vw; box-shadow: 0 6px 24px rgba(0,0,0,.45);
  display: flex; gap: 12px; align-items: center; }
.ag-toast[hidden] { display: none; }
.ag-toast-act { background: var(--rv-accent); color: var(--rv-accent-fg); border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }

@media (max-width: 900px) { .slot { grid-template-columns: 150px 1fr; } .slot .acts { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 720px) {
  #review { padding: 10px 14px 60px; }
  .slot { grid-template-columns: 1fr; }
  .cwrap { width: calc(50% - 5px); }
  .rv-bar input[type=search] { flex: 1 1 100%; }
  .acts .rv-btn { flex: 1 1 auto; min-height: 40px; }
  .cand .cimg { height: 90px; }
}
