:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --line: #d9e0e7;
  --text: #111827;
  --muted: #667085;
  --accent: #0f766e;
  --accent-strong: #0b625b;
  --good: #058b18;
  --good-dark: #02720f;
  --bad: #e11d12;
  --bad-dark: #bd160d;
  --focus: #2563eb;
  --shadow: 0 14px 42px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.thumbnail-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #eef2f5;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.panel-head h1 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.panel-head p {
  width: 220px;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head .eyebrow {
  width: auto;
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.head-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.plain-button,
.score-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-button {
  width: 44px;
  flex: 0 0 44px;
}

.icon-button svg,
.plain-button svg,
.score-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.icon-button:hover,
.plain-button:hover {
  border-color: #b5c0cc;
  background: #f8fafc;
}

.icon-button:focus-visible,
.plain-button:focus-visible,
.score-button:focus-visible,
.tab:focus-visible,
.thumb-item:focus-visible,
.intro-close:focus-visible,
.intro-primary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475467;
  font-size: 14px;
}

.tab.is-active {
  border-color: #c3d6d2;
  background: #e2f3ef;
  color: var(--accent-strong);
  font-weight: 700;
}

.thumb-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 12px;
}

.thumb-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 76px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 8px;
  text-align: left;
}

.thumb-item:hover {
  background: rgba(255, 255, 255, 0.72);
}

.thumb-item.is-active {
  border-color: #8abfb6;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.16);
}

.thumb-image {
  width: 96px;
  height: 62px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.thumb-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-meta {
  min-width: 0;
}

.thumb-name {
  overflow: hidden;
  color: #1f2937;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  margin-top: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e5e7eb;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.thumb-status.good {
  background: #dff6e2;
  color: #08751a;
}

.thumb-status.bad {
  background: #ffe4e0;
  color: #b42318;
}

.review-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px 28px;
}

.image-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.image-stage img {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-stage.has-image img {
  display: block;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  min-height: 360px;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
  padding: 24px;
  text-align: center;
}

.empty-state small {
  max-width: 560px;
  color: #667085;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
}

.thumb-empty {
  min-height: 120px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  font-size: 14px;
}

.image-stage.has-image .empty-state {
  display: none;
}

.rating-chip {
  position: absolute;
  top: 18px;
  left: 18px;
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(17, 24, 39, 0.76);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.scoreboard {
  display: grid;
  gap: 14px;
  padding: 18px 0 0;
  text-align: center;
}

.meta-line {
  color: #1f2937;
  font-size: 20px;
}

.meta-line strong {
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 14px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.stats div {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
}

.stats span {
  color: var(--muted);
  font-size: 14px;
}

.stats strong {
  font-size: 24px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.score-button {
  min-width: 210px;
  padding: 0 28px;
  border-color: transparent;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.score-button.correct {
  background: var(--good);
}

.score-button.correct:hover {
  background: var(--good-dark);
}

.score-button.wrong {
  background: var(--bad);
}

.score-button.wrong:hover {
  background: var(--bad-dark);
}

.plain-button {
  min-width: 150px;
  padding: 0 20px;
  font-weight: 700;
}

.score-button:disabled,
.plain-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.intro-modal[hidden] {
  display: none;
}

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.intro-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.intro-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #ffffff;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.intro-card h2 {
  margin: 0;
  color: #101828;
  font-size: 28px;
  line-height: 1.25;
}

.intro-lead {
  margin: 0;
  color: #344054;
  font-size: 16px;
  line-height: 1.7;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.intro-block {
  display: grid;
  gap: 8px;
  border: 1px solid #dfe6ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.intro-block strong {
  color: #101828;
  font-size: 15px;
}

.intro-block p,
.intro-note {
  margin: 0;
  color: #475467;
  font-size: 14px;
  line-height: 1.65;
}

.intro-block code {
  border: 1px solid #d9e0e7;
  border-radius: 6px;
  background: #ffffff;
  padding: 1px 5px;
  color: #0b625b;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.95em;
}

.intro-note {
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #edf7f5;
  padding: 12px 14px;
}

.intro-primary {
  justify-self: end;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  padding: 0 20px;
  color: #ffffff;
  font-weight: 800;
}

.intro-primary:hover {
  background: var(--accent-strong);
}

.intro-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
}

.intro-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.intro-close:hover {
  background: #f8fafc;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .thumbnail-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .thumb-list {
    grid-auto-flow: column;
    grid-auto-columns: 220px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .review-panel {
    height: auto;
    min-height: calc(100vh - 230px);
    overflow: visible;
    padding: 16px;
  }

  .image-stage img {
    max-height: 48vh;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .score-button,
  .plain-button {
    width: 100%;
  }

  .intro-card {
    padding: 22px;
  }

  .intro-card h2 {
    padding-right: 40px;
    font-size: 22px;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .intro-primary {
    width: 100%;
  }
}
