/* ============================================================
   낙원섬 — Nakwon Island
   Dark tropical night · glass HUD · mobile first
   ============================================================ */

@font-face {
  font-family: "Pretendard";
  src: url("../assets/fonts/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pretendard";
  src: url("../assets/fonts/Pretendard-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pretendard";
  src: url("../assets/fonts/Pretendard-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #04080f;
  --bg-2: #071018;
  --ink: #eaf6f3;
  --ink-dim: #c3d6d4;
  --muted: #8298a0;
  --mint: #5eead4;
  --mint-deep: #2bb3a0;
  --coral: #ff7d7d;
  --coral-deep: #e05a5a;
  --amber: #ffc86b;
  --line: rgba(120, 226, 207, 0.14);
  --line-strong: rgba(120, 226, 207, 0.28);
  --rule: rgba(234, 246, 243, 0.15);
  --rule-soft: rgba(234, 246, 243, 0.06);
  --faint: #617279;
  --clay: #c08a80;
  --glass: linear-gradient(158deg, rgba(11, 22, 31, 0.82) 0%, rgba(5, 12, 19, 0.78) 100%);
  --glass-solid: rgba(8, 16, 24, 0.94);
  --shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.85), 0 2px 10px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --topbar-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  touch-action: pan-x pan-y;
}

button { font-family: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
input { font-family: inherit; }
::selection { background: rgba(94, 234, 212, 0.28); }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 42%, transparent material 42%, transparent 42%),
    radial-gradient(130% 100% at 50% 45%, transparent 52%, rgba(2, 6, 10, 0.55) 100%),
    linear-gradient(180deg, rgba(3, 7, 12, 0.72) 0%, transparent 18%, transparent 72%, rgba(2, 6, 10, 0.78) 100%);
  z-index: 1;
}

/* ─────────────────────────── glass ─────────────────────────── */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
}

/* ─────────────────────────── top bar ────────────────────────── */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 440px) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px 24px calc(18px + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  width: max-content;
}
.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--mint);
  filter: drop-shadow(0 0 14px rgba(94, 234, 212, 0.38));
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.brand-text em {
  margin-top: 4px;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--mint);
  opacity: 0.75;
}

/* search */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  background: rgba(7, 15, 22, 0.78);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 34px -16px rgba(0, 0, 0, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.search:focus-within {
  border-color: var(--line-strong);
  background: rgba(9, 20, 28, 0.92);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.07), 0 10px 34px -16px rgba(0, 0, 0, 0.9);
}
.i-search { width: 18px; height: 18px; color: var(--mint); opacity: 0.85; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.search input::placeholder { color: var(--muted); font-weight: 400; }
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1;
}

.suggest {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 7px;
  background: var(--glass-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-height: 320px;
  overflow-y: auto;
  z-index: 40;
}
.suggest[hidden] { display: none; }
.sug {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--ink-dim);
}
.sug:hover, .sug.is-active { background: rgba(94, 234, 212, 0.08); color: var(--ink); }
.sug .sug-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.7);
  flex: none;
}
.sug.is-dead .sug-dot { background: var(--coral); box-shadow: 0 0 10px rgba(255, 125, 125, 0.55); }
.sug .sug-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug .sug-state { font-size: 11.5px; color: var(--muted); flex: none; }
.sug.is-create { color: var(--mint); font-weight: 600; }
.sug.is-create .sug-glyph {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1px dashed var(--line-strong); font-size: 13px; color: var(--mint);
}
.sug-empty { padding: 14px 12px; font-size: 13px; color: var(--muted); }

/* actions */
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { transform: scale(0.975); }
.btn-primary {
  background: linear-gradient(180deg, #79f7e2, #35c9b4);
  color: #032018;
  box-shadow: 0 10px 26px -10px rgba(94, 234, 212, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:hover { box-shadow: 0 12px 30px -8px rgba(94, 234, 212, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-ghost {
  background: rgba(8, 17, 25, 0.7);
  border-color: var(--line);
  color: var(--ink-dim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.btn-ghost:hover { background: rgba(13, 28, 38, 0.9); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost.is-on {
  color: #04231c;
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.95), rgba(64, 205, 186, 0.95));
  border-color: transparent;
}
.btn-small { height: 36px; padding: 0 12px; font-size: 12.5px; }
.btn-block { width: 100%; height: 48px; font-size: 15px; }
.btn-revive {
  background: linear-gradient(180deg, #ffd79a, #ffb648);
  color: #2a1602;
  box-shadow: 0 10px 24px -12px rgba(255, 184, 72, 0.8);
}
.btn:disabled { opacity: 0.45; cursor: default; }
.dot-badge {
  width: 7px; height: 7px;
  margin-left: 1px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 0 rgba(255, 125, 125, 0.5);
  animation: pulseBadge 2.2s ease-out infinite;
}
@keyframes pulseBadge {
  0% { box-shadow: 0 0 0 0 rgba(255, 125, 125, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(255, 125, 125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 125, 125, 0); }
}

/* ─────────────────────────── mission card ───────────────────── */
.mission {
  position: absolute;
  left: 24px;
  bottom: calc(24px + var(--safe-b));
  z-index: 20;
  width: 344px;
  padding: 20px 22px 18px;
  animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both 0.15s;
}
.mission-kicker {
  margin: 0 0 10px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--mint);
  opacity: 0.8;
}
.mission-title {
  margin: 0 0 9px;
  font-size: 21px;
  line-height: 1.32;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.mission-title span { color: var(--mint); }
.mission-copy {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  word-break: keep-all;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.stat { display: flex; flex-direction: column; gap: 3px; }
.stat b {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat:nth-child(2) b { color: var(--coral); }
.stat:nth-child(3) b { color: var(--amber); }
.stat span { font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; }

/* ─────────────────────────── ticker ─────────────────────────── */
.ticker {
  position: absolute;
  top: 94px;
  right: 24px;
  z-index: 20;
  width: 334px;
  padding: 13px 6px 8px;
  animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both 0.3s;
}
.ticker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 10px rgba(255, 125, 125, 0.9);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.ticker-more {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--mint);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.ticker-list {
  list-style: none;
  margin: 0;
  padding: 4px 4px 2px;
  max-height: min(40vh, 330px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.ticker-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
  animation: tickIn 0.4s ease both;
}
.ticker-list li + li { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.ticker-list time {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.ticker-list .t-handle { color: var(--mint); font-weight: 600; }
.ticker-list li.is-death { color: #ffc2c2; }
.ticker-list li.is-death .t-handle { color: var(--coral); }
.ticker-list li.is-romance .t-handle { color: #ffb3d1; }
.ticker-list li.is-mob { color: #ffd6a8; }
.ticker-list strong { font-weight: 600; color: var(--ink); }
@keyframes tickIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

/* ─────────────────────────── hint ─────────────────────────── */
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 21;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(5, 12, 19, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: -0.01em;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
  animation: hintIn 1s ease both 1s;
}
@keyframes hintIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.hint.is-gone { opacity: 0; transform: translateX(-50%) translateY(8px); }

/* ─────────────────────────── focus card ────────────────────── */
.focus {
  position: absolute;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 25;
  width: 342px;
  padding: 16px 18px 15px;
  animation: focusIn 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes focusIn {
  from { opacity: 0; transform: translate(-50%, 14px) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.focus[hidden] { display: none; }
.focus-close {
  position: absolute;
  top: 8px; right: 8px;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.focus-close:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.focus-close svg { width: 15px; height: 15px; }
.focus-top { display: flex; align-items: center; gap: 11px; padding-right: 26px; }
.focus-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent, linear-gradient(145deg, #5eead4, #1d7a6c));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 18px -8px rgba(0, 0, 0, 0.9);
  flex: none;
}
.focus-handle {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-meta { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.focus-hp {
  margin: 13px 0 9px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.focus-hp i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2bb3a0, #5eead4);
  transition: width 0.4s ease, background 0.4s ease;
}
.focus-hp i.is-low { background: linear-gradient(90deg, #e05a5a, #ff9a9a); }
.focus-hp i.is-mid { background: linear-gradient(90deg, #d99a3c, #ffc86b); }
.focus-reason {
  margin: 0 0 13px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  word-break: keep-all;
}
.focus-reason b { color: var(--ink-dim); font-weight: 600; }
.focus-actions { display: flex; gap: 7px; }
.focus-actions .btn { flex: 1; padding: 0 8px; }

.view-fab {
  position: absolute;
  right: 24px;
  bottom: calc(24px + var(--safe-b));
  z-index: 22;
}
.fab {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink-dim);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.fab:hover { color: var(--mint); border-color: var(--line-strong); transform: translateY(-2px); }
.fab svg { width: 22px; height: 22px; }

/* ─────────────────────────── sheets ────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}
.sheet[hidden] { display: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 10, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease both;
}
.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 452px;
  max-width: 100%;
  height: 100%;
  padding: 22px 22px calc(18px + var(--safe-b));
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(94, 234, 212, 0.08), transparent 60%),
    linear-gradient(180deg, #09131c 0%, #050c13 100%);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.9);
  animation: slideIn 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: hidden;
}
.spawn-panel {
  width: 430px;
  margin: auto;
  height: auto;
  max-height: min(92vh, 780px);
  border: 1px solid var(--line);
  border-radius: 24px;
  animation: popIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow-y: auto;
}
#spawn { align-items: center; justify-content: center; padding: 18px; }
.sheet-grip { display: none; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: translateY(16px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 18px;
}
.eyebrow {
  margin: 0 0 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--mint);
  opacity: 0.8;
}
.sheet-head h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.sheet-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; word-break: keep-all; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  flex: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── roster · 편집면(ledger) 스타일 ─────────────────────────── */
.roster-panel {
  padding: 30px 30px calc(20px + var(--safe-b));
  background: #080d11;
  border-left: 1px solid var(--rule);
}
.roster-panel .icon-btn { border-radius: 2px; border-color: var(--rule); background: transparent; }
.roster-panel .sheet-head { padding-bottom: 20px; }
.roster-panel .sheet-head h2 { font-size: 26px; letter-spacing: -0.045em; }
.roster-panel .sheet-sub { margin-top: 8px; letter-spacing: 0.01em; }

.roster-figures {
  display: flex;
  align-items: baseline;
  margin: 0 0 22px;
  padding: 15px 0 17px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.roster-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  margin: 0;
  min-width: 0;
}
.roster-figure span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.roster-figure b {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.roster-figure em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.roster-figure.is-dead { padding-left: 20px; border-left: 1px solid var(--rule); }
.roster-figure.is-zero b { color: var(--muted); }

.tabs {
  display: flex;
  gap: 24px;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}
.tab {
  padding: 0 0 9px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--faint);
}
.tab:hover { color: var(--ink-dim); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.roster-body {
  flex: 1;
  min-height: 0;
  margin-top: 26px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.roster-section { margin-bottom: 34px; }
.roster-section:last-child { margin-bottom: 8px; }
.roster-section h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 2px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.roster-section h3 .sec-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--ink-dim);
}
.roster-section.is-dead h3,
.roster-section.is-dead h3 .sec-count { color: var(--clay); }

.roster-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 12px 2px 11px;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  border-radius: 0;
  background: transparent;
  text-align: left;
  transition: background 0.16s ease;
}
.roster-row:last-child { border-bottom: 0; }
.roster-row:hover { background: rgba(255, 255, 255, 0.028); }
.roster-rank {
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.roster-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-row.is-deadRow .roster-name { color: var(--ink-dim); }
.roster-meta {
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.roster-tag {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.roster-revive {
  flex: none;
  padding-bottom: 1px;
  border-bottom: 1px solid rgba(192, 138, 128, 0.45);
  font-size: 11px;
  font-weight: 600;
  color: var(--clay);
  white-space: nowrap;
}
.roster-revive:hover { color: #d9aa9c; border-bottom-color: #d9aa9c; }
.roster-empty {
  margin: 0;
  padding: 14px 2px 16px;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--faint);
}
.roster-empty b { font-weight: 600; color: var(--ink-dim); }

.roster-panel .sheet-foot { padding-top: 18px; }
.roster-panel .foot-actions .btn {
  border-radius: 2px;
  border: 1px solid rgba(234, 246, 243, 0.16);
  background: transparent;
  color: var(--ink-dim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
.roster-panel .foot-actions .btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(234, 246, 243, 0.3);
  color: var(--ink);
}

.sheet-foot { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.share-note {
  margin: 0 0 11px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
}
.share-note b { color: var(--ink-dim); }
.foot-actions { display: flex; gap: 8px; }
.foot-actions .btn { flex: 1; }
.proto-note { margin: 10px 0 0; font-size: 10px; color: rgba(130, 152, 160, 0.72); letter-spacing: 0.01em; }

/* spawn form */
.field { display: block; margin-bottom: 17px; }
.field > span { display: block; margin-bottom: 8px; font-size: 11.5px; font-weight: 600; color: var(--ink-dim); letter-spacing: 0.01em; }
.field-input {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 50px;
  padding: 0 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field-input:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.06); }
.field-input i { font-style: normal; color: var(--mint); font-size: 16px; opacity: 0.7; }
.field-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.field-input input::placeholder { color: rgba(130, 152, 160, 0.55); font-weight: 400; }
.field-error { display: block; margin-top: 7px; font-size: 11.5px; color: var(--coral); }
.field-error[hidden] { display: none; }

.swatches { display: flex; gap: 9px; }
.swatch {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--sw);
  transition: transform 0.15s ease;
}
.swatch::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s ease;
}
.swatch[aria-checked="true"]::after { border-color: var(--mint); }
.swatch:hover { transform: translateY(-2px); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s ease;
}
.chip:hover { color: var(--ink-dim); border-color: rgba(255, 255, 255, 0.16); }
.chip[aria-checked="true"] {
  color: #04231c;
  background: linear-gradient(180deg, #7ef7e3, #43cfba);
  border-color: transparent;
  font-weight: 600;
}

.spawn-preview {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 4px 0 18px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(120, 226, 207, 0.22);
  background: rgba(94, 234, 212, 0.04);
}
.preview-figure {
  position: relative;
  width: 42px; height: 48px;
  flex: none;
}
.preview-figure b {
  position: absolute;
  left: 50%; bottom: 0;
  width: 22px; height: 24px;
  transform: translateX(-50%);
  border-radius: 8px 8px 6px 6px;
  background: var(--preview, #5eead4);
}
.preview-figure i {
  position: absolute;
  left: 50%; top: 2px;
  width: 18px; height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #f0c9a8;
  box-shadow: inset 0 5px 0 -2px #2a211c;
}
.spawn-preview p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.spawn-preview b { color: var(--ink); font-size: 14px; }

/* ─────────────────────────── toasts ────────────────────────── */
.toasts {
  position: absolute;
  top: calc(92px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(6, 14, 21, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 12.5px;
  color: var(--ink-dim);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.toast.is-out { animation: toastOut 0.4s ease forwards; }
.toast b { color: var(--ink); font-weight: 600; }
.toast .toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); flex: none; }
.toast.is-death { border-color: rgba(255, 125, 125, 0.3); }
.toast.is-death .toast-dot { background: var(--coral); }
.toast.is-romance .toast-dot { background: #ffb3d1; }
.toast.is-revive .toast-dot { background: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ─────────────────────────── boot ─────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(80% 60% at 50% 40%, #0a1c26 0%, #04080f 70%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.boot.is-done { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-mark { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.boot-mark span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint);
  animation: bootPulse 1.2s ease-in-out infinite;
}
.boot-mark span:nth-child(2) { animation-delay: 0.15s; }
.boot-mark span:nth-child(3) { animation-delay: 0.3s; }
.boot-inner p { margin: 0; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }
@keyframes bootPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ─────────────────────────── director ─────────────────────── */
.director {
  position: absolute;
  top: calc(94px + env(safe-area-inset-top, 0px));
  left: 24px;
  z-index: 45;
  width: 304px;
  max-height: calc(100vh - 130px);
  padding: 0 0 14px;
  overflow-y: auto;
  animation: rise 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  border-color: rgba(255, 200, 107, 0.2);
}
.director[hidden] { display: none; }
.dir-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  background: rgba(7, 14, 20, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.dir-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 9px rgba(255, 200, 107, 0.8);
}
.dir-head b { font-size: 11px; letter-spacing: 0.18em; color: var(--amber); font-weight: 700; }
.dir-sub { font-size: 10.5px; color: var(--muted); }
.dir-close { margin-left: auto; display: grid; place-items: center; width: 24px; height: 24px; border: 0; background: none; color: var(--muted); border-radius: 50%; }
.dir-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.dir-close svg { width: 13px; height: 13px; }

.dir-target {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 14px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--muted);
}
.dir-target b { font-size: 12px; color: var(--ink); font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-pick { margin-left: auto; border: 0; background: none; color: var(--mint); font-size: 10.5px; padding: 0; }

.dir-switches { display: flex; flex-direction: column; gap: 9px; margin: 13px 14px 0; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--ink-dim); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i {
  position: relative;
  width: 32px; height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
  flex: none;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #9fb2b8;
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch input:checked + i { background: rgba(94, 234, 212, 0.35); }
.switch input:checked + i::after { transform: translateX(14px); background: var(--mint); }

.dir-record { display: flex; align-items: center; gap: 7px; margin: 14px 14px 0; }
.dir-record .btn { flex: 1; }
.dir-record .btn.is-recording { background: linear-gradient(180deg, #ff9a9a, #e05a5a); color: #2a0808; }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dir-timer { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.dir-note { margin: 7px 14px 0; font-size: 10px; line-height: 1.5; color: rgba(130, 152, 160, 0.8); }
.dir-save {
  display: block;
  margin: 8px 14px 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(94, 234, 212, 0.12);
  color: var(--mint);
  font-size: 11.5px;
  text-align: center;
  text-decoration: none;
}
.dir-save[hidden] { display: none; }
.dir-section { margin: 15px 14px 7px; font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted); }
.dir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 14px; }
.dir-grid.two { grid-template-columns: 1fr 1fr; }
.dir-grid button {
  padding: 9px 6px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-dim);
  font-size: 11.5px;
  font-weight: 500;
  transition: all 0.16s ease;
}
.dir-grid button:hover { background: rgba(94, 234, 212, 0.1); border-color: rgba(94, 234, 212, 0.3); color: var(--mint); }
.dir-grid button:active { transform: scale(0.97); }
.dir-foot { margin: 13px 14px 0; font-size: 9.5px; color: rgba(130, 152, 160, 0.6); }
.dir-foot code { font-family: inherit; color: rgba(94, 234, 212, 0.7); }

.rec-indicator {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(30, 5, 8, 0.82);
  border: 1px solid rgba(255, 125, 125, 0.35);
  color: #ffb3b3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  backdrop-filter: blur(10px);
}
.rec-indicator[hidden] { display: none; }
.rec-indicator i { width: 6px; height: 6px; border-radius: 50%; background: #ff5d5d; animation: blink 1s ease-in-out infinite; }

/* 9:16 frame guide */
.frame-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  z-index: 12;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}
.frame-guide[hidden] { display: none; }
.frame-guide .g { position: absolute; background: rgba(255, 255, 255, 0.1); }
.frame-guide .v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.frame-guide .v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.frame-guide .h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.frame-guide .h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.frame-guide .fg-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.4);
}

/* 9:16 canvas mode */
body.frame-916 { background: #000; }
body.frame-916 #app { background: #000; }
body.frame-916 #scene {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 9 / 16));
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 100vh;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 90px rgba(0, 0, 0, 0.85);
}
body.frame-916 .vignette {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 9 / 16));
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 100vh;
  border-radius: 6px;
}
body.frame-916 .topbar,
body.frame-916 .mission,
body.frame-916 .ticker,
body.frame-916 .hint,
body.frame-916 .focus,
body.frame-916 .view-fab { display: none !important; }
body.frame-916 .director { z-index: 46; }

@media (max-width: 900px) {
  .director {
    top: auto;
    left: 14px;
    right: 14px;
    width: auto;
    bottom: calc(14px + var(--safe-b));
    max-height: 62vh;
  }
  body.frame-916 .director { bottom: calc(14px + var(--safe-b)); max-height: 40vh; }
}

/* ticker event colors */
.ticker-list li.is-chaos { color: #ffd9a8; }
.ticker-list li.is-chaos .t-handle { color: var(--amber); }

/* ─────────────────────────── scrollbars ────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ─────────────────────────── responsive ────────────────────── */
@media (max-width: 1180px) {
  .mission { width: 310px; }
  .ticker { width: 300px; }
  .topbar { grid-template-columns: auto minmax(240px, 1fr) auto; }
  .btn-ghost span { display: none; }
  .btn-ghost { width: 42px; padding: 0; }
  .actions .btn-primary span { display: inline; }
}

@media (max-width: 900px) {
  .mission { display: none; }
  .view-fab { bottom: calc(112px + var(--safe-b)); }
  .ticker {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: calc(14px + var(--safe-b));
    width: auto;
    padding: 10px 4px 6px;
    border-radius: 16px;
  }
  .ticker-list { max-height: 92px; }
  .ticker-list li { grid-template-columns: 36px 1fr; padding: 5px 8px; font-size: 11.5px; }
  .ticker-list li:nth-child(n + 3) { display: none; }
  .hint { bottom: calc(146px + var(--safe-b)); }
  .focus { bottom: calc(128px + var(--safe-b)); }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand actions" "search search";
    gap: 10px;
    padding: 12px 14px calc(10px + env(safe-area-inset-top, 0px));
  }
  .brand { grid-area: brand; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text strong { font-size: 17px; }
  .brand-text em { font-size: 7.5px; }
  .actions { grid-area: actions; gap: 6px; }
  .btn { height: 38px; }
  .btn-primary { padding: 0 13px; font-size: 12.5px; }
  .btn-ghost { width: 38px; height: 38px; }
  .search { grid-area: search; height: 44px; }
  .search-kbd { display: none; }
  .suggest { max-height: 46vh; }

  .ticker { display: none; }
  .hint { bottom: calc(24px + var(--safe-b)); font-size: 11px; padding: 8px 13px; }
  .focus { width: calc(100vw - 28px); bottom: calc(20px + var(--safe-b)); }
  .view-fab { right: 14px; bottom: calc(84px + var(--safe-b)); }
  .fab { width: 42px; height: 42px; }

  .sheet { align-items: flex-end; }
  .sheet-panel {
    width: 100%;
    height: auto;
    max-height: 90vh;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
    padding: 10px 18px calc(16px + var(--safe-b));
    animation: sheetUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .roster-panel { height: 92vh; max-height: 92vh; }
  .sheet-grip {
    display: block;
    width: 40px; height: 4px;
    margin: 0 auto 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.16);
  }
  .sheet-head h2 { font-size: 21px; }
  .roster-body { max-height: none; }
  .toasts { top: calc(112px + env(safe-area-inset-top, 0px)); }
  #spawn { padding: 0; align-items: flex-end; }
  .spawn-panel { max-height: 94vh; border-radius: 24px 24px 0 0; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }

@media (max-width: 420px) {
  .btn-primary span { display: inline; }
  .sheet { }
  .roster-figure b { font-size: 26px; }
  .roster-figure.is-dead { padding-left: 14px; }
}

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

/* ── mobile compaction (director 통합 이후) ─────────────────── */
@media (max-width: 760px) {
  .topbar { padding: 10px 12px calc(9px + env(safe-area-inset-top, 0px)); gap: 8px; }
  .brand-text em { display: none; }
  .brand-text strong { font-size: 16px; letter-spacing: -0.03em; }
  .brand-mark { width: 30px; height: 30px; }
  .actions { gap: 5px; min-width: 0; }
  .btn-primary { height: 36px; padding: 0 11px; font-size: 12px; gap: 5px; }
  .btn-primary svg { width: 15px; height: 15px; }
  .btn-ghost { width: 36px; height: 36px; }
  .search { height: 42px; padding: 0 12px; }
  .search input { font-size: 13.5px; }

  .ticker {
    display: block;
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-b));
    padding: 8px 4px 4px;
  }
  .ticker-head { padding: 0 10px 7px; font-size: 9px; }
  .ticker-list { max-height: 78px; }
  .ticker-list li { grid-template-columns: 30px 1fr; padding: 4px 8px; font-size: 11px; }
  .ticker-list li:nth-child(n + 3) { display: none; }

  .hint {
    bottom: calc(168px + var(--safe-b));
    max-width: calc(100vw - 32px);
    text-align: center;
    line-height: 1.45;
  }
  .view-fab { bottom: calc(112px + var(--safe-b)); }
  .toasts { top: calc(108px + env(safe-area-inset-top, 0px)); }
  .focus { bottom: calc(16px + var(--safe-b)); }
  .sheet-foot .share-note { font-size: 11px; }
}

@media (max-width: 360px) {
  .btn-primary span { display: none; }
  .btn-primary { width: 36px; padding: 0; }
}
