:root {
  --ink: #0a0f14;
  --panel: rgba(10, 15, 20, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --sand: #efe6cf;
  --muted: #a9b3a6;
  --olive: #7d8f52;
  --magic: #8fd8ff;
  --gold: #ffc94a;
  --danger: #ff5a3c;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --title: "Black Han Sans", "Pretendard", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05070a;
  color: var(--sand);
  font-family: "Pretendard", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#mage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.view, .view-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.labels, .hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

button { font: inherit; color: inherit; }

/* world labels */
.tag, .float, .pointer {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.tag > span {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translate(-50%, 0);
  white-space: nowrap;
}

.tag.name > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(8, 12, 16, 0.62);
  color: #f3eedf;
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: opacity 0.25s;
}

.talking .tag.name > span { opacity: 0; }
.talking .tag.bubble:not(.zzz) > span { visibility: hidden; }

.tag.mark > span {
  bottom: 22px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #2a1e00;
  font: 900 20px/1 var(--title);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(255, 201, 74, 0.5);
  animation: markPop 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.tag.mark.alarm > span {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 90, 60, 0.8);
  animation: markPulse 1.2s ease-in-out infinite alternate;
}

@keyframes markPop { from { transform: translate(-50%, 0) scale(0.2); } }
@keyframes markPulse { to { transform: translate(-50%, 0) scale(1.18); } }

.tag.bubble > span {
  bottom: 26px;
  max-width: 180px;
  white-space: normal;
  width: max-content;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fbf7ec;
  color: #1d1f1a;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  animation: bubble 2.6s ease both;
}

.tag.bubble > span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.tag.bubble.zzz > span {
  background: none;
  box-shadow: none;
  color: #bcd2ff;
  font-style: italic;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  animation: zzz 2.4s ease-out both;
}

.tag.bubble.zzz > span::after { display: none; }

@keyframes bubble {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.85); }
  8%, 88% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

@keyframes zzz {
  0% { opacity: 0; transform: translate(-30%, 8px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(10%, -26px); }
}

.tag.hpbar > span {
  bottom: 4px;
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tag.hpbar > span > i {
  display: block;
  height: 100%;
  width: calc(var(--v, 1) * 100%);
  background: linear-gradient(90deg, #b48cff, #e3d6ff);
  transition: width 0.12s;
}

.float {
  font: 800 16px/1 "Pretendard", sans-serif;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  translate: -50% -50%;
}

.float.dmg.big { font-size: 24px; color: #ffcf7a; }
.float.gold { color: var(--gold); font-size: 18px; }
.float.heal { color: #6dffa6; font-size: 18px; }
.float.snap { font: 400 26px/1 var(--title); color: #fff; }

.pointer {
  pointer-events: none;
}

.pointer > i {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 14px rgba(255, 201, 74, 0.8);
  animation: bob 1s ease-in-out infinite alternate;
}

.pointer.edge > i {
  clip-path: polygon(0 0, 100% 50%, 0 100%, 25% 50%);
  border-radius: 0;
  animation: none;
}

.pointer > b {
  position: absolute;
  left: 0;
  top: 14px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--gold);
  white-space: nowrap;
}

.pointer.casing > i, .pointer.casing > b { pointer-events: auto; cursor: pointer; }
.pointer.casing > b::before { content: ""; position: absolute; inset: -10px -8px; }
.pointer.report > i { background: var(--magic); box-shadow: 0 0 14px rgba(143, 216, 255, 0.8); }
.pointer.report > b { color: var(--magic); }
.pointer.phone > i { background: var(--danger); box-shadow: 0 0 16px rgba(255, 90, 60, 0.9); animation: ring 0.6s ease-in-out infinite alternate; }
.pointer.phone > b { color: #ffb4a6; }

@keyframes bob { to { translate: 0 -5px; } }
@keyframes ring { from { rotate: -12deg; } to { rotate: 12deg; } }

/* HUD */
.hud { transition: opacity 0.3s; }
.hud.dim { opacity: 0; }
.hud.dim * { pointer-events: none !important; }

.hud-top {
  position: absolute;
  top: calc(var(--safe-t) + 12px);
  left: 12px;
  right: 12px;
}

.obj {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 9px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  max-width: calc(100% - 110px);
}

.obj small {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.obj b {
  font: 400 17px/1.1 var(--title);
  color: #fff;
  letter-spacing: 0.01em;
}

.obj.bump { animation: bump 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes bump { 40% { transform: scale(1.08); } }

.meter {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  width: min(300px, 64vw);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.meter .eye {
  width: 20px;
  height: 12px;
  border-radius: 50% / 60%;
  border: 2px solid #f3eedf;
  position: relative;
}

.meter .eye::after {
  content: "";
  position: absolute;
  inset: 1px 4px;
  border-radius: 50%;
  background: #f3eedf;
}

.meter .bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter .bar span {
  display: block;
  height: 100%;
  width: calc(var(--v, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, #ffe27a, #ffb43a);
  transition: width 0.1s linear;
}

.meter em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
}

.meter.warn .bar span { background: linear-gradient(90deg, #ffb43a, #ff7a3a); }
.meter.danger { border-color: rgba(255, 90, 60, 0.6); box-shadow: 0 0 22px rgba(255, 90, 60, 0.35); }
.meter.danger .bar span { background: linear-gradient(90deg, #ff7a3a, #ff3b30); }
.meter.danger em { color: #ffb4a6; }
.meter.rising .eye { border-color: var(--danger); animation: blink 0.8s ease-in-out infinite alternate; }
.meter.rising .eye::after { background: var(--danger); }
@keyframes blink { to { transform: scaleY(0.4); } }

.hp {
  position: absolute;
  left: 16px;
  bottom: calc(var(--safe-b) + 22px);
  width: min(42vw, 220px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.hp b { font: 400 14px/1 var(--title); color: #7dffb0; }
.hp em { font-style: normal; font-weight: 800; font-size: 13px; min-width: 26px; text-align: right; }
.hp .bar { height: 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.hp .bar span { display: block; height: 100%; width: calc(var(--v, 1) * 100%); background: linear-gradient(90deg, #3ddc84, #a6ffcb); transition: width 0.2s; }
.hp.low .bar span { background: linear-gradient(90deg, #ff3b30, #ff8a6b); }
.hp.low { animation: lowhp 1s ease-in-out infinite alternate; }
@keyframes lowhp { to { box-shadow: 0 0 22px rgba(255, 59, 48, 0.55); } }

.boss {
  position: absolute;
  left: 50%;
  top: 104px;
  transform: translateX(-50%);
  width: min(460px, 86vw);
  text-align: center;
}

.boss b {
  display: block;
  font: 400 15px/1 var(--title);
  color: #e3d6ff;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.boss .bar { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(180, 140, 255, 0.4); overflow: hidden; }
.boss .bar span { display: block; height: 100%; width: calc(var(--v, 1) * 100%); background: linear-gradient(90deg, #6b3bff, #c4a6ff); transition: width 0.15s; }

.skills {
  position: absolute;
  right: 14px;
  bottom: calc(var(--safe-b) + 18px);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}

.skill {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(143, 216, 255, 0.55);
  background: radial-gradient(circle at 50% 35%, rgba(60, 110, 140, 0.85), rgba(10, 20, 30, 0.9));
  color: #dff5ff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 0 16px rgba(143, 216, 255, 0.25);
  transition: transform 0.12s ease, box-shadow 0.2s;
  touch-action: manipulation;
}

.skill svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.skill.big { width: 80px; height: 80px; }
.skill.big svg { width: 30px; height: 30px; }
.skill b { font-size: 11px; font-weight: 800; letter-spacing: -0.01em; }
.skill:active { transform: scale(0.92); }

.skill .cd {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(5, 8, 12, 0.78) calc(var(--cd, 0) * 360deg), transparent 0);
  pointer-events: none;
}

.skill.cooling { color: #7c8c94; border-color: rgba(255, 255, 255, 0.15); }
.skill.aiming { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 201, 74, 0.25), 0 0 26px rgba(255, 201, 74, 0.55); }
.skill.off { opacity: 0.4; }
.skill.ready {
  border-color: var(--gold);
  color: #fff3cf;
  animation: tk-ready 0.9s ease-in-out infinite alternate;
}
@keyframes tk-ready {
  from { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(255, 201, 74, 0.2), 0 0 16px rgba(255, 201, 74, 0.35); }
  to { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 201, 74, 0.1), 0 0 30px rgba(255, 201, 74, 0.7); }
}

.skill kbd {
  position: absolute;
  top: -6px;
  right: -4px;
  font: 700 10px/1 "Pretendard", sans-serif;
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--line);
  color: var(--muted);
}

@media (pointer: coarse) { .skill kbd { display: none; } }

.coach {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-t) + 104px);
  transform: translate(-50%, -6px);
  width: max-content;
  max-width: min(92vw, 520px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(12, 22, 30, 0.86);
  border: 1px solid rgba(143, 216, 255, 0.35);
  font-size: 13.5px;
  line-height: 1.45;
  text-align: center;
  color: #e9f6ff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.coach.in { opacity: 1; transform: translate(-50%, 0); }
.coach b { color: var(--magic); }
.coach em { color: var(--gold); font-style: normal; font-weight: 800; }
.talking .coach { opacity: 0; }

.toasts {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(10, 15, 20, 0.82);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.in { opacity: 1; transform: none; }
.toast b { color: var(--gold); font-size: 16px; }
.toast.danger { border-color: rgba(255, 90, 60, 0.6); color: #ffcabf; }

.banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 30%;
  text-align: center;
  pointer-events: none;
  animation: banner 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.banner b {
  display: block;
  font: 400 clamp(34px, 9vw, 64px)/1 var(--title);
  color: #fff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.02em;
}

.banner small {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 14px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 15px;
  font-weight: 700;
  color: var(--magic);
}

.banner.small b { font-size: clamp(24px, 6vw, 40px); }
.banner.danger b { color: #ffb4a6; }

@keyframes banner {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  14%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}

.flash { position: absolute; inset: 0; pointer-events: none; }

#mage.ouch::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 30, 0.55));
  animation: ouch 0.45s ease-out both;
}

@keyframes ouch { from { opacity: 1; } to { opacity: 0; } }

/* dialogue */
.dialog {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 16px);
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  min-height: 112px;
  padding: 16px 18px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(12, 17, 22, 0.86), rgba(6, 9, 12, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.dialog.pop { animation: dlgpop 0.22s ease-out; }
@keyframes dlgpop { from { transform: translate(-50%, 6px); opacity: 0.6; } }

.dlg-who {
  position: absolute;
  top: -15px;
  left: 16px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9px;
  background: var(--c);
  color: #0b0f12;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.dlg-who:empty { display: none; }
.dlg-who b { font: 400 16px/1 var(--title); letter-spacing: 0.02em; }
.dlg-who small { font-size: 11px; font-weight: 700; opacity: 0.75; }

.dlg-text {
  margin: 8px 0 0;
  font-size: clamp(15px, 4vw, 17.5px);
  line-height: 1.6;
  font-weight: 500;
  color: #f4f1e8;
  white-space: pre-wrap;
  word-break: keep-all;
}

.dialog.thought .dlg-text { color: #bfe8ff; font-style: italic; }
.dialog.narr { text-align: center; }
.dialog.narr .dlg-text { color: #e6dcc4; font-style: italic; margin-top: 4px; }

.dlg-next {
  position: absolute;
  right: 16px;
  bottom: 10px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: var(--magic);
  opacity: 0;
}

.dialog.ready .dlg-next { opacity: 1; animation: nudge 0.6s ease-in-out infinite alternate; }
@keyframes nudge { to { transform: translateY(4px); } }

.dlg-skip {
  position: absolute;
  top: calc(var(--safe-t) + 60px);
  right: 12px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  z-index: 3;
}

/* system */
.sys {
  position: absolute;
  top: calc(var(--safe-t) + 12px);
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 4;
}

.sys a, .sys button {
  height: 38px;
  min-width: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--sand);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.sys svg { width: 18px; height: 18px; }
.sys button .x { display: none; }
.sys button.off .wave { display: none; }
.sys button.off .x { display: inline; }

/* screens */
.curtain {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 6;
}

.curtain.on { opacity: 1; pointer-events: auto; }

.over { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.over.on { pointer-events: auto; }

.scr {
  position: absolute;
  inset: 0;
  display: grid;
  animation: scrIn 0.5s ease both;
}

@keyframes scrIn { from { opacity: 0; } }

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--magic);
  text-transform: uppercase;
}

.scr h1, .scr h2 { margin: 10px 0 0; font-weight: 400; font-family: var(--title); line-height: 0.95; }
.scr h1 span { display: block; font-size: clamp(26px, 7vw, 40px); color: #f3eedf; letter-spacing: 0.02em; }

.scr h1 b {
  display: block;
  margin-top: 4px;
  font-weight: 400;
  font-size: clamp(54px, 15vw, 104px);
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #ffffff 10%, #bfeaff 55%, #6fc4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(111, 196, 255, 0.55)) drop-shadow(0 6px 24px rgba(0, 0, 0, 0.6));
}

.scr .sub { margin: 14px 0 0; font-size: 15px; color: #d9d2bf; line-height: 1.55; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.btn {
  min-width: 140px;
  height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 22, 28, 0.75);
  color: #f3eedf;
  font: 400 19px/1 var(--title);
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(180deg, #a6e4ff, #5bb8f0); color: #06202f; border-color: transparent; box-shadow: 0 10px 30px rgba(91, 184, 240, 0.4); }
.btn.ghost { background: transparent; }

@media (hover: hover) {
  .btn:hover { background: rgba(30, 42, 52, 0.85); }
  .btn.primary:hover { box-shadow: 0 12px 36px rgba(91, 184, 240, 0.6); background: linear-gradient(180deg, #b9ebff, #6cc2f5); }
  .skill:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 0 22px rgba(143, 216, 255, 0.45); }
}

.scr-loading { background: radial-gradient(ellipse at 50% 30%, #13202c, #05070a 70%); place-items: center; text-align: center; padding: 24px; }
.loading .bar { width: min(280px, 70vw); height: 4px; margin: 28px auto 0; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.loading .bar span { display: block; height: 100%; width: 0; background: var(--magic); box-shadow: 0 0 12px var(--magic); transition: width 0.2s; }
.loading .pct { margin: 10px 0 0; font-size: 12px; color: var(--muted); font-weight: 700; }

.scr-title {
  background:
    linear-gradient(180deg, rgba(4, 8, 14, 0.55) 0%, transparent 28%, transparent 48%, rgba(4, 8, 12, 0.88) 100%);
  align-items: end;
  padding: calc(var(--safe-t) + 24px) 22px calc(var(--safe-b) + 30px);
}

.title { max-width: 560px; }
.title .actions .btn { flex: 1 1 140px; }

.howto {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #c9c3b2;
}

.howto b {
  display: inline-block;
  min-width: 36px;
  margin-right: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(143, 216, 255, 0.15);
  color: var(--magic);
  font-size: 11.5px;
  text-align: center;
}

.scr-fail {
  background: radial-gradient(ellipse at center, rgba(40, 6, 4, 0.55), rgba(6, 4, 4, 0.9));
  place-items: center;
  text-align: center;
  padding: 24px;
}

.fail .stamp {
  display: inline-block;
  margin: 0;
  padding: 10px 26px 14px;
  border: 5px solid var(--danger);
  border-radius: 14px;
  color: var(--danger);
  font: 400 clamp(46px, 13vw, 84px)/1 var(--title);
  transform: rotate(-8deg);
  text-shadow: 0 0 30px rgba(255, 90, 60, 0.45);
  animation: stamp 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes stamp { from { transform: rotate(-8deg) scale(2.4); opacity: 0; } }
.fail .sub { max-width: 380px; margin-left: auto; margin-right: auto; }
.fail .actions { justify-content: center; }

.scr-end {
  background: linear-gradient(180deg, rgba(10, 8, 20, 0.35), rgba(6, 6, 12, 0.9) 70%);
  align-items: end;
  padding: calc(var(--safe-t) + 24px) 22px calc(var(--safe-b) + 30px);
}

.end { max-width: 560px; }
.end h2 { font-size: clamp(30px, 8vw, 48px); color: #f3eedf; }
.end h2 b { font-weight: 400; color: var(--magic); }

.next {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(180, 140, 255, 0.1);
  border: 1px solid rgba(180, 140, 255, 0.3);
}

.next small { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: #c4a6ff; }
.next b { display: block; margin-top: 4px; font: 400 20px/1.2 var(--title); color: #fff; }
.next p { margin: 6px 0 0; font-size: 13.5px; color: #d6cfe6; line-height: 1.5; }

/* episode select */
.eps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.ep {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 12px 14px 13px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 22, 28, 0.78);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s, background 0.2s;
}

.ep small { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--magic); }
.ep b { font: 400 19px/1.15 var(--title); color: #fff; padding-right: 44px; }
.ep span { font-size: 12px; line-height: 1.4; color: #c9c3b2; }
.ep:active { transform: scale(0.98); }

.ep i {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.ep i.new { background: var(--gold); color: #2a1e00; }
.ep i.done { background: rgba(125, 255, 176, 0.16); color: #7dffb0; }

@media (hover: hover) {
  .ep:hover { border-color: rgba(143, 216, 255, 0.6); background: rgba(30, 42, 52, 0.88); }
}

/* inspection clock */
.obj.timed { flex-direction: row; align-items: center; gap: 12px; }
.obj.timed > div { display: flex; flex-direction: column; gap: 2px; }
.obj b small { font-size: 12px; color: inherit; opacity: 0.55; letter-spacing: 0; }

.obj time {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font: 400 26px/1 var(--title);
  color: #fff;
}

.obj time.hurry { color: var(--danger); animation: hurry 1.4s ease-in-out infinite alternate; }
@keyframes hurry { to { opacity: 0.6; } }

/* world task chips */
.spot {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform;
}

.spot.task {
  display: flex;
  align-items: center;
  gap: 5px;
  translate: -50% -100%;
  padding: 3px 8px 3px 4px;
  border-radius: 99px;
  border: 1px solid rgba(255, 201, 74, 0.45);
  background: rgba(8, 12, 16, 0.74);
  color: #ffe6a8;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.spot.task .ring {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--v, 0) * 360deg), rgba(255, 255, 255, 0.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 3.5px, #000 4px);
  mask: radial-gradient(circle, transparent 3.5px, #000 4px);
}

.spot.task.work { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 201, 74, 0.45); }
.spot.task.item { padding-left: 8px; border-color: rgba(143, 216, 255, 0.5); color: #dff5ff; }
.spot.task.item.hit { pointer-events: auto; cursor: pointer; }
.spot.task.item.hit::before { content: ""; position: absolute; inset: -10px -6px; }
.spot.task.press { border-color: rgba(180, 140, 255, 0.55); color: #e3d6ff; }
.spot.task.press .ring { background: conic-gradient(#b48cff calc(var(--v, 0) * 360deg), rgba(255, 255, 255, 0.18) 0); }
.spot.task.press.hot { border-color: var(--danger); color: #ffcabf; animation: hotChip 1.2s ease-in-out infinite alternate; }
.spot.task.press.hot .ring { background: conic-gradient(var(--danger) calc(var(--v, 0) * 360deg), rgba(255, 255, 255, 0.18) 0); }
@keyframes hotChip { to { box-shadow: 0 0 18px rgba(255, 90, 60, 0.7); } }

/* old photo */
.dialog { z-index: 2; }

.photo {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 0 20px 150px;
  background: rgba(4, 4, 8, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.photo.in { opacity: 1; }

.photo .print {
  position: relative;
  width: min(360px, 82vw);
  padding: 12px 12px 36px;
  border-radius: 3px;
  background: #efe6d2;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: rotate(-3deg) translateY(18px);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo.in .print { transform: rotate(-3deg); }
.photo svg { display: block; width: 100%; height: auto; filter: sepia(0.3) contrast(1.05); }

.photo figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  text-align: center;
  font: 400 17px/1 var(--title);
  color: #5a4630;
  letter-spacing: 0.04em;
}

/* episode 3: PX queue */
.px-stock {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.obj .px-stock small { font-size: 10px; font-weight: 800; color: var(--muted); margin-right: 3px; opacity: 1; }
.px-stock i { width: 12px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.px-stock i.on { background: #e8742c; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.px-stock i.mine { background: var(--magic); box-shadow: 0 0 8px rgba(143, 216, 255, 0.6); }

.tag.bubble.voice > span { background: #dff4ff; color: #0c2a3a; border: 1px solid rgba(143, 216, 255, 0.9); font-weight: 800; }

.spot.task.hide { border-color: rgba(143, 216, 255, 0.6); color: #dff5ff; animation: breathe 2.6s ease-in-out infinite alternate; }
.spot.task.hide .ring { background: conic-gradient(var(--magic) 360deg, transparent 0); }
@keyframes breathe { from { box-shadow: 0 0 6px rgba(143, 216, 255, 0.25); } to { box-shadow: 0 0 16px rgba(143, 216, 255, 0.6); } }

.spot.task.call { padding: 5px 10px; flex-direction: column; gap: 1px; border-color: var(--magic); color: #fff; background: rgba(12, 32, 46, 0.86); }
.spot.task.call.hit { pointer-events: auto; cursor: pointer; }
.spot.task.call.hit::before { content: ""; position: absolute; inset: -12px -8px; }
.spot.task.call small { font-size: 9.5px; color: #ffb48a; font-weight: 700; }
.spot.task.call.warn { border-color: #ff9a5a; }

.spot.task.gen { border-color: rgba(255, 196, 106, 0.6); color: #ffe2b0; }
.spot.task.gen .ring { background: conic-gradient(#ffc46a calc(var(--v, 0) * 360deg), rgba(255, 255, 255, 0.18) 0); }
.spot.task.gen.work { border-color: #ffc46a; box-shadow: 0 0 14px rgba(255, 196, 106, 0.45); }

.float.sus { color: #ff9a7a; font-size: 16px; }

/* free time */
.hud-free .ft-top {
  position: absolute;
  top: calc(var(--safe-t) + 12px);
  left: 12px;
  display: grid;
  gap: 6px;
  justify-items: start;
}

.ft-clock {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.ft-clock small { grid-column: 1 / -1; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.ft-clock b { font: 400 24px/1 var(--title); color: #fff; }
.ft-clock .pips { display: flex; gap: 4px; }
.ft-clock .pips i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(255, 201, 74, 0.6); }
.ft-clock .pips i.on { background: var(--gold); border-color: var(--gold); }

.ft-cart { padding: 4px 10px; border-radius: 99px; background: rgba(12, 32, 46, 0.86); border: 1px solid rgba(143, 216, 255, 0.5); font-size: 12px; font-weight: 700; color: #dff5ff; }
.ft-cart[hidden] { display: none; }
.ft-cart b { color: var(--magic); }

.spot.task.shopitem { flex-direction: column; gap: 0; padding: 4px 10px; border-color: rgba(255, 201, 74, 0.55); background: rgba(8, 12, 16, 0.8); }
.spot.task.shopitem.hit { pointer-events: auto; cursor: pointer; }
.spot.task.shopitem.hit::before { content: ""; position: absolute; inset: -10px -6px; }
.spot.task.shopitem b { font-size: 11.5px; color: #fff; }
.spot.task.shopitem small { font-size: 10.5px; color: #ffe6a8; }
.spot.task.shopitem i { position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--magic); color: #06202f; font: 800 11px/18px "Pretendard", sans-serif; font-style: normal; text-align: center; }
.spot.task.shopitem.incart { border-color: var(--magic); }
.spot.task.shopitem.sold { border-color: rgba(255, 255, 255, 0.2); opacity: 0.75; }
.spot.task.shopitem.sold small { color: #ff9a7a; }
.spot.task.shopitem.poor small { color: var(--muted); text-decoration: line-through; }
.ft-card .total { margin: 10px 0 0; font-size: 13.5px; color: #e9e3d2; }
.ft-card .total b { color: #ffe6a8; }

.ft-wallet { padding: 4px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 800; color: #ffe6a8; }

.ft-goals {
  position: absolute;
  top: calc(var(--safe-t) + 104px);
  left: 12px;
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  display: grid;
  gap: 4px;
  border-radius: 12px;
  background: rgba(10, 15, 20, 0.6);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: #e9e3d2;
}

.ft-goals li::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 3px; border: 1.5px solid var(--muted); vertical-align: -1px; }
.ft-goals li.done { color: var(--muted); text-decoration: line-through; }
.ft-goals li.done::before { background: #7dffb0; border-color: #7dffb0; }

.ft-prompt {
  position: absolute;
  left: 12px;
  bottom: calc(var(--safe-b) + 18px);
  max-width: calc(100% - 170px);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 15, 20, 0.86);
  border: 1px solid rgba(255, 201, 74, 0.45);
  pointer-events: auto;
  animation: scrIn 0.2s ease both;
}

.ft-prompt[hidden] { display: none; }
.ft-prompt > b { font: 400 15px/1 var(--title); color: var(--gold); }
.ft-pbtns { display: flex; flex-wrap: wrap; gap: 8px; }

.ft-act {
  position: relative;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 44, 54, 0.95);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.ft-act small { font-size: 11px; color: var(--gold); margin-left: 4px; }
.ft-act kbd { margin-left: 8px; font: 700 10px/1 "Pretendard", sans-serif; padding: 2px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.5); color: var(--muted); }
.ft-act:active { transform: scale(0.96); }

.ft-side { position: absolute; right: 14px; bottom: calc(var(--safe-b) + 18px); display: flex; gap: 12px; pointer-events: auto; }

.ft-btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 201, 74, 0.5);
  background: radial-gradient(circle at 50% 35%, rgba(90, 80, 50, 0.85), rgba(20, 18, 12, 0.92));
  color: #fff3cf;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  cursor: pointer;
  touch-action: manipulation;
}

.ft-btn[hidden] { display: none; }
.ft-btn svg { width: 22px; height: 22px; fill: currentColor; }
.ft-btn b { font-size: 11px; font-weight: 800; }
.ft-btn kbd { position: absolute; top: -6px; right: -4px; font: 700 10px/1 "Pretendard", sans-serif; padding: 3px 5px; border-radius: 5px; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--line); color: var(--muted); }
.ft-btn .badge { position: absolute; top: -2px; left: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font: 800 11px/20px "Pretendard", sans-serif; font-style: normal; box-shadow: 0 0 10px rgba(255, 90, 60, 0.6); }
.ft-btn .badge[hidden] { display: none; }
@media (pointer: coarse) { .ft-btn kbd, .ft-act kbd { display: none; } }

.ft-skip {
  position: absolute;
  top: calc(var(--safe-t) + 58px);
  right: 12px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.ft-sheet {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 10, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ft-sheet.in { opacity: 1; }

.ft-card {
  width: min(420px, 100%);
  max-height: calc(100% - 20px);
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(18, 24, 30, 0.97), rgba(10, 14, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(10px);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ft-sheet.in .ft-card { transform: none; }
.ft-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ft-card header b { font: 400 22px/1 var(--title); color: #fff; }
.ft-card header span { font-size: 12.5px; font-weight: 800; color: #ffe6a8; }
.ft-card header .x { margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); cursor: pointer; }
.ft-card .greet { margin: 0 0 12px; font-size: 13.5px; color: #d9d2bf; line-height: 1.5; }
.ft-card .greet b { color: #9be3c8; margin-right: 4px; }
.ft-card .note { margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
.ft-card .note b { color: var(--gold); }
.ft-card .bag { margin: 0 0 12px; font-size: 12px; color: #c9c3b2; }
.ft-card > .btn { width: 100%; }
.ft-card .actions { margin-top: 12px; }

.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop-list li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.shop-list li div { display: grid; gap: 2px; }
.shop-list b { font-size: 14px; color: #fff; }
.shop-list small { font-size: 11.5px; color: var(--muted); }
.shop-list em { font-style: normal; font-size: 13px; font-weight: 800; color: #ffe6a8; }
.btn.mini { min-width: 0; height: 38px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: 0.45; cursor: default; }

.ft-sheet.phone .ft-card { width: min(340px, 100%); padding: 12px 12px 14px; border-radius: 30px; border: 3px solid #2a3138; background: #0d1116; }
.ph-status { display: flex; justify-content: space-between; padding: 4px 10px 8px; font-size: 11.5px; font-weight: 700; color: #c9d1d3; }
.ph-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.ph-tabs button { flex: 1; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12.5px; font-weight: 800; cursor: pointer; }
.ph-tabs button.on { background: rgba(143, 216, 255, 0.16); color: #dff5ff; border-color: rgba(143, 216, 255, 0.4); }
.ph-body { min-height: 260px; display: grid; align-content: start; gap: 8px; }
.ph-thread { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); text-align: left; cursor: pointer; }
.ph-thread i { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #ffb3c7; color: #3a1020; font: 400 16px/1 var(--title); font-style: normal; }
.ph-thread div { display: grid; gap: 2px; min-width: 0; }
.ph-thread b { font-size: 13.5px; color: #fff; }
.ph-thread small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-thread.unread { border-color: rgba(255, 90, 60, 0.6); }
.ph-thread.unread b::after { content: " · 새 메시지"; font-size: 11px; color: #ff9a7a; }
.ph-back { justify-self: start; border: 0; background: none; color: var(--magic); font-size: 14px; font-weight: 800; cursor: pointer; padding: 4px 0; }
.ph-chat { display: grid; gap: 6px; }
.ph-chat .b { margin: 0; max-width: 82%; padding: 8px 11px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; animation: scrIn 0.25s ease both; }
.ph-chat .them { justify-self: start; background: #252c33; color: #f1ede2; border-bottom-left-radius: 4px; }
.ph-chat .me { justify-self: end; background: #ffe066; color: #2a2200; border-bottom-right-radius: 4px; }
.ph-replies { display: grid; gap: 6px; margin-top: 6px; }
.ph-replies button { padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 224, 102, 0.5); background: rgba(255, 224, 102, 0.08); color: #fff3cf; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer; }
.ph-note { margin: 0; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 13px; color: #e9e3d2; display: grid; gap: 4px; }
.ph-note b { font-size: 11px; color: var(--muted); }
.ph-search { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ph-search li { padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-size: 13px; color: #e9e3d2; }
.ph-search li::before { content: "검색 · "; color: var(--muted); font-size: 11px; }
.ph-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }
.ph-close { width: 100%; margin-top: 12px; height: 44px; font-size: 16px; }
.map-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.map-grid .btn { min-width: 0; height: 48px; font-size: 17px; }

/* 1996 ledger */
.photo.ledger .book {
  position: relative;
  width: min(420px, 90vw);
  padding: 16px 16px 18px;
  border-radius: 4px;
  background: #e9dfc6;
  color: #3b2e1d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(120, 90, 40, 0.25);
  transform: rotate(-2deg) translateY(18px);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo.ledger.in .book { transform: rotate(-2deg); }
.photo.ledger figcaption { position: static; margin-bottom: 10px; text-align: left; font: 400 16px/1.2 var(--title); color: #5a4630; }
.photo.ledger table { width: 100%; border-collapse: collapse; font-size: 13px; }
.photo.ledger td { padding: 7px 4px; border-bottom: 1px solid rgba(90, 70, 40, 0.3); }
.photo.ledger td:first-child { color: #7a6448; width: 46px; }
.photo.ledger td i { font-style: normal; display: inline-block; padding: 1px 6px; border: 1.5px solid #b0453a; border-radius: 4px; color: #b0453a; font-size: 11px; transform: rotate(-6deg); }
.photo.ledger tr.debt td { background: rgba(176, 69, 58, 0.08); font-weight: 700; }
.photo.ledger td em { font-style: normal; color: #b0453a; }
.photo.ledger s { text-decoration: none; color: transparent; background: repeating-linear-gradient(-20deg, #3b2e1d 0 2px, transparent 2px 4px); border-radius: 2px; }

@media (max-width: 420px) {
  .ft-goals { top: calc(var(--safe-t) + 100px); font-size: 11px; }
  .ft-clock b { font-size: 20px; }
  .ft-prompt { max-width: calc(100% - 164px); }
  .ft-act { padding: 0 12px; font-size: 13px; }
}

@media (min-width: 900px) {
  .scr-title, .scr-end { padding-left: 64px; padding-bottom: 64px; }
  .meter { top: 14px; }
  .coach { top: calc(var(--safe-t) + 66px); }
  .boss { top: 62px; }
  .dlg-skip { top: calc(var(--safe-t) + 60px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
