:root {
  --bg: #07142b;
  --panel: #0d1f40;
  --line: #1d3a6b;
  --text: #e8eefb;
  --muted: #93a6c9;
  --accent: #2ea8ff;
  --warm: #ffa53d;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #13306a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  flex: none;
}
.brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button, .actions a {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  transition: border-color .15s, background .15s;
}
.actions button:hover, .actions a:hover { border-color: var(--accent); }
.actions button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.actions .primary { background: var(--accent); border-color: var(--accent); color: #041022; font-weight: 700; }
.actions .primary:hover { background: #5cbcff; }

main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  aspect-ratio: 1376 / 768;
  max-width: 100%;
  touch-action: pan-y;
}
.stage img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(7, 20, 43, .55);
  color: #fff; font-size: 28px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity .2s;
}
.stage:hover .nav, .nav:focus-visible { opacity: 1; }
.nav:disabled { visibility: hidden; }
.prev { left: 12px; }
.next { right: 12px; }
@media (hover: none) { .nav { opacity: .8; width: 40px; height: 40px; font-size: 22px; } }

.stage:fullscreen { border: 0; border-radius: 0; display: grid; place-items: center; aspect-ratio: auto; }
.stage:fullscreen img { width: 100vw; height: 100vh; }

.bar { display: flex; align-items: center; gap: 12px; padding: 12px 2px; color: var(--muted); font-size: .85rem; }
#counter { font-variant-numeric: tabular-nums; color: var(--text); min-width: 52px; }
.progress { flex: 1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
@media (max-width: 600px) { .hint { display: none; } }

.thumbs {
  list-style: none; margin: 0; padding: 4px 2px 12px;
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-color: var(--line) transparent;
}
.thumbs li { flex: none; scroll-snap-align: center; }
.thumbs button {
  display: block; padding: 0; border: 2px solid transparent; border-radius: 8px;
  overflow: hidden; background: none; cursor: pointer; opacity: .6; transition: opacity .15s, border-color .15s;
}
.thumbs button:hover { opacity: .9; }
.thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumbs img { display: block; width: 136px; height: auto; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  padding: 8px 0 24px;
}
.grid button {
  text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--panel); color: var(--text); cursor: pointer;
}
.grid button:hover { border-color: var(--accent); }
.grid img { display: block; width: 100%; height: auto; }
.grid span { display: block; padding: 8px 12px; font-size: .88rem; }
.grid b { color: var(--accent); margin-right: 6px; }

.notes {
  margin: 12px 0 40px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 31, 64, .7);
}
.notes h2 { margin: 0 0 12px; font-size: 1.2rem; letter-spacing: -0.01em; }
#noteNum { color: var(--accent); margin-right: 6px; font-variant-numeric: tabular-nums; }
.notes ul { margin: 0; padding-left: 1.2em; }
.notes li { margin: 4px 0; }
.notes li::marker { color: var(--accent); }
.notes .key { color: var(--warm); font-weight: 700; }
.notes p { margin: 12px 0 0; color: var(--muted); }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 32px; }
