:root {
  --bg: #080a0c;
  --panel: rgba(16, 19, 22, .84);
  --panel-strong: #111417;
  --text: #f5f6f2;
  --muted: #969d9b;
  --line: rgba(255, 255, 255, .11);
  --accent: #e4ff47;
  --accent-soft: rgba(228, 255, 71, .14);
  --danger: #ff6a54;
  --radius: 18px;
  --shadow: 0 30px 100px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(228,255,71,.055), transparent 38rem),
    linear-gradient(180deg, #0b0d0f 0%, #080a0c 100%);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 12px 16px; color: #090b0d; background: var(--accent); border-radius: 8px; font-weight: 800; }
.skip-link:focus { top: 12px; }
.ambient { position: fixed; z-index: -1; width: 36vw; aspect-ratio: 1; border-radius: 50%; filter: blur(110px); opacity: .07; pointer-events: none; }
.ambient-a { right: -10vw; top: -8vw; background: var(--accent); }
.ambient-b { left: 16vw; bottom: -20vw; background: #5e7cff; }

.site-header {
  height: 76px;
  padding: 0 clamp(18px, 3vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 12, .74);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-content: center; border: 1px solid rgba(245,246,242,.6); font-size: 9px; line-height: .95; letter-spacing: -.03em; font-weight: 800; }
.brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; letter-spacing: -.025em; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.icon-button, .external-button, .tool-button {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.035); padding: 0 13px;
  cursor: pointer; transition: border-color .2s, background .2s, transform .2s;
}
.icon-button:hover, .external-button:hover, .tool-button:hover { background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.2); }
.icon-button:active, .external-button:active, .tool-button:active { transform: translateY(1px); }
.external-button { font-size: 11px; font-weight: 750; letter-spacing: -.01em; }
.social-glyph { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 4px; background: #0a66c2; color: white; font: 800 12px/1 Arial, sans-serif; }
.notion-glyph { color: #0b0d0f; background: #f5f6f2; font-family: Georgia, serif; font-size: 13px; }
.linkedin-button:hover { border-color: rgba(10,102,194,.75); }
.notion-button:hover { border-color: rgba(245,246,242,.5); }

.deck-layout { min-height: calc(100svh - 76px); display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.filmstrip { position: relative; z-index: 20; padding: 24px 16px 32px; border-right: 1px solid var(--line); background: rgba(10,12,14,.52); min-height: calc(100svh - 76px); }
.filmstrip-header { padding: 0 7px 16px; display: flex; align-items: center; justify-content: space-between; }
.filmstrip-header > div { display: flex; flex-direction: column; gap: 3px; }
.filmstrip-header strong { font-size: 13px; }
.filmstrip-header span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.close-filmstrip { display: none; width: 36px; height: 36px; color: var(--muted); border: 0; background: transparent; font-size: 26px; cursor: pointer; }
.filmstrip nav { max-height: calc(100svh - 150px); overflow: auto; padding: 0 5px 60px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
.thumb-button { width: 100%; display: grid; grid-template-columns: 29px 1fr; gap: 9px; align-items: start; padding: 9px 8px; border: 1px solid transparent; background: transparent; color: inherit; text-align: left; border-radius: 11px; cursor: pointer; transition: background .2s, border-color .2s; }
.thumb-button + .thumb-button { margin-top: 3px; }
.thumb-button:hover { background: rgba(255,255,255,.04); }
.thumb-button.active { background: var(--accent-soft); border-color: rgba(228,255,71,.28); }
.thumb-number { padding-top: 4px; color: var(--muted); font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.thumb-button.active .thumb-number { color: var(--accent); }
.thumb-content { min-width: 0; }
.thumb-image { width: 100%; aspect-ratio: 16/9; display: block; object-fit: cover; border-radius: 5px; border: 1px solid rgba(255,255,255,.09); opacity: .68; transition: opacity .2s; }
.thumb-button:hover .thumb-image, .thumb-button.active .thumb-image { opacity: 1; }
.thumb-title { display: block; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bec3c0; font-size: 10px; line-height: 1.3; }
.thumb-button.active .thumb-title { color: var(--text); }

.viewer { min-width: 0; padding: 20px clamp(20px,3vw,48px) 34px; display: flex; flex-direction: column; }
.viewer-toolbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tool-button { min-height: 36px; padding: 0 10px; color: #b9bfbc; font-size: 11px; }
#menuButton { visibility: hidden; }
.slide-position { display: flex; align-items: baseline; gap: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.slide-position strong { color: var(--accent); font-size: 15px; }
.slide-position span { color: #606663; font-size: 10px; }
.toolbar-right { display: flex; gap: 8px; }

.stage-wrap { min-height: 0; flex: 1; display: grid; place-items: center; }
.stage { position: relative; width: min(100%, calc((100svh - 245px) * 16 / 9)); max-height: calc(100svh - 245px); aspect-ratio: 16/9; overflow: hidden; border-radius: var(--radius); background: #050607; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.09); isolation: isolate; }
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); border-radius: inherit; }
.stage img { width: 100%; height: 100%; display: block; object-fit: contain; opacity: 1; transition: opacity .16s ease, transform .35s cubic-bezier(.2,.8,.2,1); user-select: none; }
.stage:fullscreen { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; box-shadow: none; }
.stage.is-loading img { opacity: .22; transform: scale(.992); }
.loading-indicator { position: absolute; z-index: 3; width: 28px; height: 28px; left: calc(50% - 14px); top: calc(50% - 14px); border-radius: 50%; border: 2px solid rgba(255,255,255,.16); border-top-color: var(--accent); opacity: 0; animation: spin .8s linear infinite; }
.stage.is-loading .loading-indicator { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-hit { position: absolute; z-index: 2; top: 0; bottom: 0; width: 22%; border: 0; background: transparent; cursor: pointer; }
.stage-hit-prev { left: 0; cursor: w-resize; }
.stage-hit-next { right: 0; cursor: e-resize; }

.navigation-row { width: min(100%, 1000px); margin: 17px auto 0; display: grid; grid-template-columns: 46px minmax(0,1fr) 46px; gap: 16px; align-items: center; }
.nav-button { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.035); cursor: pointer; transition: .2s; }
.nav-button:hover:not(:disabled) { color: #0b0d0f; background: var(--accent); border-color: var(--accent); }
.nav-button:disabled { opacity: .22; cursor: default; }
.slide-label { min-width: 0; text-align: center; }
.slide-label small { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.slide-label h1 { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(15px, 1.5vw, 19px); letter-spacing: -.035em; }
.progress-track { width: min(100%, 1000px); height: 1px; margin: 15px auto 0; overflow: hidden; background: rgba(255,255,255,.08); }
.progress-bar { height: 100%; width: 5.56%; background: var(--accent); transition: width .28s ease; }
.mobile-hint { display: none; color: var(--muted); font-size: 10px; text-align: center; margin: 12px 0 0; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: 32px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 12px 16px; border: 1px solid var(--line); border-radius: 11px; background: #171b1e; box-shadow: 0 16px 50px rgba(0,0,0,.45); font-size: 12px; transition: .25s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.help-dialog { width: min(440px, calc(100vw - 32px)); color: var(--text); border: 1px solid var(--line); border-radius: 18px; background: #111417; box-shadow: var(--shadow); padding: 0; }
.help-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.dialog-heading small { color: var(--accent); font-size: 9px; letter-spacing: .16em; }
.dialog-heading h2 { margin: 6px 0 0; font-size: 21px; }
.dialog-heading button { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); font-size: 26px; cursor: pointer; }
.help-dialog dl { margin: 0; padding: 10px 24px 24px; }
.help-dialog dl div { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.065); }
.help-dialog dl div:last-child { border: 0; }
.help-dialog dt { color: var(--accent); font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.help-dialog dd { color: #b9bfbc; margin: 0; font-size: 12px; }
.noscript { margin: 30px; padding: 18px; background: #201; }
.noscript a { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1020px) {
  .deck-layout { display: block; }
  .filmstrip { position: fixed; inset: 0 auto 0 0; width: min(330px, 88vw); min-height: 100%; z-index: 60; padding-top: max(24px, env(safe-area-inset-top)); transform: translateX(-104%); transition: transform .3s cubic-bezier(.2,.8,.2,1); background: rgba(10,12,14,.97); backdrop-filter: blur(24px); box-shadow: 24px 0 80px rgba(0,0,0,.5); }
  .filmstrip.open { transform: translateX(0); }
  .filmstrip::after { content: ""; position: fixed; inset: 0 0 0 100%; width: 100vw; background: rgba(0,0,0,.54); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .filmstrip.open::after { opacity: 1; pointer-events: auto; }
  .close-filmstrip { display: block; }
  .filmstrip nav { max-height: calc(100svh - 90px); }
  #menuButton { visibility: visible; }
  .viewer { min-height: calc(100svh - 76px); }
}

@media (max-width: 680px) {
  .site-header { height: 64px; padding: 0 14px; }
  .brand { gap: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { max-width: 48vw; font-size: 13px; }
  .brand-copy small { display: none; }
  .icon-button { width: 40px; padding: 0; }
  .icon-button span { display: none; }
  .brand-copy { display: none; }
  .external-button { width: 40px; min-height: 40px; padding: 0; }
  .social-label { display: none; }
  .deck-layout { min-height: calc(100svh - 64px); }
  .viewer { min-height: calc(100svh - 64px); padding: 12px 14px 24px; }
  .viewer-toolbar { min-height: 38px; margin-bottom: 10px; }
  .keyboard-help { display: none; }
  .tool-button { font-size: 0; width: 38px; padding: 0; }
  #menuButton { font-size: 0; }
  .stage-wrap { flex: 0 0 auto; min-height: 0; margin: auto 0; }
  .stage { width: 100%; max-height: none; border-radius: 10px; }
  .stage-hit { width: 28%; }
  .navigation-row { margin-top: 18px; grid-template-columns: 42px minmax(0,1fr) 42px; gap: 10px; }
  .nav-button { width: 42px; height: 42px; }
  .slide-label h1 { font-size: 15px; }
  .progress-track { margin-top: 16px; }
  .mobile-hint { display: block; }
  .toast { bottom: max(20px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 32px); }
}

@media (max-height: 650px) and (orientation: landscape) {
  .site-header { display: none; }
  .deck-layout, .viewer { min-height: 100svh; }
  .viewer { padding: 10px 18px; }
  .viewer-toolbar { position: absolute; z-index: 10; inset: 10px 18px auto; margin: 0; pointer-events: none; }
  .viewer-toolbar button, .viewer-toolbar .slide-position { pointer-events: auto; background: rgba(5,7,8,.75); }
  .stage { width: min(100%, calc(100svh * 16 / 9)); max-height: 100svh; border-radius: 0; }
  .navigation-row, .progress-track, .mobile-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
