/* 레이아웃: 화면 전체 3D 캔버스 위에 얇은 HUD와 중앙 카드 하나 */
:root {
  --paper: #f3f4f1;
  --paper-2: #ffffff;
  --ink: #1b1f1e;
  --muted: #5d6662;
  --line: rgba(27, 31, 30, 0.14);
  --accent: #2f6f62;
  --accent-ink: #ffffff;
  --hud: rgba(22, 26, 25, 0.62);
  --hud-ink: #eef2ef;
  --hud-line: rgba(238, 242, 239, 0.35);
  --scrim: rgba(14, 17, 16, 0.5);
  --ground: #161a19;
  --font: "IBM Plex Sans KR", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "WenQuanYi Zen Hei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c2120; --paper-2: #232a28; --ink: #e7ece9; --muted: #9aa5a0;
    --line: rgba(231, 236, 233, 0.14); --accent: #5fbfa6; --accent-ink: #10201b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1c2120; --paper-2: #232a28; --ink: #e7ece9; --muted: #9aa5a0;
  --line: rgba(231, 236, 233, 0.14); --accent: #5fbfa6; --accent-ink: #10201b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

button { font: inherit; cursor: pointer; }

#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.38) 100%);
}

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
/* 게임 HUD: 십자선, 상호작용 프롬프트, 획득 알림, 수집 카운터 */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.7); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
#crosshair::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px;
  border-radius: 50%; background: #fff;
}
#prompt {
  position: absolute; left: 50%; top: calc(50% + 30px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 8px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(10, 14, 18, 0.85), rgba(10, 14, 18, 0.55));
  border-left: 3px solid #5fd3b3;
  color: #f2f6f5; font-size: 14px; font-weight: 600; white-space: nowrap;
}
#prompt kbd {
  min-width: 24px; height: 24px; padding: 0 6px; margin: 0;
  border: 0; border-radius: 4px; background: #f2f6f5; color: #0a0e12;
  font: 800 13px/24px var(--font); text-align: center;
}
#prompt em { font-style: normal; font-size: 11px; letter-spacing: 0.12em; color: #5fd3b3; }
#pickup {
  position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); top: 30%;
  display: grid; gap: 2px; padding: 12px 18px 12px 16px; min-width: 220px;
  background: linear-gradient(90deg, rgba(242, 193, 78, 0.18), rgba(10, 14, 18, 0.8));
  border-right: 4px solid #f2c14e; color: #fff; text-align: right;
  animation: pickup 2.8s cubic-bezier(.2, .9, .3, 1) forwards;
}
#pickup .pk-label { font-size: 11px; font-weight: 800; letter-spacing: 0.24em; color: #f2c14e; }
#pickup .pk-title { font-size: 18px; font-weight: 800; }
#pickup .pk-count { font-size: 13px; color: rgba(255, 255, 255, 0.7); font-variant-numeric: tabular-nums; }
@keyframes pickup {
  0% { opacity: 0; transform: translateX(40px); }
  10% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(20px); }
}
#counter {
  position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: baseline; gap: 8px; padding: 8px 14px;
  background: rgba(10, 14, 18, 0.6); border-bottom: 3px solid #f2c14e; color: #fff;
  font-variant-numeric: tabular-nums;
}
#counter span { font-size: 11px; font-weight: 800; letter-spacing: 0.2em; color: #f2c14e; }
#counter b { font-size: 26px; font-weight: 800; }
#counter i { font-style: normal; font-size: 14px; color: rgba(255, 255, 255, 0.6); }
body.touch #counter { bottom: auto; top: calc(56px + env(safe-area-inset-top, 0px)); }
#toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  text-align: center; color: var(--hud-ink); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7), 0 2px 16px rgba(0, 0, 0, 0.6);
  animation: toast 2.6s ease forwards;
}
#toast .t-meta { font-size: 13px; letter-spacing: 0.2em; opacity: 0.85; }
#toast .t-title { font-size: clamp(22px, 4vw, 36px); font-weight: 700; margin-top: 4px; }
@keyframes toast { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
}
#where {
  color: var(--hud-ink); font-size: 13px; letter-spacing: 0.08em;
  background: var(--hud); padding: 6px 10px; border-radius: 6px;
}
#topbar .buttons { display: flex; gap: 8px; pointer-events: auto; }
#topbar button, #btn-action {
  border: 1px solid var(--hud-line); background: var(--hud);
  color: var(--hud-ink); padding: 7px 12px; border-radius: 6px; font-size: 13px;
}
#topbar button:hover { border-color: var(--hud-ink); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#joystick {
  position: absolute; left: calc(28px + env(safe-area-inset-left, 0px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px;
  border-radius: 50%; background: var(--hud); border: 1px solid var(--hud-line); opacity: 0.8;
}
#stick {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: var(--hud-ink); opacity: 0.6;
}
#btn-action {
  position: absolute; right: calc(28px + env(safe-area-inset-right, 0px)); bottom: calc(48px + env(safe-area-inset-bottom, 0px)); pointer-events: auto;
  padding: 16px 22px; font-size: 16px; font-weight: 700; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}

/* Overlays */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); background: var(--scrim); backdrop-filter: blur(3px);
}
.overlay[hidden], [hidden] { display: none !important; }

.start-card, .panel-card {
  background: var(--paper); color: var(--ink); border-radius: 10px; width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.start-card { padding: 32px 28px; max-height: 100%; overflow-y: auto; }
.start-card, .panel-card, .deck-caption { touch-action: pan-y; overscroll-behavior: contain; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.3em; color: var(--muted); }
.start-card h1 { margin: 6px 0 4px; font-size: 44px; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
.lede { margin: 0 0 20px; color: var(--muted); }
.keys { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.keys span { white-space: nowrap; }
kbd {
  display: inline-block; min-width: 22px; padding: 0 6px; margin-right: 2px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--paper-2); font: 12px/20px var(--font); text-align: center;
}
.touch-only { display: none; }
body.touch .touch-only { display: flex; }
body.touch .desktop-only { display: none; }

.start-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .ghost {
  border-radius: 8px; padding: 12px 20px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--ink);
}
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ghost { background: transparent; color: var(--ink); }

.panel-card { position: relative; width: min(640px, 100%); max-height: min(86vh, 900px); overflow: auto; padding: 28px; }
.close {
  position: absolute; top: 10px; right: 12px; width: 36px; height: 36px;
  border: 0; background: transparent; font-size: 26px; color: var(--muted);
}
.card-meta { margin: 0; font-size: 12px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.card-title { margin: 6px 0 12px; font-size: 26px; line-height: 1.25; text-wrap: balance; }
.card-body { margin: 0 0 16px; white-space: pre-line; line-height: 1.7; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0 4px; }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--paper-2); }
.metric .v { font-variant-numeric: tabular-nums; color: var(--accent); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.metric .s { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.metric .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 16px; }
.photos img { width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.card-source { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.room-list { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.room-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.room-list .r-door { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.room-list .r-label { font-weight: 700; }
.room-list .r-sum { font-size: 13px; color: var(--muted); }
.room-list button {
  flex: none; border: 1px solid var(--ink); background: transparent; color: var(--ink); border-radius: 6px; padding: 7px 12px; font-size: 13px;
}
.panel-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* 발표 모드 */
#deck { position: fixed; inset: 0; pointer-events: none; }
/* 발표 카드: 게임 업적 카드처럼 어두운 유리판 + 청록·금색 포인트. 도착 후 튀어나오듯 등장 */
.deck-caption {
  --dk-bg: rgba(10, 14, 18, 0.84);
  --dk-ink: #f2f6f5;
  --dk-dim: #9fb2ad;
  --dk-teal: #5fd3b3;
  --dk-gold: #f2c14e;
  position: absolute; opacity: 0; visibility: hidden;
  max-height: calc(100% - 150px); overflow: auto;
  padding: 28px 32px 26px; border-radius: 4px;
  background: var(--dk-bg); color: var(--dk-ink);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  pointer-events: auto;
}
.deck-caption::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--dk-teal), var(--dk-gold));
}
.deck-caption.in { visibility: visible; animation: dk-pop 0.55s cubic-bezier(.16, 1.2, .3, 1) forwards; }
@keyframes dk-pop {
  0% { opacity: 0; transform: var(--dk-from) scale(0.92); filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: var(--dk-to) scale(1); }
}
.deck-caption.is-spot {
  --dk-from: translate(40px, -50%); --dk-to: translate(0, -50%);
  right: max(32px, env(safe-area-inset-right, 0px)); top: 47%;
  width: min(540px, 44vw);
}
.deck-caption.is-center {
  --dk-from: translate(-50%, -46%); --dk-to: translate(-50%, -50%);
  left: 50%; top: 47%; width: min(760px, calc(100% - 48px)); text-align: left;
}
.dk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dk-chip {
  display: inline-block; margin: 0; padding: 4px 10px; border-radius: 2px;
  background: rgba(95, 211, 179, 0.14); color: var(--dk-teal);
  font-size: 11px; font-weight: 800; letter-spacing: 0.2em; font-variant-numeric: tabular-nums;
}
.dk-room { margin: 0; font-size: 12px; color: var(--dk-dim); letter-spacing: 0.04em; }
.dk-title { margin: 14px 0 4px; font-size: clamp(26px, 2.6vw, 38px); font-weight: 800; line-height: 1.18; letter-spacing: -0.025em; text-wrap: balance; }
.dk-title-xl { font-size: clamp(40px, 5.4vw, 72px); letter-spacing: -0.035em; }
.dk-meta { margin: 0 0 14px; font-size: 13px; color: var(--dk-gold); font-weight: 600; letter-spacing: 0.04em; }
.dk-body { margin: 0; font-size: clamp(15px, 1.15vw, 17px); line-height: 1.75; color: #d9e3e0; max-width: 62ch; }
.dk-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 20px; }
.dk-metric {
  display: grid; gap: 2px; padding: 14px 16px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--dk-teal);
}
.dk-metric b { font-size: clamp(24px, 2.2vw, 34px); font-weight: 800; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dk-metric span { font-size: 12px; color: var(--dk-dim); }
.dk-metric small { font-size: 11px; color: #7f938e; }
.dk-photos { display: grid; gap: 6px; margin-top: 18px; grid-template-columns: repeat(3, 1fr); }
.dk-photos.n1 { grid-template-columns: 1fr; }
.dk-photos.n2 { grid-template-columns: 1fr 1fr; }
.dk-photos img { width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; }
.dk-photos.n1 img { aspect-ratio: 16 / 9; }
.dk-note { margin: 16px 0 0; font-size: 12px; color: #7f938e; line-height: 1.5; }
.dk-list { list-style: none; margin: 22px 0 0; padding: 16px 0 0; display: grid; gap: 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.dk-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 12px; }
.dk-list i { grid-row: span 2; font-style: normal; font-weight: 800; color: var(--dk-teal); font-variant-numeric: tabular-nums; }
.dk-list b { font-size: 15px; }
.dk-list span { font-size: 13px; color: var(--dk-dim); }
.deck-bar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 8px; pointer-events: auto;
  background: var(--hud); border: 1px solid var(--hud-line); border-radius: 999px; padding: 6px;
}
.deck-bar button {
  border: 0; background: transparent; color: var(--hud-ink); padding: 8px 14px; border-radius: 999px; font-size: 14px;
}
.deck-bar button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.deck-bar button:disabled { opacity: 0.35; cursor: default; }
#deck-next { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
#deck-count { color: var(--hud-ink); font-size: 13px; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.deck-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--hud); }
.deck-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
@media (max-width: 760px) {
  .deck-caption.is-spot, .deck-caption.is-center {
    --dk-from: translate(0, 30px); --dk-to: translate(0, 0);
    left: 16px; right: 16px; top: auto; width: auto; padding: 20px 20px 18px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-height: 62%;
  }
  #deck-exit { display: none; }
}

#fade {
  position: fixed; inset: 0; background: var(--ground); opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
#fade.on { opacity: 1; }

@media (max-width: 480px) {
  .start-card { padding: 24px 20px; }
  .start-card h1 { font-size: 32px; }
  .panel-card { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #pickup { animation-duration: 0.01s; }
  .deck-caption.in { animation-duration: 0.01s; }
  .deck-progress span { transition: none; }
  #toast { animation-duration: 0.01s; }
  #fade { transition: none; }
}

/* 탐색 중 업적 카드도 발표 카드와 같은 게임 스타일 */
#panel .panel-card {
  background: rgba(10, 14, 18, 0.92); color: #f2f6f5; border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: dk-pop 0.45s cubic-bezier(.16, 1.2, .3, 1) both;
  --dk-from: translateY(16px); --dk-to: translateY(0);
}
#panel .panel-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #5fd3b3, #f2c14e);
}
#panel .close { color: #9fb2ad; }
#panel .card-meta { color: #f2c14e; letter-spacing: 0.08em; text-transform: none; font-weight: 600; }
#panel .card-title { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -0.025em; }
#panel .card-body { color: #d9e3e0; }
#panel .metric { background: rgba(255, 255, 255, 0.05); border: 0; border-left: 3px solid #5fd3b3; border-radius: 3px; }
#panel .metric .v { color: #fff; font-size: 28px; }
#panel .metric .l, #panel .metric .s, #panel .card-source, #panel .room-list .r-door, #panel .room-list .r-sum { color: #9fb2ad; }
#panel .room-list, #panel .room-list li { border-color: rgba(255, 255, 255, 0.1); }
#panel .room-list button, #panel .ghost { color: #f2f6f5; border-color: rgba(255, 255, 255, 0.35); }
@media (prefers-reduced-motion: reduce) { #panel .panel-card { animation: none; } }

/* 멀티플레이: 이름 입력, 접속 인원, 알림 */
.name-row { display: none; margin: 0 0 18px; }
body.mp .name-row { display: grid; gap: 6px; }
.name-row label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted); }
.name-row input {
  font: 600 16px var(--font); padding: 11px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
}
.name-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#name-hint { margin: 0; font-size: 13px; color: #c2413a; }
#online {
  position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(52px + env(safe-area-inset-top, 0px));
  padding: 5px 10px 5px 22px; border-radius: 4px; background: rgba(10, 14, 18, 0.6); color: #f2f6f5; font-size: 12px; font-weight: 700;
  pointer-events: auto;
}
#online::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #9fb2ad; }
#online.online::before { background: #5fd3b3; box-shadow: 0 0 8px #5fd3b3; }
#online.connecting::before { background: #f2c14e; }
#feed { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(86px + env(safe-area-inset-top, 0px)); display: grid; gap: 4px; }
#feed div {
  padding: 6px 10px; border-left: 3px solid #5fd3b3; background: rgba(10, 14, 18, 0.66); color: #e7eeec; font-size: 13px;
  animation: pickup 6s ease forwards;
}
#feed b { color: #fff; }
#feed em { font-style: normal; color: #f2c14e; }

/* 발표: 캐릭터 선택 화면 */
.deck-caption.kind-intro { width: min(1060px, calc(100% - 48px)); padding: 24px 30px 26px; }
.cs-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cs-hint { margin: 0; font-size: 12px; color: var(--dk-dim); letter-spacing: 0.08em; }
.cs { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 32px; margin-top: 18px; align-items: start; }
.cs-portrait {
  position: relative; height: clamp(180px, 30vh, 280px); max-width: 100%; overflow: hidden; border-radius: 3px;
  background: radial-gradient(120% 80% at 50% 100%, rgba(95, 211, 179, 0.28), transparent 60%), linear-gradient(160deg, #18242a, #0b1013);
  border: 1px solid rgba(95, 211, 179, 0.35);
}
.cs-portrait svg, .cs-portrait img { position: absolute; left: 50%; bottom: 0; height: 90%; width: auto; transform: translateX(-50%); object-fit: cover; }
.cs-portrait img { left: 0; width: 100%; height: 100%; transform: none; }
.cs-portrait::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 4px);
}
.cs-lock {
  position: absolute; left: 50%; bottom: 14%; z-index: 1; padding: 6px 14px; transform: translateX(-50%) rotate(-6deg) scale(1.6);
  border: 3px solid var(--dk-gold); color: var(--dk-gold); font-size: 18px; font-weight: 900; letter-spacing: 0.18em;
  background: rgba(10, 14, 18, 0.7); opacity: 0; white-space: nowrap;
}
.deck-caption.in .cs-lock { animation: cs-lock 0.35s 1.3s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes cs-lock { to { opacity: 1; transform: translateX(-50%) rotate(-6deg) scale(1); } }
.cs-title { margin: 14px 0 0; font-size: 12px; font-weight: 800; letter-spacing: 0.2em; color: var(--dk-gold); }
.cs-name { margin: 2px 0 6px; font-size: clamp(40px, 4.6vw, 64px); font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.cs-quote { margin: 0; font-size: 15px; color: #d9e3e0; }
.cs-stats { display: grid; gap: 9px; }
.cs-stat { display: grid; grid-template-columns: 96px minmax(0, 1fr) 18px; gap: 12px; align-items: center; font-size: 13px; color: var(--dk-dim); }
.cs-stat b { color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.cs-stat i {
  height: 8px; border-radius: 1px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 calc(20% - 3px), transparent calc(20% - 3px) 20%);
  position: relative; overflow: hidden;
}
.cs-stat i::after {
  content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--dk-teal), #9ff0d8);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(20% - 3px), transparent calc(20% - 3px) 20%);
  mask: repeating-linear-gradient(90deg, #000 0 calc(20% - 3px), transparent calc(20% - 3px) 20%);
}
.deck-caption.in .cs-stat i::after { animation: cs-bar 0.7s calc(0.35s + var(--d)) cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes cs-bar { to { transform: scaleX(var(--v)); } }
.cs-skills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.cs-skill { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; background: rgba(255, 255, 255, 0.05); border-radius: 3px; }
.cs-skill kbd {
  min-width: 30px; height: 30px; padding: 0 6px; margin: 0; border: 0; border-radius: 4px;
  background: #f2f6f5; color: #0a0e12; font: 800 12px/30px var(--font); text-align: center;
}
.cs-skill b { display: block; font-size: 14px; color: #fff; }
.cs-skill span { display: block; font-size: 12px; color: var(--dk-dim); margin-top: 2px; }
.cs-skill.ult { background: linear-gradient(90deg, rgba(242, 193, 78, 0.18), rgba(255, 255, 255, 0.04)); border-left: 3px solid var(--dk-gold); }
.cs-skill.ult kbd { background: var(--dk-gold); }
.cs-passive { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 10px; align-items: baseline; margin-top: 10px; padding: 10px 12px; border: 1px dashed rgba(255, 255, 255, 0.18); border-radius: 3px; }
.cs-passive em { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.2em; color: var(--dk-teal); }
.cs-passive b { font-size: 14px; color: #fff; }
.cs-passive span { font-size: 12px; color: var(--dk-dim); }
.cs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cs-tags span { padding: 4px 9px; font-size: 12px; color: #d9e3e0; background: rgba(255, 255, 255, 0.06); border-radius: 2px; }
@media (max-width: 760px) {
  .cs { grid-template-columns: 1fr; gap: 14px; }
  .cs-portrait { height: 160px; }
  .cs-skills { grid-template-columns: 1fr; }
  .cs-passive { grid-template-columns: auto minmax(0, 1fr); }
  .cs-passive span { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .deck-caption.in .cs-lock, .deck-caption.in .cs-stat i::after { animation-duration: 0.01s; animation-delay: 0s; }
}

/* =====================================================================
   GAME SKIN v2 — 각진 패널, 기울어진 라벨, 테크 숫자 폰트, 얇은 선과 발광
   (위의 기본 스타일을 덮어쓴다)
   ===================================================================== */
:root {
  --g-bg: rgba(9, 12, 15, 0.86);
  --g-bg-2: rgba(255, 255, 255, 0.045);
  --g-line: rgba(255, 255, 255, 0.12);
  --g-ink: #eef3f2;
  --g-dim: #8ea29e;
  --g-mint: #3fe6c2;
  --g-gold: #ffc94a;
  --g-cut: 16px;
  --g-tech: "Chakra Petch", "IBM Plex Sans KR", system-ui, sans-serif;
}
/* 모서리 잘린 패널 공통 */
.deck-caption, #panel .panel-card, .start-card {
  clip-path: polygon(0 0, calc(100% - var(--g-cut)) 0, 100% var(--g-cut), 100% 100%, var(--g-cut) 100%, 0 calc(100% - var(--g-cut)));
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 120px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, rgba(16, 21, 26, 0.94), rgba(7, 9, 12, 0.9));
  color: var(--g-ink);
  box-shadow: none;
}
.deck-caption::before, #panel .panel-card::before, .start-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; right: auto; width: 3px; height: auto;
  background: linear-gradient(180deg, var(--g-mint), rgba(63, 230, 194, 0.15));
  box-shadow: 0 0 18px rgba(63, 230, 194, 0.55);
}
.deck-caption::after, #panel .panel-card::after, .start-card::after {
  content: ""; position: absolute; right: 10px; bottom: 10px; width: 22px; height: 22px; pointer-events: none;
  border-right: 2px solid var(--g-mint); border-bottom: 2px solid var(--g-mint); opacity: 0.7;
}

/* 등장: 카드가 열리고, 안의 요소가 차례로 떠오른다 */
.deck-caption.in > * { opacity: 0; animation: g-rise 0.5s cubic-bezier(.2, .9, .3, 1) forwards; }
.deck-caption.in > *:nth-child(1) { animation-delay: 0.08s; }
.deck-caption.in > *:nth-child(2) { animation-delay: 0.14s; }
.deck-caption.in > *:nth-child(3) { animation-delay: 0.2s; }
.deck-caption.in > *:nth-child(4) { animation-delay: 0.26s; }
.deck-caption.in > *:nth-child(5) { animation-delay: 0.32s; }
.deck-caption.in > *:nth-child(6) { animation-delay: 0.38s; }
.deck-caption.in > *:nth-child(n+7) { animation-delay: 0.44s; }
@keyframes g-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 라벨·제목·본문 */
.dk-chip {
  display: inline-block; padding: 4px 12px 4px 10px; border-radius: 0;
  background: var(--g-mint); color: #04110d;
  font: 700 11px/1.2 var(--g-tech); letter-spacing: 0.22em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.dk-room, .cs-hint { font: 600 11px var(--g-tech); letter-spacing: 0.18em; text-transform: uppercase; color: var(--g-dim); }
.dk-title { margin: 16px 0 6px; font-weight: 800; letter-spacing: -0.035em; color: #fff; }
.dk-title-xl { font-size: clamp(42px, 5.6vw, 78px); line-height: 1.02; }
.dk-meta { font: 600 12px var(--g-tech); letter-spacing: 0.14em; color: var(--g-mint); margin-bottom: 16px; }
.dk-meta::before { content: "// "; color: var(--g-dim); }
.dk-body { color: #c9d6d3; }
.dk-note { font: 500 11px/1.5 var(--g-tech); letter-spacing: 0.04em; color: #6f827e; border-top: 1px solid var(--g-line); padding-top: 10px; }

/* 숫자: 큰 테크 폰트, 칸 사이 얇은 선 */
.dk-metrics { display: flex; flex-wrap: wrap; gap: 0; margin-top: 22px; border-top: 1px solid var(--g-line); border-bottom: 1px solid var(--g-line); }
.dk-metric { flex: 1 1 120px; padding: 14px 16px 12px; background: none; border: 0; border-left: 1px solid var(--g-line); border-radius: 0; }
.dk-metric:first-child { border-left: 0; padding-left: 0; }
.dk-metric b { font: 700 clamp(28px, 2.6vw, 40px)/1 var(--g-tech); letter-spacing: -0.01em; color: #fff; text-shadow: 0 0 18px rgba(63, 230, 194, 0.35); }
.dk-metric span { margin-top: 6px; font-size: 12px; color: var(--g-dim); }
.dk-metric small { color: #6f827e; }

.dk-photos img { border-radius: 0; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); filter: saturate(0.9) contrast(1.05); }
.dk-list { border-top-color: var(--g-line); }
.dk-list i { font-family: var(--g-tech); color: var(--g-mint); }

/* ---------- 캐릭터 선택 ---------- */
.deck-caption.kind-intro { padding: 26px 30px 28px 34px; }
.cs-portrait {
  border: 0; border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  background:
    repeating-linear-gradient(-45deg, rgba(63, 230, 194, 0.06) 0 2px, transparent 2px 14px),
    radial-gradient(110% 90% at 50% 105%, rgba(63, 230, 194, 0.35), transparent 60%),
    linear-gradient(160deg, #14232a, #070b0e);
}
.cs-portrait::before {
  content: "PLAYER 01"; position: absolute; left: 12px; top: 10px; z-index: 1;
  font: 700 10px var(--g-tech); letter-spacing: 0.24em; color: var(--g-mint);
}
.cs-lock {
  left: 0; right: 0; bottom: 0; transform: translateX(-100%); padding: 9px 0; border: 0;
  background: linear-gradient(90deg, var(--g-mint), #9ff5e1); color: #04110d; text-align: center;
  font: 700 15px var(--g-tech); letter-spacing: 0.4em; opacity: 1;
}
.deck-caption.in .cs-lock { animation: cs-lock2 0.45s 1.3s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes cs-lock2 { to { transform: translateX(0); } }
.cs-title { font: 700 11px var(--g-tech); letter-spacing: 0.3em; color: var(--g-gold); }
.cs-name { font-size: clamp(46px, 5vw, 76px); letter-spacing: -0.05em; color: #fff; }
.cs-quote { color: #c9d6d3; }
.cs-stat { grid-template-columns: 108px minmax(0, 1fr) 22px; font-size: 12px; letter-spacing: 0.02em; }
.cs-stat b { font: 700 15px var(--g-tech); color: var(--g-mint); }
.cs-stat i { height: 6px; }
.cs-stat i::after { background: linear-gradient(90deg, var(--g-mint), #b8fbe9); box-shadow: 0 0 12px rgba(63, 230, 194, 0.6); }
.cs-skill {
  background: var(--g-bg-2); border-radius: 0; border: 1px solid transparent;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  transition: border-color 0.2s;
}
.cs-skill kbd {
  border-radius: 0; background: transparent; color: var(--g-mint); border: 1px solid var(--g-mint);
  font: 700 12px/28px var(--g-tech); height: 30px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}
.cs-skill.ult { background: linear-gradient(90deg, rgba(255, 201, 74, 0.16), rgba(255, 255, 255, 0.02)); border: 0; border-left: 2px solid var(--g-gold); }
.cs-skill.ult kbd { background: var(--g-gold); border-color: var(--g-gold); color: #1a1405; box-shadow: 0 0 16px rgba(255, 201, 74, 0.6); }
.cs-skill.ult b { color: var(--g-gold); }
.cs-passive { border: 0; border-top: 1px solid var(--g-line); border-bottom: 1px solid var(--g-line); border-radius: 0; padding: 10px 0; }
.cs-passive em { font-family: var(--g-tech); color: var(--g-gold); }
.cs-tags span { border-radius: 0; background: transparent; border: 1px solid var(--g-line); color: var(--g-dim); font-size: 11px; }

/* 좁은 화면(노트북 창을 좁혔을 때 포함)에서는 두 칸을 유지하되 압축 */
@media (max-width: 900px) and (min-width: 641px) {
  .cs { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: 20px; }
  .cs-skills { grid-template-columns: 1fr; gap: 6px; }
  .cs-skill span { display: none; }
  .cs-tags { display: none; }
}
@media (max-width: 760px) and (min-width: 641px) {
  .deck-caption.is-center.kind-intro { top: 47%; bottom: auto; left: 16px; right: 16px; width: auto; --dk-from: translate(0, -46%); --dk-to: translate(0, -50%); }
}
@media (max-width: 640px) {
  .cs { grid-template-columns: 1fr; }
  .cs-skill span, .cs-tags { display: none; }
}

/* ---------- 발표 하단 바 ---------- */
.deck-bar {
  border-radius: 0; border: 1px solid var(--g-line); background: rgba(8, 11, 14, 0.82); padding: 4px;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.deck-bar button { border-radius: 0; font-weight: 700; }
#deck-next { background: var(--g-mint); color: #04110d; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); padding: 8px 20px; }
#deck-count { font: 600 13px var(--g-tech); letter-spacing: 0.1em; }
.deck-progress { height: 2px; }
.deck-progress span { background: var(--g-mint); box-shadow: 0 0 10px var(--g-mint); }

/* ---------- 탐험 HUD ---------- */
#where {
  background: none; padding: 0 0 0 12px; border-left: 2px solid var(--g-mint);
  font: 700 14px var(--font); letter-spacing: -0.01em; color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
#where::before { content: "LOCATION"; display: block; font: 600 10px var(--g-tech); letter-spacing: 0.24em; color: var(--g-mint); margin-bottom: 2px; }
#topbar button {
  border-radius: 0; border: 1px solid var(--g-line); background: rgba(8, 11, 14, 0.6); color: var(--g-ink);
  font-weight: 600; font-size: 12px; padding: 7px 12px;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
#topbar button:hover { background: var(--g-mint); color: #04110d; border-color: var(--g-mint); }
#crosshair { width: 4px; height: 4px; margin: -2px 0 0 -2px; border: 0; border-radius: 0; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); }
#crosshair::after {
  width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 0; background: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  clip-path: polygon(0 0, 30% 0, 30% 2px, 2px 2px, 2px 30%, 0 30%, 0 0, 100% 0, 100% 30%, calc(100% - 2px) 30%, calc(100% - 2px) 2px, 70% 2px, 70% 0, 100% 0, 100% 100%, 70% 100%, 70% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 70%, 100% 70%, 100% 100%, 0 100%, 0 70%, 2px 70%, 2px calc(100% - 2px), 30% calc(100% - 2px), 30% 100%, 0 100%);
}
#prompt { border-radius: 0; border-left: 0; background: rgba(8, 11, 14, 0.82); padding: 6px 14px 6px 6px; clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
#prompt kbd { border-radius: 0; background: var(--g-mint); color: #04110d; font-family: var(--g-tech); }
#prompt em { font-family: var(--g-tech); color: var(--g-gold); }
#counter {
  border-radius: 0; border: 0; background: rgba(8, 11, 14, 0.7); padding: 8px 16px 8px 14px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); border-bottom: 2px solid var(--g-gold);
}
#counter span { font-family: var(--g-tech); color: var(--g-gold); }
#counter b { font: 700 30px var(--g-tech); text-shadow: 0 0 16px rgba(255, 201, 74, 0.45); }
#counter i { font-family: var(--g-tech); }
/* 업적 획득: 화면 위쪽 가운데 배너가 빛을 훑고 지나간다 */
#pickup {
  left: 50%; right: auto; top: 16%; transform: translateX(-50%); min-width: 340px; text-align: center;
  padding: 12px 40px 14px; border: 0; background: linear-gradient(90deg, transparent, rgba(8, 11, 14, 0.88) 18%, rgba(8, 11, 14, 0.88) 82%, transparent);
  animation: pk2 3s cubic-bezier(.2, .9, .3, 1) forwards; overflow: hidden;
}
#pickup::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -40%;
  background: linear-gradient(90deg, transparent, rgba(255, 201, 74, 0.35), transparent);
  animation: pk-sweep 1.1s 0.15s ease-out forwards;
}
#pickup .pk-label { font: 700 11px var(--g-tech); letter-spacing: 0.34em; color: var(--g-gold); }
#pickup .pk-title { font-size: 20px; }
#pickup .pk-count { font: 600 12px var(--g-tech); letter-spacing: 0.14em; }
@keyframes pk2 {
  0% { opacity: 0; transform: translateX(-50%) scaleX(0.6); }
  10% { opacity: 1; transform: translateX(-50%) scaleX(1); }
  82% { opacity: 1; transform: translateX(-50%); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}
@keyframes pk-sweep { to { left: 110%; } }
#online { border-radius: 0; font-family: var(--g-tech); letter-spacing: 0.06em; }
#feed div { border-left-color: var(--g-mint); background: rgba(8, 11, 14, 0.72); }

/* ---------- 시작 화면: 게임 메인 메뉴 ---------- */
#start { background: radial-gradient(120% 90% at 30% 50%, rgba(6, 9, 12, 0.35), rgba(6, 9, 12, 0.82)); backdrop-filter: blur(2px); justify-content: flex-start; padding-left: max(6vw, 16px); }
.start-card { width: min(460px, 100%); padding: 34px 34px 30px 38px; }
.start-card .eyebrow { display: flex; flex-direction: column; gap: 4px; color: var(--g-mint); font: 700 12px var(--g-tech); letter-spacing: 0.3em; }
.menu-ver { color: var(--g-dim); font-size: 10px; letter-spacing: 0.24em; }
.start-card h1 { margin: 14px 0 6px; font: 700 clamp(44px, 6vw, 64px)/0.95 var(--g-tech); letter-spacing: -0.02em; color: #fff; }
.start-card .lede { color: #c9d6d3; margin-bottom: 18px; }
.start-card .keys { color: var(--g-dim); font-size: 12px; }
.start-card kbd { border-radius: 0; background: transparent; border: 1px solid var(--g-line); color: var(--g-ink); font-family: var(--g-tech); }
.start-card .name-row label { color: var(--g-mint); font-family: var(--g-tech); letter-spacing: 0.24em; }
.start-card .name-row input { border-radius: 0; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--g-line); color: #fff; }
.start-actions { flex-direction: column; gap: 6px; }
.start-actions .primary, .start-actions .ghost {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; text-align: left;
  border: 0; border-radius: 0; padding: 14px 16px; font-size: 17px; font-weight: 700;
  background: rgba(255, 255, 255, 0.04); color: var(--g-ink);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background 0.18s, color 0.18s, padding 0.18s;
}
.start-actions i { font: 700 12px var(--g-tech); font-style: normal; color: var(--g-dim); letter-spacing: 0.1em; }
.start-actions small { font: 600 11px var(--g-tech); color: var(--g-dim); letter-spacing: 0.12em; }
.start-actions .primary { background: var(--g-mint); color: #04110d; }
.start-actions .primary i, .start-actions .primary small { color: rgba(4, 17, 13, 0.6); }
.start-actions .ghost:hover, .start-actions .ghost:focus-visible { background: rgba(63, 230, 194, 0.14); padding-left: 22px; }
.start-actions .primary:hover { padding-left: 22px; box-shadow: 0 0 24px rgba(63, 230, 194, 0.45); }
@media (max-width: 560px) { #start { justify-content: center; padding-left: 16px; } }

/* ---------- 탐험 중 카드 ---------- */
#panel .panel-card { padding: 30px 30px 28px 34px; }
#panel .card-meta { font-family: var(--g-tech); color: var(--g-mint); letter-spacing: 0.16em; }
#panel .metric { border-left: 1px solid var(--g-line); background: none; border-radius: 0; }
#panel .metric .v { font-family: var(--g-tech); text-shadow: 0 0 16px rgba(63, 230, 194, 0.35); }
#panel .photos img { border-radius: 0; }
#panel .room-list button { border-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  .deck-caption.in > * { animation: none; opacity: 1; }
  #pickup, #pickup::after { animation-duration: 0.01s; }
}
/* 세로 사진도 카드 높이를 넘지 않게, 낮은 화면에서는 초상을 줄이거나 숨긴다 */
.dk-photos img { max-height: 180px; }
.dk-photos.n1 img { max-height: 200px; object-position: center 30%; }
@media (max-width: 760px) {
  .cs-portrait { height: 110px; }
  .cs-lock { padding: 5px 0; font-size: 12px; }
}
@media (max-height: 620px) {
  .kind-intro .cs-portrait { display: none; }
  .kind-intro .cs-name { font-size: clamp(36px, 4vw, 52px); }
  .kind-intro .cs-skill span, .kind-intro .cs-tags { display: none; }
}

/* =====================================================================
   HERO SELECT — 맨 처음 캐릭터 선택 화면 (오버워치 느낌)
   ===================================================================== */
#select.hs {
  --hc: var(--g-mint);
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto 1fr auto;
  padding: 22px max(28px, env(safe-area-inset-right, 0px)) 22px max(28px, env(safe-area-inset-left, 0px));
  color: var(--g-ink); overflow: hidden;
  background:
    radial-gradient(60% 70% at 50% 55%, color-mix(in srgb, var(--hc) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(6, 9, 12, 0.72), rgba(6, 9, 12, 0.9));
  backdrop-filter: blur(4px);
  transition: opacity 0.4s, background 0.5s;
}
#select.hs.out { opacity: 0; }
#select.hs::before { /* 바닥 격자 */
  content: ""; position: absolute; inset: auto -20% 0; height: 46%; pointer-events: none; opacity: 0.35;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 40px);
  transform: perspective(500px) rotateX(62deg); transform-origin: bottom;
  mask-image: linear-gradient(0deg, #000, transparent);
}
.hs-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; position: relative; }
.hs-chip {
  margin: 0; padding: 6px 16px 6px 12px; background: var(--hc); color: #071012;
  font: 700 13px var(--g-tech); letter-spacing: 0.28em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); transition: background 0.4s;
}
.hs-hint { margin: 0; color: var(--g-dim); font-size: 13px; text-align: right; }
.hs-hint b { color: var(--g-ink); font-weight: 600; }

.hs-stage { position: relative; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(200px, 0.9fr) minmax(280px, 1fr); align-items: center; gap: 24px; min-height: 0; }
.hs-info { align-self: center; animation: hs-in 0.45s both; }
.hs-role { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--hc); font: 700 13px var(--g-tech); letter-spacing: 0.24em; }
.hs-role svg { width: 18px; height: 18px; fill: currentColor; }
.hs-title { margin: 0; color: var(--g-gold); font: 600 14px var(--g-tech); letter-spacing: 0.16em; }
.hs-name {
  margin: 2px 0 12px; font: 700 clamp(56px, 8vw, 112px)/0.95 "IBM Plex Sans KR", var(--g-tech); letter-spacing: -0.04em; color: #fff;
  text-shadow: 0 0 40px color-mix(in srgb, var(--hc) 45%, transparent); font-style: italic;
}
.hs-name em {
  display: inline-block; margin-left: 14px; padding: 4px 10px; vertical-align: middle; font: 700 14px var(--g-tech); font-style: normal;
  letter-spacing: 0.12em; color: #071012; background: var(--g-gold); clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.hs-trait { margin: 0 0 18px; max-width: 34ch; color: #c9d6d3; font-size: 15px; line-height: 1.55; }
.hs-say {
  position: relative; display: inline-block; margin: 0; min-height: 1.5em; max-width: 36ch; padding: 12px 18px;
  background: rgba(255, 255, 255, 0.06); border-left: 3px solid var(--hc); font-size: 17px; font-weight: 600; color: #fff;
}
.hs-say.pop { animation: hs-pop 0.35s both; }

.hs-figure { display: grid; place-items: end center; height: 100%; min-height: 0; }
.hs-portrait { position: relative; width: min(100%, 300px); aspect-ratio: 5 / 6; animation: hs-rise 0.5s cubic-bezier(.2,.9,.3,1.2) both; }
.hs-portrait svg { width: 100%; height: 100%; filter: drop-shadow(0 0 36px color-mix(in srgb, var(--hc) 55%, transparent)); }
.hs-portrait::after { /* 발판 */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -6px; height: 18px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hc) 70%, transparent), transparent); filter: blur(2px);
}
.hs-portrait.is-locked svg { filter: grayscale(0.35) drop-shadow(0 0 24px color-mix(in srgb, var(--hc) 35%, transparent)); }

.hs-kit { display: grid; gap: 8px; align-self: center; animation: hs-in 0.45s 0.05s both; }
.hs-kit-label { margin: 0 0 4px; color: var(--g-dim); font: 700 12px var(--g-tech); letter-spacing: 0.28em; }
.hs-kit-label small { margin-left: 8px; letter-spacing: 0.04em; font-family: "IBM Plex Sans KR", sans-serif; font-weight: 500; opacity: 0.8; }
.hs-skill {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--g-line); color: var(--g-ink); font: inherit;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.hs-skill:hover, .hs-skill.on { background: color-mix(in srgb, var(--hc) 16%, rgba(255, 255, 255, 0.04)); border-color: color-mix(in srgb, var(--hc) 60%, transparent); transform: translateX(-3px); }
.hs-skill kbd {
  flex: none; min-width: 44px; padding: 8px 6px; text-align: center; border: 1px solid color-mix(in srgb, var(--hc) 70%, transparent);
  color: var(--hc); background: rgba(0, 0, 0, 0.3); font: 700 13px var(--g-tech); border-radius: 0;
}
.hs-skill span { display: grid; gap: 2px; }
.hs-skill b { font-size: 15px; }
.hs-skill small { color: var(--g-dim); font-size: 12.5px; }
.hs-skill.ult kbd { color: #071012; background: var(--g-gold); border-color: var(--g-gold); }
.hs-skill.ult b { color: var(--g-gold); }
.hs-passive { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--g-line); }
.hs-passive em { color: var(--g-gold); font: 700 11px var(--g-tech); font-style: normal; letter-spacing: 0.24em; }
.hs-passive b { font-size: 14px; }
.hs-passive span { color: var(--g-dim); font-size: 13px; }

.hs-bottom { position: relative; display: flex; align-items: flex-end; gap: 22px; }
.hs-roster { flex: 1; display: flex; gap: 18px; overflow-x: auto; padding: 6px 2px 4px; scrollbar-width: none; }
.hs-roster::-webkit-scrollbar { display: none; }
.hs-group-label { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; color: var(--g-dim); font: 700 11px var(--g-tech); letter-spacing: 0.2em; }
.hs-group-label svg { width: 13px; height: 13px; fill: currentColor; }
.hs-tiles { display: flex; gap: 6px; }
.hs-tile {
  --c: var(--g-mint);
  position: relative; flex: none; width: 74px; height: 86px; padding: 0; cursor: pointer; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, #10161a), #0b0f12); border: 0; color: #fff;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: transform 0.15s, filter 0.15s;
}
.hs-tile::after { content: ""; position: absolute; inset: 0; border-bottom: 3px solid transparent; pointer-events: none; }
.hs-tile-art { position: absolute; inset: 6px 8px 18px; }
.hs-tile-art svg { width: 100%; height: 100%; }
.hs-tile-name { position: absolute; left: 0; right: 0; bottom: 3px; font-size: 12px; font-weight: 700; text-align: center; text-shadow: 0 1px 3px #000; }
.hs-tile.locked { filter: saturate(0.55) brightness(0.8); }
.hs-tile:hover { transform: translateY(-4px); filter: none; }
.hs-tile.on { transform: translateY(-8px); filter: none; box-shadow: none; }
.hs-tile.on::after { border-bottom-color: var(--c); background: linear-gradient(0deg, color-mix(in srgb, var(--c) 35%, transparent), transparent 50%); }
.hs-tile.me .hs-tile-name::before { content: "★ "; color: var(--g-gold); }
.hs-lock { position: absolute; top: 5px; right: 12px; width: 14px; height: 14px; opacity: 0.85; }
.hs-lock svg { width: 100%; height: 100%; fill: #fff; }

.hs-go {
  flex: none; display: grid; justify-items: center; gap: 2px; min-width: 210px; padding: 16px 30px; cursor: pointer; border: 0;
  background: var(--hc); color: #071012; font: 700 26px "IBM Plex Sans KR", var(--g-tech); letter-spacing: 0.08em;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); transition: filter 0.15s, transform 0.15s, background 0.4s;
}
.hs-go small { font: 700 11px var(--g-tech); letter-spacing: 0.3em; opacity: 0.7; }
.hs-go:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-2px); }
.hs-go:not(:disabled) { animation: hs-glow 1.6s ease-in-out infinite; }
.hs-go:disabled { cursor: not-allowed; background: rgba(255, 255, 255, 0.08); color: var(--g-dim); }

.hs-banner {
  position: absolute; left: 0; right: 0; top: 50%; translate: 0 -50%; pointer-events: none; opacity: 0;
  display: grid; place-items: center; height: 120px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hc) 85%, transparent) 20%, color-mix(in srgb, var(--hc) 85%, transparent) 80%, transparent);
}
.hs-banner span { font: 700 clamp(36px, 6vw, 72px) var(--g-tech); letter-spacing: 0.4em; color: #071012; font-style: italic; }
#select.locked-in .hs-banner { animation: hs-banner 1.1s cubic-bezier(.2,.9,.3,1) both; }
#select.locked-in .hs-bottom, #select.locked-in .hs-kit { opacity: 0.3; transition: opacity 0.3s; }

@keyframes hs-in { from { opacity: 0; transform: translateX(-14px); } }
@keyframes hs-rise { from { opacity: 0; transform: translateY(30px) scale(0.96); } }
@keyframes hs-pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes hs-glow { 50% { filter: brightness(1.15) drop-shadow(0 0 10px var(--hc)); } }
@keyframes hs-banner { 0% { opacity: 0; transform: scaleY(0.1); } 25% { opacity: 1; transform: scaleY(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* 좁은 화면: 초상은 작게, 위에서 아래로 쌓는다 */
@media (max-width: 900px) {
  #select.hs { display: flex; flex-direction: column; overflow-y: auto; padding: 14px 16px 20px; gap: 14px; }
  #select.hs > * { flex: none; }
  #select.hs::before { display: none; }
  .hs-stage { min-height: auto; }
  .hs-hint { display: none; }
  .hs-stage { grid-template-columns: 1fr; gap: 12px; }
  .hs-figure { display: none; }
  .hs-name { font-size: 56px; }
  .hs-bottom { flex-direction: column; align-items: stretch; gap: 12px; }
  .hs-go { min-width: 0; font-size: 22px; padding: 12px 20px; }
}
@media (max-height: 760px) and (min-width: 901px) {
  .hs-name { font-size: 72px; }
  .hs-portrait { width: min(100%, 220px); }
  .hs-skill { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #select.hs *, #select.hs { animation: none !important; transition: none !important; }
}

/* 한국어 제목이 단어 중간에서 끊기지 않게 */
.deck-caption, .hs-name, .hs-trait, .hs-say { word-break: keep-all; overflow-wrap: anywhere; }
.dk-title-xl + .dk-body { margin-top: 16px; }
.cs-skill:nth-child(odd):last-child { grid-column: 1 / -1; }

/* ---------- 휴대폰: 발표 모드 소개 장을 한 화면에 (스크롤 없이) ---------- */
@media (max-width: 640px) {
  .deck-bar { gap: 2px; }
  .deck-bar button { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  #deck-next { padding: 8px 16px; }
  #deck-count { min-width: 52px; white-space: nowrap; }

  .deck-caption.is-center.kind-intro {
    top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; left: 12px; right: 12px; width: auto;
    max-height: calc(100% - 92px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px));
    padding: 16px 16px 14px; --dk-from: translate(0, 16px); --dk-to: translate(0, 0);
  }
  .kind-intro .cs-top .cs-hint { display: none; }
  .kind-intro .cs { gap: 12px; margin-top: 8px; }
  .kind-intro .cs-portrait { display: none; }
  .kind-intro .cs-title { margin-top: 6px; }
  .kind-intro .cs-name { font-size: 42px; margin-bottom: 4px; }
  .kind-intro .cs-quote { font-size: 14px; }
  .kind-intro .cs-stats { gap: 6px; }
  .kind-intro .cs-stat { grid-template-columns: 128px minmax(0, 1fr) 18px; gap: 10px; font-size: 11.5px; }
  .kind-intro .cs-stat span { white-space: nowrap; }
  .kind-intro .cs-stat b { font-size: 13px; }
  .kind-intro .cs-skills { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
  .kind-intro .cs-skill { grid-template-columns: 1fr; gap: 6px; padding: 8px; }
  .kind-intro .cs-skill:nth-child(odd):last-child { grid-column: auto; }
  .kind-intro .cs-skill b { font-size: 12px; line-height: 1.3; }
  .kind-intro .cs-skill span { display: none; }
  .kind-intro .cs-passive { margin-top: 10px; padding: 8px 0; font-size: 12px; }
  .kind-intro .cs-tags { display: flex; margin-top: 10px; gap: 5px; }
  .kind-intro .cs-tags span { font-size: 11px; padding: 3px 7px; }
}

/* 포인터 안내와 '한 번 더 누르면 선택' 표시 */
.hs-keys { display: block; margin-top: 4px; font-size: 12px; color: var(--g-dim); }
@media (hover: none) { .hs-keys { display: none; } }
.hs-go.armed { filter: brightness(1.25); transform: translateY(-3px) scale(1.03); }

/* 실제 사진이 있는 캐릭터 */
.hs-tile-art .hs-photo { position: absolute; inset: -6px -8px -18px; width: calc(100% + 16px); height: calc(100% + 24px); object-fit: cover; object-position: center 20%; }
.hs-portrait:has(.hs-photo) { aspect-ratio: 421 / 541; }
.hs-portrait .hs-photo {
  width: 100%; height: 100%; object-fit: cover; display: block;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  box-shadow: 0 0 0 2px var(--hc);
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--hc) 45%, transparent));
  -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent); mask-image: linear-gradient(180deg, #000 78%, transparent);
}
.cs-portrait img { object-position: center 22%; }
@media (max-width: 640px) {
  .kind-intro .cs-hero { display: grid; grid-template-columns: 78px minmax(0, 1fr); column-gap: 14px; align-items: end; }
  .kind-intro .cs-portrait { display: block; grid-row: 1 / span 3; height: 100px; width: 78px; }
  .kind-intro .cs-portrait svg { height: 100%; }
  .kind-intro .cs-lock { display: none; }
  .kind-intro .cs-name { font-size: 36px; }
}
.cs-portrait:has(img) { height: clamp(240px, 38vh, 330px); }
.cs-portrait img { object-position: center 8%; }
@media (max-width: 640px) {
  .kind-intro .cs-portrait::before { display: none; }
  .kind-intro .cs-portrait:has(img) { height: 100px; }
}
@media (max-height: 760px) and (min-width: 641px) {
  .cs-portrait:has(img) { height: clamp(200px, 34vh, 260px); }
}
/* 사진 초상: 사진 비율 그대로(잘리지 않게), 칸 가운데 */
.cs-portrait:has(img) { height: auto; aspect-ratio: 421 / 541; width: min(100%, 230px); margin: 0 auto; }
.cs-portrait:has(img) img { object-position: center top; }
@media (max-height: 760px) and (min-width: 641px) { .cs-portrait:has(img) { height: auto; width: min(100%, 190px); } }
@media (max-width: 760px) { .cs-portrait:has(img) { height: auto; width: 150px; margin: 0; } }
@media (max-width: 640px) { .kind-intro .cs-portrait:has(img) { height: auto; width: 78px; } }
.cs-portrait:has(img)::before { display: none; }

/* 능력치 특수 값: MAX(넘침·깜빡임) / ERR(측정 불가 지직) */
.cs-stat { grid-template-columns: 108px minmax(0, 1fr) 34px; }
.cs-stat.is-max i { overflow: visible; }
.cs-stat.is-max i::after { background: linear-gradient(90deg, var(--g-gold), #fff1b8); box-shadow: 0 0 14px rgba(255, 201, 74, 0.8); -webkit-mask: none; mask: none; }
.deck-caption.in .cs-stat.is-max i::after { animation: cs-bar 0.7s calc(0.35s + var(--d)) cubic-bezier(.2, .9, .3, 1) forwards, cs-over 0.9s calc(1.1s + var(--d)) ease-in-out infinite alternate; }
.cs-stat.is-max b { color: var(--g-gold); animation: cs-blink 0.8s steps(2) infinite; }
.cs-stat.is-err i::after { background: repeating-linear-gradient(90deg, #ff5a6e 0 6px, transparent 6px 9px); -webkit-mask: none; mask: none; }
.deck-caption.in .cs-stat.is-err i::after { animation: cs-bar 0.3s calc(0.35s + var(--d)) forwards, cs-glitch 0.35s calc(0.7s + var(--d)) steps(3) infinite; }
.cs-stat.is-err b { color: #ff5a6e; animation: cs-glitch-text 1.2s steps(2) infinite; }
@keyframes cs-over { from { transform: scaleX(1); } to { transform: scaleX(1.04); } }
@keyframes cs-blink { 50% { opacity: 0.35; } }
@keyframes cs-glitch { 0% { transform: scaleX(0.35); } 33% { transform: scaleX(0.85); } 66% { transform: scaleX(0.15); } 100% { transform: scaleX(0.6); } }
@keyframes cs-glitch-text { 50% { transform: translateX(-2px); opacity: 0.6; } }
@media (max-width: 640px) { .kind-intro .cs-stat { grid-template-columns: 96px minmax(0, 1fr) 34px; } }
.cs-stat b { position: relative; z-index: 1; text-shadow: 0 0 6px rgba(0, 0, 0, 0.9); }
/* ERR는 차분하게: 게이지는 멈춰 있다가 4초에 한 번 살짝 흔들리고, 글자는 고정 */
.deck-caption.in .cs-stat.is-err i::after { animation: cs-bar 0.5s calc(0.35s + var(--d)) forwards, cs-glitch-soft 4s calc(1.5s + var(--d)) infinite; }
.cs-stat.is-err b { animation: none; }
.cs-stat.is-err i::after { opacity: 0.85; }
@keyframes cs-glitch-soft { 0%, 92%, 100% { transform: scaleX(0.6); } 94% { transform: scaleX(0.5); } 96% { transform: scaleX(0.66); } }

/* 휴대폰: 사진·숫자가 많은 카드도 카드 안 스크롤 없이 */
@media (max-width: 640px) {
  .deck-caption.is-spot, .deck-caption.is-center:not(.kind-intro) { max-height: calc(100% - 112px - env(safe-area-inset-bottom, 0px)); padding: 16px 16px 14px; }
  .deck-caption .dk-title { font-size: 22px; margin-top: 10px; }
  .deck-caption .dk-body { font-size: 13.5px; line-height: 1.55; }
  .deck-caption .dk-metrics { margin-top: 10px; }
  .deck-caption .dk-metric b { font-size: 20px; }
  .deck-caption .dk-photos { margin-top: 10px; }
  .deck-caption .dk-photos img, .deck-caption .dk-photos.n1 img { max-height: 92px; }
  .deck-caption .dk-note { margin-top: 8px; }
  .kind-end .dk-list { gap: 6px; margin-top: 12px; padding-top: 10px; }
  .kind-end .dk-list span { font-size: 12px; line-height: 1.4; }
}

/* Site integration: keep a pointer-accessible exit on small screens. */
.archive-back { display: inline-block; margin-top: 16px; color: #d9e3e0; font-size: 13px; text-underline-offset: 4px; }
.hs-top { flex-wrap: wrap; }
.deck-bar { width: max-content; max-width: calc(100% - 24px); }
.deck-bar button { white-space: nowrap; flex: none; }
.hs-top .hs-hint { flex: 1; min-width: 180px; }
.fullscreen-button, #deck-full {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none;
  border: 1px solid var(--g-mint); padding: 9px 14px; min-height: 40px;
  background: rgba(6, 16, 18, 0.88); color: var(--g-mint); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.fullscreen-button:hover, #deck-full:hover { background: var(--g-mint); color: #071012; }
[data-fullscreen] [aria-hidden] { font-size: 22px; line-height: 1; }
#fullscreen-notice {
  position: fixed; z-index: 60; left: 50%; bottom: max(90px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; width: min(560px, calc(100% - 32px));
  padding: 16px; background: #101b20; color: #f2f6f5; border: 1px solid var(--g-mint); font-size: 14px;
}
#fullscreen-notice span { flex-basis: 100%; }
#fullscreen-notice a { color: var(--g-mint); text-underline-offset: 3px; }
#fullscreen-notice button { margin-left: auto; padding: 5px 10px; color: #f2f6f5; border: 1px solid #647872; background: transparent; }
@media (max-width: 760px) {
  .hs-top .hs-hint { flex-basis: 100%; order: 3; text-align: left; }
  .hs-top .fullscreen-button { margin-left: auto; }
  #deck-full .full-label { display: none; }
  #deck-full { min-width: 38px; }
  #deck-exit { display: inline-flex; align-items: center; }
  .deck-bar { max-width: calc(100% - 24px); }
  .deck-bar button { padding: 9px 10px; white-space: nowrap; }
}
@media (max-width: 360px) {
  .deck-bar button { padding-inline: 7px; }
}
