:root {
  color-scheme: dark;
  --bg: #0b100d;
  --panel: #141c17;
  --ink: #f7fff4;
  --muted: #aebdb3;
  --green: #68d45a;
  --blue: #55dde5;
  --amber: #f3b64a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; overflow-x: hidden; }
button, a { font: inherit; }
button { color: inherit; }

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 72px;
  background:
    radial-gradient(circle at 16% 20%, rgba(104, 212, 90, 0.09), transparent 27rem),
    radial-gradient(circle at 86% 75%, rgba(85, 221, 229, 0.07), transparent 28rem),
    var(--bg);
}

.topbar, .controls { width: min(1500px, calc(100% - 40px)); margin: 0 auto; display: flex; align-items: center; }
.topbar { justify-content: space-between; border-bottom: 1px solid #26342b; }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 14px; font-weight: 750; cursor: pointer; }
.pixels { display: flex; gap: 4px; }
.pixels i { display: block; width: 11px; height: 11px; background: var(--green); }
.pixels i:nth-child(2) { background: var(--blue); }
.pixels i:nth-child(3) { background: var(--amber); }
.top-actions { display: flex; align-items: center; gap: 20px; }
.mode-label { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.download { color: var(--bg); background: var(--green); text-decoration: none; padding: 9px 15px; font-size: 13px; font-weight: 750; }

.viewer { min-height: 0; display: grid; place-items: center; gap: 18px; padding: 22px 24px 12px; }
.viewer.with-notes { grid-template-columns: minmax(0, 1fr) 340px; width: min(1500px, 100%); margin: 0 auto; }
.stage { position: relative; width: min(100%, calc((100dvh - 188px) * 16 / 9)); aspect-ratio: 16 / 9; box-shadow: 0 24px 65px rgba(0, 0, 0, 0.42); background: #101613; overflow: hidden; }
.with-notes .stage { width: min(100%, calc((100dvh - 188px) * 16 / 9)); }
.stage img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.edge { position: absolute; top: 0; bottom: 0; width: 11%; border: 0; background: transparent; color: transparent; font-size: 52px; cursor: pointer; transition: 160ms ease; }
.edge:hover:not(:disabled), .edge:focus-visible { color: white; background: linear-gradient(90deg, rgba(0,0,0,.34), transparent); }
.edge:disabled { cursor: default; }
.edge.previous { left: 0; }
.edge.next { right: 0; }
.edge.next:hover:not(:disabled), .edge.next:focus-visible { background: linear-gradient(270deg, rgba(0,0,0,.34), transparent); }

.notes { align-self: stretch; max-height: calc(100dvh - 188px); background: var(--panel); border: 0; border-left: 5px solid var(--green); padding: 28px; overflow: auto; }
.notes-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.notes-heading span { display: block; color: var(--green); font-size: 13px; font-weight: 800; margin-bottom: 9px; }
.notes-heading strong { display: block; font-size: 22px; line-height: 1.3; }
.notes-heading b { color: var(--blue); white-space: nowrap; font-size: 13px; }
.notes p { color: #d8e2db; font-size: 17px; line-height: 1.9; margin: 26px 0 0; }

.controls { gap: 20px; border-top: 1px solid #26342b; position: relative; }
.page-count { border: 0; background: transparent; min-width: 72px; color: var(--muted); cursor: pointer; }
.page-count:hover, .page-count:focus-visible { color: var(--green); }
.progress { flex: 1; height: 4px; background: #253229; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); transition: width 220ms ease; }
.control-actions { display: flex; align-items: center; gap: 8px; }
.control-actions button { border: 1px solid #34463a; background: transparent; padding: 9px 13px; font-size: 13px; cursor: pointer; }
.control-actions button:hover:not(:disabled), .control-actions button.selected { border-color: var(--blue); color: var(--blue); }
.control-actions button.primary { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 800; }
.control-actions button:disabled { opacity: .3; cursor: default; }
.shortcut { position: fixed; left: 50%; bottom: 9px; transform: translateX(-50%); color: #69786e; font-size: 10px; pointer-events: none; }

.overview { width: min(1240px, calc(100vw - 40px)); max-height: calc(100dvh - 40px); border: 1px solid #35483b; padding: 24px; color: var(--ink); background: #0d1410; box-shadow: 0 30px 110px rgba(0,0,0,.7); }
.overview::backdrop { background: rgba(1, 5, 3, .86); backdrop-filter: blur(8px); }
.overview-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.overview-head span { color: var(--green); font-size: 12px; letter-spacing: .15em; }
.overview-head h2 { margin: 4px 0 0; font-size: 24px; }
.overview-head button { border: 0; background: transparent; font-size: 34px; line-height: 1; cursor: pointer; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.overview-card { border: 1px solid #2c3d31; background: #121a15; padding: 0; text-align: left; cursor: pointer; overflow: hidden; }
.overview-card:hover, .overview-card:focus-visible, .overview-card.active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.overview-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.overview-card span { display: flex; gap: 9px; align-items: baseline; min-height: 56px; padding: 10px 12px; font-size: 13px; line-height: 1.35; }
.overview-card b { color: var(--green); font-size: 11px; }
.overview-tip { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .shell { grid-template-rows: 56px minmax(0, 1fr) auto; }
  .mode-label { display: none; }
  .viewer, .viewer.with-notes { display: flex; flex-direction: column; justify-content: center; width: 100%; padding: 14px; }
  .stage, .with-notes .stage { width: 100%; }
  .notes { width: 100%; max-height: 220px; border-left: 0; border-top: 5px solid var(--green); padding: 18px; }
  .controls { width: calc(100% - 24px); min-height: 64px; padding: 8px 0; gap: 10px; flex-wrap: wrap; }
  .progress { order: -1; flex-basis: 100%; }
  .control-actions { margin-left: auto; }
  .control-actions button:nth-of-type(3), .control-actions button:nth-of-type(4) { display: none; }
  .shortcut { display: none; }
  .overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .brand span:last-child { font-size: 14px; }
  .download { padding: 7px 10px; }
  .topbar { width: calc(100% - 24px); }
  .viewer { min-height: auto; }
  .notes p { font-size: 15px; line-height: 1.7; }
  .overview { width: 100vw; max-height: 100dvh; border: 0; padding: 16px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .overview-card span { min-height: 50px; padding: 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
