:root {
  --paper: #F1F2F4; --ink: #14171C; --muted: #5E6672; --soft: #3A414B; --rule: #D9DCE1; --line: #C9CED5;
  --move: 0.38s;   /* 카드 이동 */
  --fade: 0.26s;   /* 나타남 · 사라짐 */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; color: var(--ink); overflow-x: hidden;
  font: 400 16px/1.6 'Gothic A1', system-ui, sans-serif;
  word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid #2456C8; outline-offset: 3px; }
.modal :focus-visible { outline-color: #fff; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.two-lines { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

/* ---------- 첫 화면 ---------- */
.home {
  max-width: 1200px; min-height: 100vh; margin: 0 auto; padding: 28px 24px 40px;
  transform-origin: 50% 300px; transition: transform var(--move) var(--ease);
}
.home.behind { transform: scale(0.975); }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; min-height: 50px; }
.top h1 { margin: 0; font-size: 18px; line-height: 1; font-weight: 800; letter-spacing: -0.01em; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: rgba(20, 23, 28, 0);
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background var(--fade), color var(--fade), border-color var(--fade);
}
.chips button span { opacity: 0.7; font-weight: 400; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.views { position: relative; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #E1E4E8; }
.views button { position: relative; width: 44px; height: 44px; border: 0; border-radius: 9px; background: none; cursor: pointer; display: grid; place-items: center; }
.thumb {
  position: absolute; left: 3px; top: 3px; width: 44px; height: 44px; border-radius: 9px; background: #fff;
  box-shadow: 0 1px 3px rgba(20, 23, 28, 0.18); transition: transform var(--fade) var(--ease);
}

main { padding-top: 56px; transition: padding-top var(--move) var(--ease); }
main.flat { padding-top: 36px; }
/* 선반에서 옆으로 나간 카드가 페이지를 가로로 늘리지 않게 여기서 자른다 (위아래는 그림자 자리만큼 여유) */
.stage-clip { overflow: hidden; padding: 44px 8px; margin: -44px -8px; }
.stage { position: relative; height: 336px; perspective: 1400px; border-radius: 8px; transition: height var(--move) var(--ease); }

.card {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer;
  box-shadow: inset 0 -1px 0 transparent;
  transition: transform var(--move) var(--ease), opacity var(--fade), width var(--move) var(--ease), height var(--move) var(--ease), box-shadow var(--fade);
}
.card .pic { position: absolute; display: block; transition: left var(--move) var(--ease), top var(--move) var(--ease), width var(--move) var(--ease), height var(--move) var(--ease); }
.card .pic img, .card .pic .initial { display: block; width: 100%; height: 100%; border-radius: 10px; object-fit: cover; transition: transform 0.2s ease, box-shadow var(--fade), border-radius var(--move); }
.card .pic .initial { display: grid; place-items: center; color: #fff; font-weight: 800; }
.no-anim, .no-anim * { transition: none !important; }
.card:hover .pic img, .card:hover .pic .initial { transform: translateY(-3px); }
.pixel { image-rendering: pixelated; }
.badge {
  position: absolute; border-radius: 50%; background: rgba(20, 23, 28, 0.82); color: #fff; display: grid; place-items: center;
  transition: top var(--move) var(--ease), right var(--move) var(--ease), width var(--move) var(--ease), height var(--move) var(--ease);
}
.badge svg { width: 56%; height: 56%; }
.card .label { position: absolute; display: flex; flex-direction: column; gap: 2px; transition: left var(--move) var(--ease), top var(--move) var(--ease), width var(--move) var(--ease), opacity var(--fade); }
.card .label b { font-size: 16px; line-height: 22px; font-weight: 700; }
.card .label i { font-style: normal; font-size: 13px; line-height: 18px; color: var(--muted); }
.card .cols { position: absolute; right: 8px; top: 26px; display: flex; font-size: 14px; line-height: 20px; color: var(--soft); transition: opacity var(--fade); }
.card .cols span:nth-child(1) { width: 64px; }
.card .cols span:nth-child(2) { width: 84px; font-variant-numeric: tabular-nums; }
.card .cols span:nth-child(3) { width: 48px; text-align: right; }

.info { display: flex; flex-direction: column; align-items: center; text-align: center; max-height: 260px; overflow: hidden; padding-top: 8px; transition: max-height var(--move) var(--ease), opacity var(--fade), visibility var(--move); }
.info.off { max-height: 0; opacity: 0; visibility: hidden; padding-top: 0; }
.info-meta { margin: 0; height: 20px; max-width: 100%; font-size: 14px; line-height: 20px; color: var(--muted); }
.info-name { margin: 8px 0 0; height: 48px; max-width: 100%; font-size: 40px; line-height: 48px; font-weight: 800; letter-spacing: -0.02em; }
.info-tagline { margin: 8px 0 0; height: 52px; max-width: 30em; font-size: 16px; line-height: 26px; color: var(--soft); }
.info-nav { display: flex; align-items: center; gap: 12px; padding-top: 16px; }
.round { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: none; cursor: pointer; display: grid; place-items: center; }
.pill { min-height: 44px; padding: 0 28px; border-radius: 22px; border: 0; background: var(--ink); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
.info-pos { margin: 10px 0 0; height: 18px; font-size: 13px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.swap { animation: rise-in 0.22s var(--ease) both; }
.empty { margin: 80px auto; max-width: 28em; text-align: center; color: var(--muted); }

/* ---------- 진입 연출: 가운데 로고 → 제자리, 표지가 아래에서 올라옴 ---------- */
.splash { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--paper); transition: background 0.3s ease; pointer-events: none; }
.splash span { font-size: 34px; line-height: 1; font-weight: 800; letter-spacing: -0.01em; transform-origin: 0 0; animation: fade-in 0.35s ease both; }
.skip-intro .splash { display: none; }
html:not(.skip-intro) #logo { visibility: hidden; }
html:not(.skip-intro) .tools, html:not(.skip-intro) .info { opacity: 0; }
html:not(.skip-intro) .card { visibility: hidden; }
html.intro-go #logo { visibility: hidden; }
html.intro-go .tools, html.intro-go .info:not(.off) { opacity: 1; transition: opacity 0.4s 0.25s ease; }
html.intro-go .card { visibility: visible; animation: card-up 0.55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 55ms + 120ms); }
html.intro-done #logo { visibility: visible; }
@keyframes card-up { from { translate: 0 90px; opacity: 0; } }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; color: #fff; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: default; background: rgba(20, 23, 28, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade-in var(--fade) ease both; }
.panel { position: relative; width: min(960px, calc(100% - 32px)); height: 600px; display: flex; border-radius: 20px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7); animation: panel-in 0.32s var(--ease) both; }
.modal.closing .backdrop { animation: fade-out 0.2s ease both; }
.modal.closing .panel { animation: panel-out 0.2s ease both; }
.rise { animation: rise-in 0.3s 0.08s var(--ease) both; }
.m-left { width: 360px; flex: none; padding: 32px; display: flex; flex-direction: column; }
.m-cover { position: relative; display: block; flex: none; width: 296px; height: 296px; transform-origin: 0 0; }
.m-cover img, .m-initial { display: block; width: 100%; height: 100%; border-radius: 12px; object-fit: cover; box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8); }
.m-initial { display: grid; place-items: center; font-size: 120px; font-weight: 800; background: rgba(255, 255, 255, 0.12); }
.m-cover .badge { top: 10px; right: 10px; width: 30px; height: 30px; }
.m-name { margin: 20px 0 0; height: 34px; font-size: 26px; line-height: 34px; font-weight: 800; letter-spacing: -0.02em; }
.m-meta { margin: 4px 0 0; height: 20px; font-size: 14px; line-height: 20px; color: rgba(255, 255, 255, 0.72); }
.m-spacer { flex-grow: 1; min-height: 24px; }
.m-action { height: 52px; }
.start { width: 100%; height: 52px; border: 0; border-radius: 26px; background: #fff; color: var(--ink); font-size: 18px; font-weight: 800; cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px; }
.start[disabled] { opacity: 0.6; cursor: default; }
.pwform { display: flex; gap: 8px; height: 52px; }
.pwform input { flex: 1 1 0; min-width: 0; height: 52px; padding: 0 18px; border-radius: 26px; border: 2px solid rgba(255, 255, 255, 0.6); background: rgba(0, 0, 0, 0.28); color: #fff; font-size: 17px; transition: border-color 0.2s; }
.pwform input::placeholder { color: rgba(255, 255, 255, 0.6); }
.pwform.wrong input { border-color: #FFD9A8; }
.pwform button { flex: none; height: 52px; padding: 0 22px; border: 0; border-radius: 26px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 800; cursor: pointer; }
.m-status { margin: 10px 0 0; height: 20px; font-size: 14px; line-height: 20px; text-align: center; color: rgba(255, 255, 255, 0.72); transition: color 0.2s; }
.m-status.wrong { color: #FFD9A8; font-weight: 700; }
.m-right { flex: 1 1 0; min-width: 0; padding: 32px 32px 32px 8px; display: flex; flex-direction: column; }
.m-ver { display: flex; align-items: baseline; gap: 12px; height: 40px; padding-right: 48px; }
.m-ver-big { font-size: 30px; line-height: 40px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; flex: none; max-width: 60%; }
.m-ver-note { font-size: 14px; color: rgba(255, 255, 255, 0.72); }
.m-tagline { margin: 12px 0 0; height: 52px; font-size: 16px; line-height: 26px; color: rgba(255, 255, 255, 0.9); }
.m-facts { margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; padding: 16px 0; border-top: 1px solid rgba(255, 255, 255, 0.18); border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.m-facts div { min-width: 0; height: 42px; }
.m-facts dt { font-size: 13px; line-height: 18px; color: rgba(255, 255, 255, 0.72); }
.m-facts dd { margin: 2px 0 0; font-size: 15px; line-height: 22px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-notes { flex: 1 1 0; min-height: 0; overflow-y: auto; margin-top: 4px; padding-right: 8px; }
.m-notes h3 { margin: 18px 0 6px; font-size: 14px; line-height: 20px; font-weight: 700; color: rgba(255, 255, 255, 0.72); }
.m-notes p { margin: 0 0 4px; font-size: 16px; line-height: 26px; }
.close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; border-radius: 22px; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; display: grid; place-items: center; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes panel-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .panel { flex-direction: column; height: auto; max-height: calc(100% - 32px); overflow-y: auto; }
  .m-left { width: auto; }
  .m-cover { width: 200px; height: 200px; }
  .m-right { padding: 0 32px 32px; }
  .m-notes { overflow: visible; flex: none; }
  .card .cols { display: none; }
  .info-name { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}
