:root {
  color-scheme: dark;
  --bg: #080b10;
  --sidebar: #1d2028;
  --panel: #111720;
  --panel-soft: #151b26;
  --panel-head: #1a2030;
  --line: #2a3345;
  --text: #f8fafc;
  --muted: #9aa6b7;
  --blue: #243556;
  --red: #ff4b55;
  --green: #47d17f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 56px 12px 24px;
  background: var(--sidebar);
  border-right: 1px solid #252936;
}

.sidebar h2 {
  margin: 0 0 18px;
  font-size: 15px;
}

.side-form,
.debug-box {
  border: 1px solid #333949;
  border-radius: 6px;
  padding: 12px;
  background: #20242f;
}

.side-form {
  display: grid;
  gap: 12px;
}

.debug-box {
  margin-top: 14px;
}

.debug-box summary {
  cursor: pointer;
  color: #b8ffc9;
  font-weight: 700;
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #c2c9d6;
  font-size: 12px;
}

input {
  width: 100%;
  height: 34px;
  border: 1px solid #364157;
  border-radius: 5px;
  background: #111722;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

input:focus {
  border-color: #4d6aa4;
}

button {
  cursor: pointer;
}

.side-form button,
.debug-box button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.debug-box button {
  margin-top: 10px;
  background: #33394a;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status-line {
  min-height: 52px;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 6px;
  background: #214b33;
  color: #ccffd9;
  font-size: 12px;
  line-height: 1.5;
}

.status-line[data-tone="error"] {
  background: transparent;
  color: #ff5965;
  padding-left: 0;
}

.status-line[data-tone="muted"] {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
}

.status-line[data-tone="info"] {
  background: #15324d;
  color: #72bdff;
}

.status-line[data-tone="warn"] {
  background: #3b2f16;
  color: #ffd977;
}

.side-summary {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #3a3f4c;
  display: grid;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.side-summary strong {
  color: var(--text);
  font-size: 13px;
}

.content {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 80px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 108px;
  padding: 24px 28px;
  border: 1px solid #263149;
  border-radius: 14px;
  background:
    linear-gradient(105deg, rgba(255, 75, 85, 0.18), rgba(36, 53, 86, 0.72)),
    #111720;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 38%, #e6edf8 39% 48%, transparent 49%),
    linear-gradient(45deg, transparent 38%, #a9b9d6 39% 48%, transparent 49%),
    radial-gradient(circle at 50% 50%, #ff4b55 0 4px, transparent 5px);
  box-shadow: 0 0 24px rgba(255, 75, 85, 0.25);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

.hero p,
.section-caption,
.timing-line {
  color: var(--muted);
}

.hero p {
  margin-top: 10px;
  font-size: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
  max-width: 850px;
}

.tab {
  height: 40px;
  border: 1px solid #33405a;
  border-radius: 8px;
  background: #111720;
  color: #eff6ff;
  font-weight: 800;
}

.tab.active {
  border-color: #df5360;
  background: linear-gradient(90deg, rgba(255, 75, 85, 0.55), rgba(36, 53, 86, 0.85));
}

.section-block {
  margin-top: 34px;
}

.page-panel[hidden] {
  display: none;
}

.debug-section {
  border: 0;
  padding: 0;
}

.debug-section > summary {
  cursor: pointer;
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  list-style-position: inside;
}

.section-block h2 {
  font-size: 25px;
  line-height: 1.25;
}

.section-caption {
  margin-top: 18px;
  font-size: 13px;
}

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

.battle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.input-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.input-panel h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.input-panel input[type="file"] {
  display: block;
  height: auto;
  padding: 10px;
  color: var(--muted);
}

.step-card {
  margin-top: 22px;
  border: 1px solid #274875;
  border-radius: 10px;
  background: #101a2a;
  padding: 16px 18px;
}

.step-title {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 16px;
}

.step-title span {
  display: inline-grid;
  place-items: center;
  min-width: 68px;
  height: 30px;
  border-radius: 7px;
  background: #3b7ee8;
  color: #fff;
  font-weight: 900;
}

.step-card ol {
  margin: 12px 0 0 96px;
  color: #e9f2ff;
  line-height: 1.8;
  font-weight: 700;
}

.direction-detail-panel {
  margin-top: 28px;
}

.direction-detail-panel h3 {
  margin: 0 0 18px;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
}

.direction-metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.compact-table table {
  font-size: 13px;
}

.compact-table th,
.compact-table td {
  padding: 12px 10px;
  white-space: nowrap;
}

.notice {
  margin-top: 18px;
  border-radius: 8px;
  background: #15324d;
  color: #4ab0ff;
  padding: 14px 16px;
  font-weight: 800;
}

.notice.secondary {
  margin-top: 0;
  margin-bottom: 14px;
  background: #142d46;
}

.key-help {
  margin: -6px 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #7c93a8;
}

.key-help .linkish {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: #4ab0ff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.key-help .linkish:disabled { opacity: 0.5; cursor: default; }

/* 허수 평균의 DPS 폭이 어디서 왔는지 설명하는 줄 */
.dummy-basis-note {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #15324d;
  color: #9fc4e6;
  font-size: 13px;
  line-height: 1.75;
}

.dummy-basis-note strong { color: #4ab0ff; }
.dummy-basis-note .muted { color: #7c93a8; }

.debug-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #7c93a8;
}

.runtime-status { display: block; margin-top: 4px; }
.runtime-status[data-status="loading"] { color: #7c93a8; }
.runtime-status[data-status="ready"] { color: #5ad18b; }
.runtime-status[data-status="error"] { color: #ff8080; }

.direct-api-result { display: block; margin-top: 4px; }
.direct-api-result[data-status="ok"] { color: #5ad18b; }
.direct-api-result[data-status="auth"],
.direct-api-result[data-status="http"] { color: #f0c674; }
.direct-api-result[data-status="cors"],
.direct-api-result[data-status="network"],
.direct-api-result[data-status="nokey"] { color: #ff8080; }

/* 해상도 안내: 파랑 정보 알림과 구분되도록 금색 계열 */
.notice.warn {
  background: #3a2f12;
  color: #f0c674;
  font-weight: 600;
  line-height: 1.65;
}

.notice.warn strong {
  color: #ffd98a;
  font-weight: 800;
}

.notice.warn .needs-check-badge {
  display: inline-block;
  vertical-align: baseline;
  margin: 0 2px;
}

.ocr-debug-panel {
  margin-top: 12px;
  border: 1px solid #2b4265;
  border-radius: 8px;
  background: #0b1220;
  padding: 12px;
  color: #cfe0f7;
  font-size: 12px;
}

.ocr-debug-panel strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 13px;
}

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

.ocr-debug-grid span {
  min-height: 42px;
  border: 1px solid #22344f;
  border-radius: 7px;
  background: #111a29;
  padding: 8px 10px;
}

.ocr-debug-grid b {
  display: block;
  margin-bottom: 4px;
  color: #84b7ff;
  font-size: 11px;
}
.ocr-debug-overlays {
  margin: 8px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ocr-debug-overlays > strong { color: #84b7ff; }
.ocr-overlay-legend { font-size: 11px; color: #9aa7bd; }
.ocr-overlay { margin: 0; }
.ocr-overlay figcaption { font-size: 11px; color: #9aa7bd; margin-bottom: 3px; }
.ocr-overlay img {
  max-width: 100%;
  height: auto;
  border: 1px solid #2a3550;
  border-radius: 4px;
  display: block;
}

.ocr-debug-note {
  margin-top: 10px;
  color: #9ee7b2;
  font-weight: 700;
}

.ocr-debug-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}

.ocr-debug-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.ocr-debug-table th,
.ocr-debug-table td {
  border-top: 1px solid #22344f;
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

.ocr-debug-table th {
  color: #84b7ff;
  background: #101a2a;
  font-size: 11px;
}

.ocr-warning-panel {
  margin-top: 18px;
  border: 1px solid #d39b32;
  border-radius: 8px;
  background: #2b210d;
  color: #ffe7a6;
  padding: 14px 16px;
}

.ocr-warning-panel strong {
  display: block;
  margin-bottom: 8px;
  color: #fff0bd;
  font-size: 15px;
}

.ocr-warning-panel ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.ocr-warning-panel li + li {
  margin-top: 4px;
}

.preset-card {
  margin-top: 22px;
  border: 1px solid #315681;
  border-radius: 8px;
  background: #101f34;
  padding: 22px 24px;
  color: #e9f2ff;
}

.preset-card h3 {
  margin: 0 0 20px;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.preset-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.preset-badge {
  display: inline-grid;
  min-width: 72px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: #3b7ee8;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.preset-badge.arcana {
  background: #8b5cf6;
}

.preset-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.preset-card p {
  color: #c9d3e2;
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 800;
}

.preset-card p:last-child {
  margin-bottom: 0;
}

.preset-card b {
  color: #ffd66b;
}

.preset-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 22px;
  padding-left: 18px;
  color: #f5f8ff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.preset-list li::marker {
  color: #fff;
}

.preset-example {
  margin-top: 18px;
  border: 1px solid #3a4356;
  border-radius: 8px;
  background: #11151d;
  overflow: hidden;
}

.preset-example summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: #e9f2ff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}

.preset-example-body {
  border-top: 1px solid #2d3445;
  padding: 14px;
  background: #0d1118;
}

.preset-example img {
  display: block;
  width: 100%;
  max-height: 860px;
  object-fit: contain;
  border-radius: 6px;
}
}

.preset-chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.preset-chip-grid span {
  min-height: 34px;
  display: flex;
  align-items: center;
  border: 1px solid #33445f;
  border-radius: 6px;
  background: #151d2a;
  color: #edf5ff;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.preset-foot {
  margin-top: 12px !important;
  color: #6bb6ff !important;
  font-weight: 800;
}

.arcana-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  border-top: 1px solid #2d3749;
  padding-top: 16px;
}

.arcana-note[hidden] {
  display: none;
}

.arcana-note p {
  margin: 0;
  color: #fde68a !important;
  font-weight: 900;
}

.capture-panel {
  margin-top: 18px;
  border: 1px solid #343b4d;
  border-radius: 10px;
  background: #0f141d;
  padding: 16px;
}

.capture-panel h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.capture-panel p {
  color: #c9d3e2;
  font-size: 13px;
  line-height: 1.55;
}

.capture-buttons,
.capture-targets {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.capture-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.capture-targets {
  grid-template-columns: minmax(0, 1fr) 84px;
}

.capture-buttons button,
.capture-targets button,
.recognize-button {
  height: 40px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: #2d6df0;
  font-weight: 900;
}

.capture-buttons button:nth-child(2) {
  background: #244996;
}

.capture-targets button {
  background: #26344a;
}

.capture-targets button[data-capture-shot] {
  background: #33465f;
}

.capture-targets button[data-capture-shot].captured {
  background: #16a34a;
}

.capture-targets .capture-cancel {
  background: #7f1d1d;
}

.capture-targets .capture-cancel:disabled {
  background: #2b303a;
  color: #6f7b8d;
  cursor: default;
}

.recognize-button {
  width: 100%;
  height: 48px;
  margin-top: 14px;
  background: #263241;
  color: #c7ced8;
  cursor: not-allowed;
  opacity: 0.72;
}

.recognize-button.ready:not(:disabled) {
  background: #2d6df0;
  color: #fff;
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(120, 170, 255, 0.24), 0 10px 24px rgba(45, 109, 240, 0.22);
}

.recognize-button:disabled {
  background: #263241;
  color: #8c96a6;
  cursor: not-allowed;
  opacity: 0.62;
}

.capture-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #252c3a;
  margin-top: 10px;
}

.capture-progress > div {
  width: 0%;
  height: 100%;
  background: #4da3ff;
  transition: width 0.18s ease;
}

.capture-progress.busy > div {
  background: linear-gradient(90deg, #4da3ff 0%, #80c7ff 48%, #2d6df0 100%);
  box-shadow: 0 0 18px rgba(77, 163, 255, 0.45);
}

.capture-status {
  display: block;
  margin-top: 10px;
  color: #9fb0c8;
  font-size: 12px;
}

.capture-log {
  max-height: 190px;
  overflow: auto;
  margin: 10px 0 0;
  border: 1px solid #253047;
  border-radius: 8px;
  background: #080d18;
  color: #cfe2ff;
  padding: 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.capture-warning {
  margin-top: 10px;
  color: #ff626c !important;
  font-weight: 800;
}

.capture-warning[data-ready="true"] {
  color: #47d17f !important;
}

.capture-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.capture-preview-hint { color: #8595ad; font-size: 12px; margin: 12px 0 2px; }

.capture-preview-grid .cap-cell {
  margin: 0;
  border: 1px solid #273247;
  border-radius: 8px;
  background: #111722;
  overflow: hidden;
}

.capture-preview-grid .cap-frame {
  position: relative;
  background: #090d14;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}

.capture-preview-grid .cap-img {
  display: block;
  width: 100%;
  min-height: 90px;
  max-height: 260px;
  object-fit: contain;
  background: #090d14;
  cursor: zoom-in;
}
.capture-preview-grid .cap-img.cap-empty { cursor: default; opacity: 0.25; min-height: 90px; }

.capture-preview-grid .cap-prev,
.capture-preview-grid .cap-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 46px; border: 0; border-radius: 6px;
  background: rgba(10,14,22,0.62); color: #dfe8f5; font-size: 22px; line-height: 1;
  cursor: pointer;
}
.capture-preview-grid .cap-prev { left: 6px; }
.capture-preview-grid .cap-next { right: 6px; }
.capture-preview-grid .cap-prev:hover,
.capture-preview-grid .cap-next:hover { background: rgba(20,28,44,0.9); }
.capture-preview-grid .cap-count {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(10,14,22,0.7); color: #cdd8ea; font-size: 11px;
  padding: 2px 7px; border-radius: 10px;
}

.capture-preview-grid figcaption { padding: 8px 10px; color: #a8b7cc; font-size: 12px; }
.capture-preview-grid .cap-mode {
  margin-left: 6px; font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: #22304a; color: #8fb6ff;
}
.capture-preview-grid .cap-mode:empty { display: none; }
.capture-preview-grid .cap-mode-toggle { cursor: pointer; }
.capture-preview-grid .cap-mode-toggle:hover { background: #2c4570; color: #cfe0ff; }

/* 클릭 확대 라이트박스 */
.cap-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(4,7,12,0.92);
  display: flex; align-items: center; justify-content: center;
}
.cap-lightbox[hidden] { display: none; }
.cap-lightbox .cap-lb-img {
  max-width: 94vw; max-height: 88vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.cap-lightbox .cap-lb-close {
  position: absolute; top: 16px; right: 20px;
  width: 44px; height: 44px; border: 0; border-radius: 8px;
  background: rgba(30,38,54,0.85); color: #fff; font-size: 26px; cursor: pointer;
}
.cap-lightbox .cap-lb-prev,
.cap-lightbox .cap-lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 84px; border: 0; border-radius: 10px;
  background: rgba(30,38,54,0.7); color: #fff; font-size: 40px; cursor: pointer;
}
.cap-lightbox .cap-lb-prev { left: 24px; }
.cap-lightbox .cap-lb-next { right: 24px; }
.cap-lightbox .cap-lb-caption {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #dfe8f5; font-size: 14px; background: rgba(10,14,22,0.7);
  padding: 6px 14px; border-radius: 12px;
}

.share-video {
  display: block;
  width: 100%;
  max-height: 245px;
  margin-top: 12px;
  border-radius: 8px;
  background: #000;
  object-fit: contain;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.result-cards {
  margin-top: 22px;
}

.result-guide {
  margin-top: 18px;
}

.result-subtabs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  border-bottom: 1px solid #313847;
}

.result-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-heading {
  margin: 26px 0 0;
  font-size: 24px;
}

.profile-card {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px 18px;
}

.profile-card span {
  display: block;
  color: #a8c4ff;
  font-size: 12px;
}

.profile-card strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.12;
  word-break: break-word;
}

.timing-line {
  margin-top: 14px;
  min-height: 20px;
  font-size: 12px;
}

.table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: auto;
}

.review-tabs {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  border-bottom: 1px solid #313847;
}

.review-tab {
  height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #e5e7eb;
  font-weight: 800;
  padding: 0 16px;
}

.review-tab.active {
  color: #ff6b72;
  border-bottom-color: #ff4b55;
}

.review-panel {
  margin-top: 26px;
}

.review-panel[hidden] {
  display: none;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f141d;
  padding: 14px;
}

.battle-summary-cards {
  margin: 12px 0 18px;
}

.recompute-button {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid rgba(82, 104, 140, 0.72);
  border-radius: 8px;
  background: rgba(18, 25, 38, 0.92);
  color: #dbeafe;
  font-weight: 800;
  cursor: pointer;
}

.recompute-button:hover {
  border-color: rgba(255, 78, 88, 0.8);
  color: #fff;
}

.special-panel {
  margin-top: 24px;
}

.special-panel h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.special-panel p {
  margin: 0 0 14px;
  color: var(--muted);
}

.review-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: #292d38;
  color: #eaf1fb;
  padding: 0 8px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap.compact {
  max-height: none;
  overflow: visible;
}

.review-panel .table-wrap {
  overflow: visible;
}

#realReviewTable,
#dummyReviewTable {
  min-width: 0;
  table-layout: fixed;
}

#realReviewTable th,
#realReviewTable td,
#dummyReviewTable th,
#dummyReviewTable td {
  padding: 6px 5px;
  font-size: 11px;
  white-space: nowrap;
}

#realReviewTable th,
#dummyReviewTable th {
  position: static;
  line-height: 1.1;
  font-size: 10px;
}

#realReviewTable th:first-child,
#realReviewTable td:first-child,
#dummyReviewTable th:first-child,
#dummyReviewTable td:first-child {
  width: 15%;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #252e3d;
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-head);
  color: #dbeafe;
  white-space: nowrap;
}

td {
  color: #edf2f7;
  font-weight: 650;
  line-height: 1.35;
}

td:not(:first-child) {
  text-align: left;
}

.empty-cell {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 20px;
  }

  .content {
    width: min(100% - 28px, 1120px);
    padding: 28px 0 56px;
  }

  .tabs,
  .profile-grid,
  .battle-grid,
  .mini-grid,
  .capture-buttons,
  .capture-targets,
  .capture-preview-grid,
  .preset-head,
  .preset-chip-grid,
  .arcana-note,
  .metric-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .step-card ol {
    margin-left: 22px;
  }

  .hero {
    align-items: flex-start;
  }

  h1 {
    font-size: 24px;
  }
}

/* ── 결과 탭: 스킬명 줄바꿈 정리(한글 음절 중간에서 안 쪼개지게) ── */
td {
  word-break: keep-all;
  overflow-wrap: normal;
}
#resultTable td:first-child,
#skillShareTable td:first-child,
#skillShareTable th:first-child {
  white-space: nowrap;
}

/* ── 도움말(?) 툴팁 ── */
.hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 50%;
  border: 1px solid rgba(168, 196, 255, 0.55);
  color: #a8c4ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  user-select: none;
  flex: 0 0 auto;
}
.hint:hover {
  background: rgba(168, 196, 255, 0.18);
  color: #dbeafe;
}
.hint[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-width: 78vw;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(120, 150, 200, 0.4);
  background: #0d1420;
  color: #e8f0fc;
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  word-break: keep-all;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 50;
  pointer-events: none;
}
.hint[data-tip]:hover::after,
.hint[data-tip].tip-open::after {
  opacity: 1;
  visibility: visible;
}
.card-label {
  display: flex;
  align-items: center;
  color: #a8c4ff;
  font-size: 12px;
}
.card-label > span:first-child {
  display: inline;
}

/* ── 치적 시너지 인원 수 입력 ── */
.synergy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  flex-wrap: wrap;
}
.synergy-row label {
  display: inline-flex;
  align-items: center;
  color: #dbeafe;
  font-weight: 700;
  font-size: 14px;
}
.synergy-row input {
  width: 88px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #292d38;
  color: #eaf1fb;
  padding: 0 10px;
  font-weight: 700;
  font-size: 14px;
}
.synergy-note {
  color: var(--muted);
  font-size: 12px;
}

/* ── 확률 효과 보정 ── */
.probability-panel {
  margin-top: 22px;
}
.probability-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── 스킬별 피해 지분 + 핵심 지표 (세로로 쌓기) ── */
.share-metrics-panel {
  margin-top: 24px;
}
.share-metrics-panel .metrics-block {
  margin-top: 26px;
}
.share-chart {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.share-bar-row {
  display: grid;
  grid-template-columns: 132px 1fr 168px;
  align-items: center;
  gap: 10px;
}
.share-bar-name {
  font-size: 12px;
  color: #cfe0ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-bar-track {
  position: relative;
  height: 16px;
  border-radius: 5px;
  background: rgba(120, 150, 200, 0.14);
  overflow: hidden;
}
.share-bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #4b83ff, #6ea8ff);
}
.share-bar-val {
  font-size: 11px;
  color: #9fb6dc;
  white-space: nowrap;
}

/* ── 결과표 다운로드 버튼 ── */
.result-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.result-downloads {
  display: flex;
  gap: 10px;
}
.ghost-button {
  border: 1px solid rgba(82, 104, 140, 0.72);
  border-radius: 8px;
  background: rgba(18, 25, 38, 0.92);
  color: #dbeafe;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
}
.ghost-button:hover {
  border-color: rgba(255, 78, 88, 0.8);
  color: #fff;
}

/* ── 결과/개선분석 서브탭 + 다운로드 버튼 ── */
.result-subtabs {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.result-subtabs-left {
  display: flex;
  gap: 18px;
}
.primary-download {
  margin-bottom: 6px;
  border-color: rgba(255, 78, 88, 0.55);
  background: rgba(255, 78, 88, 0.14);
  color: #ffd9db;
}
.primary-download:hover {
  background: rgba(255, 78, 88, 0.24);
}

/* ── 디버그 모드 토글 (기본 OFF, 일반 사용자 화면) ── */
.debug-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  color: #a8c4ff;
  font-size: 13px;
  cursor: pointer;
}
.debug-toggle input {
  width: 15px;
  height: 15px;
}
body[data-debug="off"] .debug-box,
body[data-debug="off"] .ocr-debug-panel,
body[data-debug="off"] .debug-only {
  display: none !important;
}

/* ── 이미지 인식 테스트 ── */
.icontest-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.icontest-tune {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a8c4ff;
  font-size: 12px;
}
.icontest-tune input {
  width: 74px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #292d38;
  color: #eaf1fb;
  padding: 0 8px;
  font-weight: 700;
}
.icontest-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.icontest-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}
.icontest-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--line);
  image-rendering: pixelated;
  flex: 0 0 auto;
  background: #0d1420;
}
.icontest-body {
  flex: 1;
  min-width: 0;
}
.icontest-name {
  font-size: 15px;
  color: #eaf1fb;
}
.icontest-cands {
  margin-top: 5px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.icontest-cand {
  font-size: 11px;
  color: #9fb6dc;
  border: 1px solid rgba(120, 150, 200, 0.3);
  border-radius: 5px;
  padding: 2px 6px;
}
.icontest-cand.best {
  color: #cfe0ff;
  border-color: rgba(75, 131, 255, 0.6);
  background: rgba(75, 131, 255, 0.12);
}
.icontest-cells {
  margin-top: 6px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #cbd8ef;
}
.icontest-cell b {
  color: #a8c4ff;
  font-weight: 600;
}
.row-warn {
  color: #ff9a3c;
}
.icontest-overlay {
  margin-top: 12px;
}
.icontest-overlay img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}

/* ── 231 포식자 전용 계산기 ── */
.predator231-panel {
  margin-top: 8px;
}
.pred231-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.pred231-inputs-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.pred231-inputs-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.pred231-field select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #292d38;
  color: #eaf1fb;
  padding: 0 10px;
  font-weight: 700;
  font-size: 14px;
}
.pred231-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
}
.pred231-field > span {
  display: flex;
  align-items: center;
  color: #a8c4ff;
  font-size: 12px;
}
.pred231-field input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #292d38;
  color: #eaf1fb;
  padding: 0 10px;
  font-weight: 700;
  font-size: 15px;
}
.pred231-readout strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}
.pred231-subtitle {
  margin: 20px 0 0;
  font-size: 15px;
  color: #cbd8ef;
}
.pred231-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(75, 131, 255, 0.35);
  background: rgba(75, 131, 255, 0.1);
  color: #cfe0ff;
  font-size: 13px;
  line-height: 1.5;
}
.pred231-highlights {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}
.pred231-hl strong {
  font-size: 24px;
}
.pred231-hl small {
  display: block;
  margin-top: 6px;
  color: #9fb6dc;
  font-size: 11px;
  line-height: 1.4;
}
.pred231-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.pred231-chart {
  position: relative;
}
.pred231-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(120, 150, 200, 0.5);
  background: #0d1420;
  color: #e8f0fc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}
.pred231-charts figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
}
.pred231-charts figcaption {
  color: #cbd8ef;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.pred231-chart {
  width: 100%;
}
.pred231-chart-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 40px 0;
  text-align: center;
}
.pred231-details {
  margin-top: 18px;
}
.pred231-details > summary {
  cursor: pointer;
  color: #cbd8ef;
  font-weight: 700;
  padding: 10px 0;
}

@media (max-width: 980px) {
  .probability-grid {
    grid-template-columns: 1fr;
  }
  .share-bar-row {
    grid-template-columns: 92px 1fr 120px;
  }
  .pred231-inputs,
  .pred231-inputs-4,
  .pred231-highlights,
  .pred231-charts {
    grid-template-columns: 1fr;
  }
}

/* ── 이미지 인식 신뢰도 미달 값: '확인 필요' 강조 ────────────────────────── */
/* 글리프 게이트를 통과 못 해 폴백으로 채운 값. 사용자가 게임 화면과 대조해야 한다. */
input.needs-check {
  border-color: #d9a441 !important;
  background: rgba(217, 164, 65, 0.10) !important;
  box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.18);
}
.needs-check-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #1b1405;
  background: #d9a441;
  vertical-align: middle;
  cursor: help;
}
