:root {
  --ink: #16211c;
  --muted: #6e7b74;
  --paper: #f3f0e8;
  --card: #fffdf7;
  --line: #d9d6cc;
  --accent: #d9542f;
  --accent-dark: #a93618;
  --green: #1f6d50;
  --shadow: 0 10px 30px rgba(29, 39, 33, .08);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login-card { width: min(420px, 100%); padding: 34px; border-radius: 16px; background: var(--card); box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.login-card h1 { color: var(--ink); font-size: 30px; letter-spacing: -.03em; }
.login-hint { margin: 10px 0 26px; color: var(--muted); }
.login-submit { width: 100%; }
.login-error { min-height: 20px; margin: 14px 0 0; color: #b42f2f; font-size: 13px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 30px max(5vw, 24px) 24px; background: var(--ink); color: white; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { color: #dcae62; font-size: 12px; font-weight: 800; letter-spacing: .2em; margin-bottom: 8px; }
.eyebrow.dark { color: var(--accent); }
.header-actions { display: flex; gap: 10px; align-items: center; color: #c9d3ce; font-size: 13px; }
.health-item { display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #dcae62; }
.dot.ok { background: #67d49e; box-shadow: 0 0 0 5px rgba(103,212,158,.12); }
.dot.error { background: #ef725f; box-shadow: 0 0 0 5px rgba(239,114,95,.12); }
nav { display: flex; gap: 8px; padding: 16px max(5vw, 24px); background: #fffdf7; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 15px; border-radius: 8px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--ink); color: white; }
main { padding: 32px max(5vw, 24px) 70px; }
.panel { display: none; }
.panel.active { display: block; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.section-title h2 { margin-bottom: 6px; font-size: 26px; }
.section-title p { margin-bottom: 0; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; padding: 10px 15px; font-weight: 750; cursor: pointer; text-decoration: none; font-size: 14px; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-dark); }
.button.ghost { border-color: var(--line); background: transparent; color: inherit; }
.button.danger { color: #b42f2f; background: #fff0ed; }
.button.small { padding: 6px 10px; font-size: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.level-chapter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.chapter-badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 7px; background: var(--ink); color: white; font-size: 12px; font-weight: 800; }
.stage-badge { display: inline-flex; align-items: center; padding: 5px 9px; border: 1px solid #e4b8a9; border-radius: 7px; background: #fff0eb; color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); min-height: 40px; font-size: 14px; line-height: 1.55; }
.meta { display: flex; gap: 16px; padding: 13px 0; margin: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.badge { display: inline-block; border-radius: 99px; padding: 4px 8px; font-size: 11px; font-weight: 800; }
.badge.on, .badge.real { color: #176144; background: #e4f4ec; }
.badge.off, .badge.ai { color: #9d371f; background: #ffebe5; }
.filter-row { margin-bottom: 18px; }
.back-button { border: 0; padding: 0; margin-bottom: 22px; background: transparent; color: var(--accent-dark); font-weight: 750; cursor: pointer; }
select, input, textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 8px; padding: 10px 12px; font: inherit; }
.filter-row select { max-width: 240px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.image-card { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.image-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #ddd; }
.previewable { cursor: zoom-in; transition: opacity .18s ease, transform .18s ease; }
.previewable:hover { opacity: .88; transform: scale(1.01); }
.image-info { padding: 14px; }
.image-info h3 { margin-bottom: 8px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-info p { color: var(--muted); font-size: 12px; height: 32px; overflow: hidden; }
.table-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); background: #f7f4ed; font-size: 12px; }
.table-thumb { width: 92px; height: 66px; object-fit: cover; border-radius: 8px; display: block; background: #ddd; }
.image-table small { display: block; margin-top: 5px; color: var(--muted); font-weight: 400; max-width: 260px; }
.result-subtext { display: block; margin-top: 4px; color: var(--muted); white-space: nowrap; }
.reason-cell { min-width: 220px; max-width: 360px; line-height: 1.5; color: #46534c; }
.url-cell { min-width: 240px; max-width: 340px; }
.url-cell a { display: block; color: var(--accent-dark); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-all; }
.level-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 150px; }
.level-tag { display: inline-block; padding: 4px 8px; border-radius: 6px; background: #eee9dc; color: #574e3c; font-size: 12px; font-weight: 700; }
.level-location-tag { display: inline-flex; flex-direction: column; gap: 3px; padding: 7px 10px; border-left: 3px solid var(--accent); }
.level-location-tag strong { color: var(--ink); font-size: 12px; }
.level-location-tag small { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.resource-table { min-width: 1320px; }
.level-edit-fields { padding-top: 4px; border-top: 1px solid var(--line); }
.edit-check { align-self: center; margin-top: 18px; }
.form-hint { margin: -8px 0 18px; color: var(--muted); font-size: 13px; }
.upload-progress { min-height: 20px; color: var(--green); font-size: 13px; font-weight: 700; }
.button:disabled { opacity: .55; cursor: wait; }
.image-preview-modal { width: auto; max-width: calc(100vw - 36px); max-height: calc(100vh - 36px); padding: 0; overflow: visible; background: transparent; box-shadow: none; }
.image-preview-modal::backdrop { background: rgba(4, 9, 7, .88); backdrop-filter: blur(5px); }
.image-preview-modal figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.image-preview-modal img { display: block; max-width: calc(100vw - 70px); max-height: calc(100vh - 100px); object-fit: contain; border-radius: 10px; box-shadow: 0 20px 70px rgba(0,0,0,.48); background: #111; }
.image-preview-modal figcaption { max-width: min(760px, calc(100vw - 70px)); color: white; font-size: 14px; text-align: center; }
.preview-close { position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(0,0,0,.32); color: white; font-size: 28px; line-height: 1; cursor: pointer; }
dialog { width: min(520px, calc(100vw - 28px)); border: 0; border-radius: 14px; padding: 0; background: var(--card); box-shadow: 0 24px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(16, 23, 19, .62); backdrop-filter: blur(3px); }
dialog form { padding: 22px; }
.result-detail-modal { width: min(1040px, calc(100vw - 28px)); max-height: calc(100vh - 28px); }
.result-detail-shell { padding: 24px; }
.result-detail-title { position: sticky; top: -24px; z-index: 3; margin: -24px -24px 20px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.result-detail-title .eyebrow { margin-bottom: 5px; }
.result-overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.result-player { display: flex; align-items: center; gap: 12px; }
.result-player img, .result-avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.result-avatar-placeholder { display: grid; place-items: center; color: white; background: var(--ink); font-weight: 800; }
.result-player strong, .result-player small { display: block; }
.result-player small { margin-top: 4px; color: var(--muted); }
.result-metrics { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.result-metrics > div, .result-info-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f9f6ef; }
.result-metrics span, .result-info-grid span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.result-metrics strong { font-size: 19px; }
.result-info-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px; }
.result-info-grid strong, .result-info-grid code { font-size: 13px; overflow-wrap: anywhere; }
.result-answer-heading { margin: 28px 0 14px; }
.result-answer-heading h4 { margin: 0 0 5px; font-size: 18px; }
.result-answer-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.result-answer-list { display: grid; gap: 12px; }
.result-answer-card { position: relative; display: grid; grid-template-columns: 150px 1fr; gap: 16px; overflow: hidden; border: 1px solid var(--line); border-left: 4px solid #aaa; border-radius: 12px; background: white; }
.result-answer-card.correct { border-left-color: var(--green); }
.result-answer-card.wrong { border-left-color: var(--accent); }
.result-question-index { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 4px 7px; border-radius: 6px; color: white; background: rgba(0,0,0,.65); font-size: 11px; font-weight: 800; }
.result-answer-image { width: 150px; height: 132px; object-fit: cover; background: #ddd; }
.result-answer-image.missing { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.result-answer-body { padding: 16px 16px 14px 0; min-width: 0; }
.result-answer-top { display: flex; justify-content: space-between; gap: 12px; }
.result-answer-types { display: flex; flex-wrap: wrap; gap: 20px; margin: 14px 0 10px; font-size: 13px; }
.result-answer-body p { margin: 0 0 8px; color: #46534c; line-height: 1.55; }
.result-answer-body small { color: var(--muted); }
.modal-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title h3 { margin: 0; }
.close { border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 15px; }
label input, label select, label textarea { margin-top: 7px; font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 8px; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: -5px 0 8px; }
#toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 12px 16px; background: var(--ink); color: white; border-radius: 9px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translateY(0); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.35); border: 1px dashed var(--line); border-radius: 12px; grid-column: 1 / -1; }
@media (max-width: 760px) {
  header { align-items: flex-start; }
  .health-item > span:last-child { display: none; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .result-metrics { grid-template-columns: repeat(2, 1fr); }
  .result-info-grid { grid-template-columns: 1fr 1fr; }
  .result-answer-card { grid-template-columns: 100px 1fr; }
  .result-answer-image { width: 100px; height: 120px; }
}
