:root {
  --ink: #0b0706;
  --panel: rgba(20, 12, 8, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --sand: #f4e9d8;
  --muted: #b8a996;
  --ember: #ff7a2a;
  --magic: #ffb347;
  --gold: #ffd27a;
  --danger: #ff5a3c;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --title: "Gowun Batang", "Pretendard", 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;
}

#ember {
  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 0.5s 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, #ffb347, #ffe6c4);
  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(255, 179, 71, 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.3s 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.35s 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: 700 14px/1 var(--title); color: #ffcf8a; }
.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, #ff6a1a, #ffd27a); transition: width 0.2s; }
.hp.low .bar span { background: linear-gradient(90deg, #ff3b30, #ff8a6b); }
.hp.low { animation: lowhp 0.6s 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: #ffe6c4;
  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(255, 179, 71, 0.4); overflow: hidden; }
.boss .bar span { display: block; height: 100%; width: calc(var(--v, 1) * 100%); background: linear-gradient(90deg, #5aa8ff, #ffcf8a); 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(255, 179, 71, 0.55);
  background: radial-gradient(circle at 50% 35%, rgba(120, 60, 24, 0.85), rgba(10, 20, 30, 0.9));
  color: #fff1dc;
  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(255, 179, 71, 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: #8c7c70; 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(30, 16, 8, 0.88);
  border: 1px solid rgba(255, 179, 71, 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; }

#ember.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(24, 14, 9, 0.88), rgba(12, 7, 4, 0.95));
  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%, #ffd9a0 55%, #ff8a2a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 140, 50, 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(28, 16, 10, 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, #ffd27a, #ff9a3a); color: #2a1200; border-color: transparent; box-shadow: 0 10px 30px rgba(255, 140, 50, 0.4); }
.btn.ghost { background: transparent; }

@media (hover: hover) {
  .btn:hover { background: rgba(50, 30, 18, 0.85); }
  .btn.primary:hover { box-shadow: 0 12px 36px rgba(255, 140, 50, 0.6); background: linear-gradient(180deg, #ffe2a8, #ffa64a); }
  .skill:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 0 22px rgba(255, 179, 71, 0.45); }
}

.scr-loading { background: radial-gradient(ellipse at 50% 30%, #2a160a, #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(255, 179, 71, 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(20, 10, 4, 0.3), rgba(10, 6, 4, 0.92) 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(255, 179, 71, 0.1);
  border: 1px solid rgba(255, 179, 71, 0.3);
}

.next small { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: #ffcf8a; }
.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: #e6d8c4; 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(28, 16, 10, 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(255, 179, 71, 0.6); background: rgba(50, 30, 18, 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 1s steps(2) infinite; }
@keyframes hurry { 50% { opacity: 0.5; } }

/* 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(255, 179, 71, 0.5); color: #fff1dc; }
.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(255, 179, 71, 0.55); color: #ffe6c4; }
.spot.task.press .ring { background: conic-gradient(#ffb347 calc(var(--v, 0) * 360deg), rgba(255, 255, 255, 0.18) 0); }
.spot.task.press.hot { border-color: var(--danger); color: #ffcabf; animation: hotChip 0.45s 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;
}

/* ---------- Emberhall ---------- */

#ember { background: #060403; }
#ember [hidden] { display: none !important; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 55%, rgba(8, 4, 2, 0.55) 100%);
}

#ember::before, #ember::after { z-index: 4; }

#ember.cine::before, #ember.cine .vignette::before, #ember.cine .vignette::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 7vh;
  background: #050302;
  pointer-events: none;
  animation: bars 0.5s ease both;
}

#ember.cine .vignette::before { top: 0; }
#ember.cine .vignette::after { bottom: 0; }
#ember.cine::before { display: none; }

@keyframes bars { from { transform: scaleY(0); } }

.scr h1, .scr h2, .banner b, .obj b, .dlg-who b, .btn, .ep b, .next b { font-weight: 700; }

.scr h1 b {
  background: linear-gradient(180deg, #fff6e0 10%, #ffd27a 50%, #ff7a2a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: clamp(44px, 12vw, 88px);
  letter-spacing: -0.02em;
}

.scr h1 span { color: #ffe9cc; letter-spacing: 0.3em; font-size: clamp(18px, 4.6vw, 26px); }

.scr-title {
  background: linear-gradient(180deg, rgba(6, 3, 2, 0.5) 0%, transparent 26%, transparent 46%, rgba(8, 4, 2, 0.9) 100%);
}

.ep-line {
  margin: 16px 0 0;
  font-size: 13.5px;
  color: #e8d6bc;
}

.ep-line b {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 179, 71, 0.18);
  color: var(--magic);
  font-size: 12px;
}

.ep-line i.done {
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 210, 122, 0.18);
  color: var(--gold);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}

.btn.primary { color: #2a1200; }

/* warmth gauge */
.hud-ember .warm {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-t) + 12px);
  transform: translateX(-50%);
  width: min(300px, 52vw);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 8px 8px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid rgba(255, 179, 71, 0.28);
  backdrop-filter: blur(6px);
}

.hud-ember .warm .ico {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #ff9a3a, #6b2a08);
  color: #fff2d6;
  box-shadow: 0 0 calc(6px + var(--v, 0) * 22px) rgba(255, 140, 50, calc(0.3 + var(--v, 0) * 0.6));
}

.hud-ember .warm .ico svg { width: 16px; height: 16px; fill: currentColor; }
.hud-ember .warm small { display: block; font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.04em; }
.hud-ember .warm small b { color: var(--gold); margin-left: 4px; }
.hud-ember .warm .bar { height: 7px; margin-top: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.hud-ember .warm .bar span { display: block; height: 100%; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: linear-gradient(90deg, #8a5cff, #ff7a2a 40%, #ffd27a); background-size: 300px 100%; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.hud-ember .warm em { font-style: normal; font: 700 17px/1 var(--title); color: #fff1dc; min-width: 26px; text-align: right; }
.hud-ember .warm.bump { animation: warmBump 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes warmBump { 30% { transform: translateX(-50%) scale(1.08); } }

.hud-ember .obj {
  position: absolute;
  left: 12px;
  top: calc(var(--safe-t) + 64px);
  max-width: min(260px, 60vw);
}

.hud-ember .obj ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }

.hud-ember .obj li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  font-weight: 600;
  color: #f4e9d8;
}

.hud-ember .obj li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--magic);
}

.hud-ember .obj li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 210, 122, 0.5); }
.hud-ember .obj li.done::before { background: var(--magic); box-shadow: 0 0 8px rgba(255, 179, 71, 0.8); }

.hud-ember .talks {
  position: absolute;
  right: 12px;
  top: calc(var(--safe-t) + 60px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid rgba(143, 227, 192, 0.35);
  font-size: 12px;
  font-weight: 700;
  color: #cfeee0;
}

.hud-ember .talks svg { width: 14px; height: 14px; fill: #8fe3c0; }
.hud-ember .talks b { color: #fff; }
.hud-ember .talks.bump { animation: bump 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }

.hud-combat .hp { bottom: calc(var(--safe-b) + 22px); }
.hud-combat .boss { top: calc(var(--safe-t) + 66px); }
.hud-combat .boss b { color: #dff1ff; font-weight: 700; }
.hud-combat .boss .bar { position: relative; border-color: rgba(120, 180, 255, 0.45); }
.hud-combat .boss .bar span { background: linear-gradient(90deg, #3a6fd0, #9fd8ff); }
.hud-combat .boss .armor { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(230, 246, 255, 0.55) 0 6px, transparent 6px 12px); opacity: 0; transition: opacity 0.3s; }
.hud-combat .boss.armored .armor { opacity: 1; }

.skill {
  border-color: rgba(255, 179, 71, 0.55);
  background: radial-gradient(circle at 50% 35%, rgba(130, 64, 22, 0.9), rgba(26, 12, 6, 0.92));
  color: #fff1dc;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 0 16px rgba(255, 140, 50, 0.25);
}

.skill.big { width: 84px; height: 84px; }
.skill[data-skill="dash"] { border-color: rgba(143, 227, 192, 0.6); background: radial-gradient(circle at 50% 35%, rgba(40, 100, 80, 0.9), rgba(8, 22, 18, 0.92)); color: #e2fff2; }

/* world tags */
.tag.bubble.me > span { background: #fff1d6; color: #4a2100; }
.tag.task-tag > span {
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 4px;
  border-radius: 99px;
  border: 1px solid rgba(255, 210, 122, 0.6);
  background: rgba(20, 10, 4, 0.78);
  color: #ffe6b8;
  font-size: 11.5px;
  font-weight: 800;
}

.tag.task-tag .ring, .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.2) 0);
  -webkit-mask: radial-gradient(circle, transparent 3.5px, #000 4px);
  mask: radial-gradient(circle, transparent 3.5px, #000 4px);
}

.spot.task { border-color: rgba(255, 210, 122, 0.55); background: rgba(20, 10, 4, 0.78); color: #ffe6b8; font-size: 11.5px; }
.spot.task.log { border-color: rgba(255, 179, 71, 0.45); }
.spot.task.big { font-size: 13px; padding: 5px 12px 5px 6px; }
.spot.task.big .ring { width: 18px; height: 18px; }
.spot.task.work { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 179, 71, 0.55); }

.pointer.quest > i { background: var(--magic); box-shadow: 0 0 16px rgba(255, 140, 50, 0.9); }
.pointer.quest > b { color: #ffe0b0; }

.float.warm { color: #ffd27a; font-size: 17px; text-shadow: 0 0 12px rgba(255, 140, 50, 0.8), 0 2px 0 rgba(0, 0, 0, 0.6); }
.float.dmg { font-size: 15px; }
.float.dmg.big { color: #ffcf7a; }

.tag.hpbar > span > i { background: linear-gradient(90deg, #6fa8ff, #dff1ff); }

/* toasts */
.toast.letter {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 90vw);
  padding: 10px 14px 10px 10px;
  background: linear-gradient(180deg, rgba(58, 34, 20, 0.95), rgba(30, 16, 8, 0.95));
  border-color: rgba(224, 169, 138, 0.5);
  color: #f7e6d0;
  font-family: var(--title);
  font-size: 14.5px;
  line-height: 1.45;
  font-weight: 700;
}

.toast.letter small { display: block; margin-bottom: 1px; font-family: "Pretendard", sans-serif; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; color: #e0a98a; }
.toast.letter .seal { flex: none; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff9a6a, #8a2a10 70%); box-shadow: 0 0 14px rgba(255, 110, 60, 0.6), inset 0 0 0 2px rgba(255, 220, 190, 0.35); }
.toast.banter { border-color: rgba(143, 227, 192, 0.5); }
.toast.banter b { color: #8fe3c0; font-size: 14px; margin-right: 6px; }
.toasts { top: 24%; }

.banner.warmth small { color: var(--gold); background: rgba(40, 18, 6, 0.75); }
.banner b { text-shadow: 0 0 30px rgba(255, 140, 50, 0.5), 0 4px 30px rgba(0, 0, 0, 0.7); }

.coach b { color: var(--magic); }
.coach { border-color: rgba(255, 179, 71, 0.4); color: #fff1dc; top: calc(var(--safe-t) + 150px); }

.dialog { border-color: rgba(255, 179, 71, 0.16); }
.dlg-next { border-top-color: var(--magic); }
.dialog.thought .dlg-text { color: #ffe0b0; }
.dialog.letter {
  background: linear-gradient(180deg, #f3e6c8, #e6d3ab);
  border-color: rgba(120, 80, 40, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 0 40px rgba(160, 110, 60, 0.18);
}
.dialog.letter .dlg-text { color: #4a3018; font-family: var(--title); font-weight: 700; font-style: normal; }
.dialog.letter .dlg-who { background: #b8653a; color: #fff4e4; }
.dialog.letter::after {
  content: "~ ~";
  position: absolute;
  right: 18px;
  top: 10px;
  font: 700 13px/1 var(--title);
  color: rgba(120, 80, 40, 0.45);
  letter-spacing: 0.2em;
}
.dialog.letter .dlg-next { border-top-color: #8a5a30; }
.dialog.talkline::before {
  content: "만담";
  position: absolute;
  top: -13px;
  right: 16px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #8fe3c0;
  color: #06261a;
  font-size: 11px;
  font-weight: 800;
}

/* joystick */
.joy {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 3;
}

.joy::before {
  content: "";
  position: absolute;
  left: -52px;
  top: -52px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 2px solid rgba(255, 210, 122, 0.35);
  background: radial-gradient(circle, rgba(255, 179, 71, 0.12), rgba(20, 10, 4, 0.25));
}

.joy i {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe2a8, #ff8a2a);
  box-shadow: 0 0 18px rgba(255, 140, 50, 0.7);
}

/* seizure notice */
.notice {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 0 20px 150px;
  background: rgba(6, 3, 2, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.notice.in { opacity: 1; }

.notice .paper {
  position: relative;
  width: min(340px, 84vw);
  padding: 22px 22px 26px;
  border-radius: 3px;
  background: linear-gradient(180deg, #efe2c4, #dccaa3);
  color: #3a2614;
  font-family: var(--title);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: rotate(2deg) translateY(16px);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.notice.in .paper { transform: rotate(2deg); }
.notice h3 { margin: 6px 0 12px; font-size: 26px; letter-spacing: 0.2em; }
.notice p { margin: 8px 0 0; font-size: 15px; line-height: 1.55; }
.notice .warn { color: #8a1e10; font-weight: 700; }
.notice .sig { margin-top: 14px; font-size: 13px; text-align: right; color: #6a5236; }
.notice .stamp-ledger {
  position: absolute;
  right: 14px;
  top: 12px;
  margin: 0;
  padding: 6px 8px;
  border: 3px solid #b8322a;
  border-radius: 6px;
  color: #b8322a;
  font-size: 13px;
  font-weight: 700;
  transform: rotate(-12deg);
  opacity: 0.85;
}

/* contract */
.contract {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse at center, rgba(40, 18, 6, 0.35), rgba(6, 3, 2, 0.8));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.contract.in { opacity: 1; }

.contract .card {
  width: min(400px, 92vw);
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(44, 24, 12, 0.96), rgba(20, 10, 4, 0.96));
  border: 1px solid rgba(255, 179, 71, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 179, 71, 0.08), 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 120, 40, 0.25);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.contract.in .card { transform: none; }
.contract h2 { margin: 6px 0 14px; font: 700 30px/1.1 var(--title); color: #fff1dc; }
.contract h2 small { display: block; margin-top: 4px; font: 700 12px/1 "Pretendard", sans-serif; color: #8fe3c0; letter-spacing: 0.06em; }
.contract dl { margin: 0; display: grid; gap: 9px; }
.contract dl > div { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: baseline; padding-top: 9px; border-top: 1px solid rgba(255, 210, 122, 0.14); }
.contract dt { font-size: 11.5px; font-weight: 800; color: var(--magic); letter-spacing: 0.08em; }
.contract dd { margin: 0; font-family: var(--title); font-size: 15.5px; line-height: 1.45; color: #f7e6d0; }
.contract dd b { color: var(--gold); }
.contract .btn { width: 100%; margin-top: 18px; }

/* end */
.end h2 { color: #fff1dc; }
.stats { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats li { padding: 10px 12px; border-radius: 12px; background: rgba(40, 20, 8, 0.7); border: 1px solid rgba(255, 179, 71, 0.22); }
.stats small { display: block; font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.06em; }
.stats b { display: block; margin-top: 3px; font: 700 22px/1.1 var(--title); color: var(--gold); }
.stats span { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.35; color: #d8c8b0; }
.next { background: rgba(255, 179, 71, 0.08); border-color: rgba(255, 179, 71, 0.28); }
.next small { color: var(--magic); }

.scr-fail { background: radial-gradient(ellipse at center, rgba(10, 18, 40, 0.55), rgba(4, 4, 8, 0.9)); }
.fail .stamp { border-color: #8fc6ff; color: #cfe6ff; text-shadow: 0 0 30px rgba(120, 180, 255, 0.45); font-size: clamp(34px, 9vw, 60px); }

@media (max-width: 520px) {
  .btn { min-width: 0; padding: 0 12px; font-size: 16px; white-space: nowrap; }
  .hud-ember .obj { top: calc(var(--safe-t) + 60px); max-width: 58vw; }
  .hud-ember .obj li { font-size: 12px; }
  .hud-ember .warm { width: min(250px, 56vw); left: calc(50% - 22px); }
  .stats { grid-template-columns: 1fr; }
  .stats li { display: grid; grid-template-columns: 80px auto 1fr; align-items: baseline; gap: 8px; }
  .stats span { margin: 0; }
  .sys a { display: none; }
}

/* nothing pulses faster than ~1 Hz */
.tag.mark.alarm > span, .pointer.phone > i, .meter.rising .eye, .spot.task.press.hot { animation-duration: 1s; }
.hp.low { animation-duration: 1.1s; }
.skill.ready { animation-duration: 1.1s; }
.skill.low { opacity: 0.5; }
.float.cost { color: #ffb08a; font-size: 13px; }

/* episode 2 + inn shift */
.scr-title .eps { margin-top: 18px; }
.ep.inn { border-color: rgba(255, 179, 71, 0.45); background: linear-gradient(160deg, rgba(70, 34, 12, 0.85), rgba(26, 12, 4, 0.85)); }
.ep.inn small { color: var(--magic); }
.ep i.new { background: rgba(143, 227, 192, 0.2); color: #8fe3c0; }
.stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.hud-ember .chips {
  position: absolute;
  right: 12px;
  top: calc(var(--safe-t) + 60px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.hud-ember .chips .talks { position: static; }
.hud-ember .coins {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border-radius: 99px;
  background: rgba(20, 10, 4, 0.78);
  border: 1px solid rgba(255, 210, 122, 0.45);
  font-size: 12.5px;
  font-weight: 700;
  color: #ffe6b8;
}
.hud-ember .coins svg { width: 16px; height: 16px; fill: var(--gold); }
.hud-ember .coins b { color: #fff; font-size: 14px; }
.hud-ember .coins.bump { animation: bump 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }

.shift-bar {
  position: absolute;
  right: 12px;
  bottom: calc(var(--safe-b) + 18px);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.btn.small { min-width: 0; height: 42px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.btn.small[disabled] { opacity: 0.45; cursor: default; }

.tag.order > span {
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 5px;
  border-radius: 99px;
  background: #fff1d6;
  color: #4a2100;
  font-weight: 800;
  font-size: 12.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.tag.order .ring {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: conic-gradient(#e0782a calc(var(--v, 1) * 360deg), rgba(0, 0, 0, 0.12) 0);
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px);
  mask: radial-gradient(circle, transparent 4px, #000 4.5px);
}
.tag.order.late > span { background: #ffd8c8; }
.spot.task.station { opacity: 0.7; }
.spot.task.station.want { opacity: 1; border-color: var(--gold); color: #fff1dc; }

.shop {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 3, 2, 0.55);
  opacity: 0;
  transition: opacity 0.3s;
}
.shop.in { opacity: 1; }
.shop .card {
  width: min(440px, 94vw);
  max-height: 86vh;
  overflow: auto;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(44, 24, 12, 0.97), rgba(20, 10, 4, 0.97));
  border: 1px solid rgba(255, 179, 71, 0.45);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.shop h2 { margin: 4px 0 12px; font: 700 24px/1.1 var(--title); color: #fff1dc; }
.shop h2 b { color: var(--gold); }
.shop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 179, 71, 0.07); border: 1px solid rgba(255, 179, 71, 0.18); }
.shop li > div { flex: 1; display: grid; gap: 2px; }
.shop li b { font: 700 16px/1.2 var(--title); color: #fff1dc; }
.shop li small { font-size: 12px; color: #d8c8b0; }
.shop li span { font-size: 11.5px; font-weight: 800; color: var(--magic); }
.shop li.own { opacity: 0.6; }
.shop .card > .btn { width: 100%; margin-top: 12px; }

@media (min-width: 760px) {
  .contract { justify-items: start; padding-left: clamp(20px, 7vw, 120px); background: linear-gradient(90deg, rgba(6, 3, 2, 0.75), rgba(6, 3, 2, 0.15) 60%); }
}

@media (min-width: 900px) {
  .scr-title, .scr-end { padding-left: 64px; padding-bottom: 64px; }
  .coach { top: calc(var(--safe-t) + 70px); }
  .hud-combat .boss { top: calc(var(--safe-t) + 64px); }
  .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; }
}
