:root {
  --bg0: #031427;
  --bg1: #00070f;
  --glass: rgba(16, 52, 86, .55);
  --glass-2: rgba(22, 70, 110, .45);
  --line: rgba(120, 210, 255, .18);
  --text: #e8f6ff;
  --muted: #8fb3cc;
  --accent: #38e1ff;
  --accent-2: #2b8cff;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #ff6b6b;
  --r0: #8ea3b8;
  --r1: #c3cfdc;
  --r2: #4ade80;
  --r3: #38bdf8;
  --r4: #c084fc;
  --r5: #fbbf24;
  --r6: #ff4fa3;
  --r7: #ff3b3b;
  --tab-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: radial-gradient(ellipse 120% 70% at 50% -10%, #0c4a7a 0%, var(--bg0) 45%, var(--bg1) 100%) fixed;
  background-color: var(--bg0);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  word-break: keep-all;
  overflow-wrap: break-word;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.ic { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.25em; }

/* 떠오르는 거품 배경 */
.ocean { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.ocean i {
  position: absolute;
  bottom: -40px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(160, 230, 255, .35);
  animation: rise 14s linear infinite;
}
.ocean i:nth-child(1) { left: 8%; animation-delay: 0s; width: 8px; height: 8px; }
.ocean i:nth-child(2) { left: 21%; animation-delay: 3s; width: 14px; height: 14px; animation-duration: 18s; }
.ocean i:nth-child(3) { left: 37%; animation-delay: 6s; }
.ocean i:nth-child(4) { left: 52%; animation-delay: 1.5s; width: 6px; height: 6px; animation-duration: 11s; }
.ocean i:nth-child(5) { left: 66%; animation-delay: 8s; width: 12px; height: 12px; }
.ocean i:nth-child(6) { left: 79%; animation-delay: 4.5s; animation-duration: 16s; }
.ocean i:nth-child(7) { left: 90%; animation-delay: 10s; width: 9px; height: 9px; }
.ocean i:nth-child(8) { left: 45%; animation-delay: 12s; width: 16px; height: 16px; animation-duration: 20s; }
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(14px, -50vh); }
  100% { transform: translate(-8px, -110vh); opacity: 0; }
}

.glass {
  background: linear-gradient(160deg, rgba(30, 90, 140, .45), rgba(8, 30, 55, .6));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---- 버튼 ---- */
.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary {
  border: 0;
  color: #00213a;
  background: linear-gradient(135deg, #7ff0ff, var(--accent) 45%, #18a7ff);
  box-shadow: 0 6px 20px rgba(56, 225, 255, .35);
}
.btn.gold { border: 0; color: #3a2400; background: linear-gradient(135deg, #ffe58a, #fbbf24 50%, #f59e0b); box-shadow: 0 6px 18px rgba(251, 191, 36, .3); }
.btn.danger { border: 0; color: #fff; background: linear-gradient(135deg, #ff8a8a, #ef4444); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.big { width: 100%; padding: 15px; font-size: 18px; border-radius: 16px; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.row { display: flex; gap: 8px; align-items: center; }

/* ---- 재화 아이콘 ---- */
[class^="ico-"] { display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none; vertical-align: -3px; }
.ico-gold { background: radial-gradient(circle at 35% 30%, #fff3b0, #f5b301 55%, #b37800); box-shadow: inset 0 0 0 1.5px rgba(150, 90, 0, .5); }
.ico-pearl { background: radial-gradient(circle at 35% 30%, #fff, #f6dbe8 55%, #c99ab3); }
.ico-crystal { border-radius: 2px; transform: rotate(45deg) scale(.8); background: linear-gradient(135deg, #e0fdff, #5ff4ff 50%, #1aa7c4); box-shadow: 0 0 8px rgba(95, 244, 255, .7); }
.ico-oxy { background: radial-gradient(circle at 35% 30%, #fff, #9be7ff 60%, #3aa9d6); }

/* ---- 화면 ---- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1; overflow-y: auto; }

/* 로그인 */
.login-card { width: 100%; max-width: 400px; padding: 22px 22px 18px; text-align: center; }
.login-sub { width: 100%; height: auto; display: block; margin: -6px auto 4px; }
.logo {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(90deg, #a5f3ff, var(--accent), #6aa8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.field { display: block; text-align: left; margin-bottom: 8px; }
.field span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 20, 40, .6);
  color: var(--text);
  outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 225, 255, .2); }
.form-msg { min-height: 20px; margin: 4px 0 10px; font-size: 13px; color: var(--warn); text-align: left; }
.newid { margin-top: 10px; padding: 14px; border-radius: 14px; background: rgba(56, 225, 255, .08); border: 1px dashed rgba(56, 225, 255, .4); }
.newid p { margin: 0 0 12px; line-height: 1.5; }
.newid b { color: var(--accent); }
.newid .row { justify-content: center; }
.fine { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 상단 바 */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: linear-gradient(180deg, rgba(2, 16, 32, .9), rgba(2, 16, 32, .55));
  border-bottom: 1px solid var(--line);
}
.profile { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; min-width: 0; position: relative; text-align: left; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: var(--accent); background: linear-gradient(135deg, #1e6aa8, #0b3157); border: 1px solid var(--line); flex: none; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.who small { font-size: 11px; color: var(--muted); }
.who small b { color: var(--accent); font-size: 11px; }
.sync { position: absolute; left: 30px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--good); border: 2px solid #02101f; }
.sync.saving { background: var(--warn); }
.sync.offline { background: #64748b; }
.wallet { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cur { display: flex; align-items: center; gap: 5px; padding: 5px 9px 5px 6px; border-radius: 999px; background: rgba(0, 20, 40, .65); border: 1px solid var(--line); font-size: 13px; }
.cur b { font-variant-numeric: tabular-nums; }

#views { flex: 1; overflow-y: auto; padding: 14px 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px); }
.view { max-width: 720px; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 10px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head small { color: var(--muted); font-weight: 600; font-size: 13px; }
.sub-note { margin: -4px 2px 12px; color: var(--muted); font-size: 13px; }

/* 격납고 */
.hero { position: relative; overflow: hidden; padding: 0; }
.hangar-sub { display: block; width: 100%; height: 190px; }
.hero-info { position: absolute; left: 16px; top: 12px; }
.hero-info h2 { margin: 0; font-size: 20px; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.power-badge { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(0, 0, 0, .35); border: 1px solid rgba(56, 225, 255, .4); }
.power-badge b { color: var(--accent); font-size: 15px; }

.stats { margin-top: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.stat .top { display: flex; justify-content: space-between; font-size: 13px; }
.stat .top span { color: var(--muted); }
.stat .top b { font-variant-numeric: tabular-nums; }
.stat .bar { height: 6px; margin-top: 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.stat .bar div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2b8cff, var(--accent)); }
.stat.handling { grid-column: 1 / -1; }
.stat.handling .bar div { background: linear-gradient(90deg, #f59e0b, #4ade80); }
.stat.handling em { font-style: normal; font-size: 11px; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(74, 222, 128, .18); color: #86efac; }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot {
  position: relative;
  padding: 12px 10px 10px;
  border-radius: 16px;
  text-align: left;
  border: 1.5px solid var(--rc, var(--line));
  background: linear-gradient(160deg, rgba(30, 90, 140, .4), rgba(8, 30, 55, .6));
  box-shadow: 0 0 0 0 transparent;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slot.r4, .slot.r5, .slot.r6 { box-shadow: 0 0 18px -4px var(--rc); }
.slot .icon { width: 38px; height: 38px; border-radius: 11px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; }
.slot .icon svg { width: 30px; height: 30px; }
.slot .sname { font-size: 11px; color: var(--muted); font-weight: 700; }
.slot .pname { font-size: 13px; font-weight: 800; line-height: 1.25; }
.slot .rtag { position: absolute; right: 8px; top: 8px; font-size: 10.5px; font-weight: 800; color: var(--rc); }
.dur { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: auto; }
.dur div { height: 100%; background: var(--good); }
.dur.mid div { background: var(--warn); }
.dur.low div { background: var(--bad); }
.dur-txt { font-size: 10.5px; color: var(--muted); }

/* 탐험 */
.diffs { display: grid; gap: 12px; }
.diff {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(120deg, color-mix(in srgb, var(--dc) 22%, transparent), rgba(8, 30, 55, .7) 55%);
}
.diff::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--dc); z-index: 1; }
.diff > :not(.diff-art) { position: relative; z-index: 1; }
.diff-art { position: absolute; right: 0; top: 0; width: 46%; height: 100%; opacity: .85; -webkit-mask-image: linear-gradient(90deg, transparent, #000 55%); mask-image: linear-gradient(90deg, transparent, #000 55%); }
.diff h4 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.diff h4 .lv { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--dc); color: #04121f; font-weight: 900; }
.diff .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 10px; font-size: 13px; color: var(--muted); }
.diff .meta b { color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.check { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(74, 222, 128, .12); color: #a7f3c4; border: 1px solid rgba(74, 222, 128, .3); }
.check.warn { background: rgba(251, 191, 36, .12); color: #fde68a; border-color: rgba(251, 191, 36, .35); }
.check.bad { background: rgba(255, 107, 107, .12); color: #fecaca; border-color: rgba(255, 107, 107, .35); }
.diff .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.loot { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.cleared { font-size: 12px; color: var(--muted); }

/* 뽑기 */
.machines { display: grid; gap: 14px; }
.machine { padding: 16px; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.capsule { width: 96px; height: 96px; border-radius: 50%; position: relative; animation: bob 3s ease-in-out infinite; }
.capsule::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(180deg, var(--c1) 50%, #e8f6ff 50%); box-shadow: inset -8px -10px 18px rgba(0, 0, 0, .25), 0 10px 30px -6px var(--c1); }
.capsule::after { content: ""; position: absolute; left: 22%; top: 14%; width: 24%; height: 16%; border-radius: 50%; background: rgba(255, 255, 255, .6); }
@keyframes bob { 50% { transform: translateY(-6px) rotate(4deg); } }
.machine h4 { margin: 0; font-size: 18px; }
.machine p { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.machine .row { flex-wrap: wrap; }
.rates { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.rates span { padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .25); color: var(--rc); font-weight: 700; }

/* 부품 */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips button { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 20, 40, .5); font-size: 13px; font-weight: 700; color: var(--muted); }
.chips button.active { background: var(--accent); color: #00213a; border-color: var(--accent); }
.tools { margin-bottom: 10px; }
.merge-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.part {
  position: relative;
  text-align: left;
  padding: 10px;
  border-radius: 14px;
  border: 1.5px solid var(--rc);
  background: linear-gradient(160deg, color-mix(in srgb, var(--rc) 14%, transparent), rgba(8, 30, 55, .7));
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 8px;
}
.part .icon { grid-row: span 2; width: 36px; height: 36px; border-radius: 10px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; }
.part .icon svg { width: 28px; height: 28px; }
.part .pn { font-size: 12.5px; font-weight: 800; line-height: 1.2; }
.part .pv { font-size: 11.5px; color: var(--muted); }
.part .dur, .part .dur-txt { grid-column: 1 / -1; }
.part .tag { position: absolute; right: 6px; top: -8px; font-size: 10px; font-weight: 900; padding: 2px 7px; border-radius: 999px; background: var(--accent); color: #00213a; }
.part.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.part.dim { opacity: .35; }
.empty { text-align: center; color: var(--muted); margin: 40px 0; }

/* 탭 */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: linear-gradient(0deg, rgba(2, 12, 24, .97), rgba(2, 16, 32, .9));
  border-top: 1px solid var(--line);
  z-index: 5;
}
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active svg { filter: drop-shadow(0 0 6px rgba(56, 225, 255, .7)); }

/* ---- 레이스 ---- */
#runView { position: fixed; inset: 0; z-index: 20; background: #000; touch-action: none; -webkit-touch-callout: none; }
#runCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.run-hud {
  position: absolute;
  left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0;
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.2fr) 1fr;
  gap: 8px;
  align-items: start;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.lives { display: flex; gap: 3px; }
.lives svg { width: 24px; height: 24px; }
.lives .lost { opacity: .25; filter: grayscale(1); }
.oxy { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; }
.oxy .bar { width: 90px; }
.bar { height: 8px; border-radius: 5px; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .15); overflow: hidden; }
.bar div { height: 100%; background: linear-gradient(90deg, #4ad1ff, #a5f3ff); transition: width .1s linear; }
.oxy.low .bar div { background: linear-gradient(90deg, #ff6b6b, #ffb4b4); }
.oxy.low { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }
.hud-mid { text-align: center; }
.map-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog { margin: 5px auto 3px; max-width: 260px; }
.prog div { background: linear-gradient(90deg, #4ade80, #a3f7c4); }
.meters { font-size: 12px; color: #cfe9ff; font-variant-numeric: tabular-nums; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.got { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .35); }
.hud-btns { display: flex; gap: 6px; margin-top: 4px; }
.hud-btn { pointer-events: auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .4); color: #fff; padding: 0; font-size: 18px; }
.hud-btn:active { transform: scale(.94); }
.pressure { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 74px); transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; background: rgba(239, 68, 68, .85); animation: blink .6s steps(2) infinite; pointer-events: none; white-space: nowrap; }
.hud-parts { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%); display: flex; gap: 6px; pointer-events: none; }
.hp { width: 38px; padding: 4px; border-radius: 10px; background: rgba(0, 0, 0, .45); border: 1px solid var(--rc, rgba(255, 255, 255, .2)); }
.hp svg { width: 28px; height: 22px; display: block; margin: 0 auto; }
.hp .dur { height: 4px; margin-top: 2px; }
.hp.broken { border-color: var(--bad); }
.hp.broken svg { opacity: .3; }
.hp.broken::after { content: "✕"; position: absolute; transform: translate(9px, -30px); color: var(--bad); font-weight: 900; }
.start-hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 10, 25, .45); }
.hint-card { text-align: center; padding: 22px 24px; border-radius: 22px; background: rgba(4, 24, 44, .8); border: 1px solid var(--line); max-width: 340px; margin: 16px; }
.hint-card p { margin: 10px 0 0; line-height: 1.6; font-size: 15px; }
.hint-card b { color: var(--accent); }
.rotate-tip { display: none; font-size: 13px !important; color: var(--muted); }
@media (orientation: portrait) { .rotate-tip { display: block; } }
.tut-note { font-size: 14px !important; padding: 8px 12px; border-radius: 12px; background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .35); color: #bbf7d0; }
.hint-go { font-weight: 900; font-size: 18px; color: var(--warn) !important; animation: blink 1s steps(2) infinite; }
.hint-anim { height: 60px; position: relative; }
.finger { position: absolute; left: 50%; top: 10px; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; background: rgba(255, 255, 255, .85); animation: press 1.6s ease-in-out infinite; }
@keyframes press { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(56, 225, 255, .6); } 40%, 70% { transform: scale(.82); box-shadow: 0 0 0 18px rgba(56, 225, 255, 0); } }

/* ---- 모달 ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 6, 15, .65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s; }
@media (min-width: 640px) { .modal { align-items: center; } }
.sheet { width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; overflow-x: hidden; padding: 20px 18px calc(env(safe-area-inset-bottom) + 18px); border-radius: 24px 24px 0 0; }
@media (min-width: 640px) { .sheet { border-radius: 24px; } }
.sheet h2 { margin: 0 0 4px; font-size: 22px; }
.sheet .sub-note { margin: 0 0 14px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
.list { display: grid; gap: 8px; }
.pick { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; border: 1.5px solid var(--rc); background: rgba(0, 20, 40, .5); text-align: left; }
.pick .icon { width: 40px; height: 40px; border-radius: 11px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; }
.pick .icon svg { width: 30px; height: 30px; }
.pick b { font-size: 14px; }
.pick small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pick .diffv { font-size: 12px; font-weight: 800; }
.up { color: var(--good); }
.down { color: var(--bad); }
.result-head { text-align: center; }
.result-head .big-ico { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 6px; border-radius: 50%; color: var(--accent); background: radial-gradient(circle, rgba(56, 225, 255, .22), rgba(56, 225, 255, 0) 70%); animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1); }
.result-head .big-ico .ic { width: 52px; height: 52px; }
.result-head.clear .big-ico { color: var(--warn); background: radial-gradient(circle, rgba(251, 191, 36, .3), rgba(251, 191, 36, 0) 70%); }
.result-head.sunk .big-ico { color: var(--bad); background: radial-gradient(circle, rgba(255, 107, 107, .25), rgba(255, 107, 107, 0) 70%); }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2.ih { display: flex; align-items: center; gap: 8px; }
.sheet h2.ih .ic { color: var(--accent); }
.btn.ib { display: flex; align-items: center; justify-content: center; gap: 8px; }
.gold-ic { color: var(--warn); }
.count { font-variant-numeric: tabular-nums; }
.loot-list { display: grid; gap: 8px; margin: 14px 0; }
.loot-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 14px; background: rgba(0, 20, 40, .5); border: 1px solid var(--line); font-weight: 700; }
.loot-row > span { display: flex; align-items: center; gap: 8px; }
.loot-row .bonus { color: var(--warn); font-size: 12px; margin-left: 6px; }
.broken-list { padding: 10px 14px; border-radius: 14px; background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .35); color: #fecaca; font-size: 14px; line-height: 1.6; }
.broken-list p { margin: 0; }
.broken-list .bh { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.warn-list { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .4); color: #fde68a; }
.warn-list p { display: flex; gap: 8px; align-items: flex-start; }
.warn-list p + p { margin-top: 6px; }
.warn-list .ic { margin-top: 2px; }
.map-card { text-align: center; padding: 6px 0 2px; }
.map-card .tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--dc); color: #04121f; font-weight: 900; font-size: 12px; }
.map-card h2 { font-size: 26px; margin: 10px 0 4px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.fact { padding: 10px 6px; border-radius: 14px; background: rgba(0, 20, 40, .5); border: 1px solid var(--line); text-align: center; }
.fact small { display: block; font-size: 11px; color: var(--muted); }
.fact b { font-size: 16px; }

/* 뽑기 결과 */
.reveal { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin: 10px 0 4px; }
.reveal.one { grid-template-columns: minmax(0, 200px); justify-content: center; }
.card { aspect-ratio: 3 / 4; perspective: 600px; }
.card .in { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.card.open .in { transform: rotateY(180deg); }
.card .face { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; text-align: center; }
.card .back { background: linear-gradient(160deg, #1b5f97, #0a2d4f); border: 1.5px solid var(--line); }
.card .back::after { content: "?"; font-size: 30px; font-weight: 900; color: rgba(255, 255, 255, .5); }
.card .front { transform: rotateY(180deg); border: 2px solid var(--rc); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rc) 35%, transparent), rgba(4, 20, 38, .95) 70%); }
.card.open.r4 .front, .card.open.r5 .front, .card.open.r6 .front { box-shadow: 0 0 24px var(--rc); }
.card .front svg { width: 44px; height: 44px; }
.card .front b { font-size: 12px; line-height: 1.2; }
.card .front small { font-size: 11px; font-weight: 800; color: var(--rc); }
.reveal.one .front svg { width: 80px; height: 80px; }
.reveal.one .front b { font-size: 16px; }

.toast { word-break: keep-all; position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%); z-index: 60; padding: 11px 16px; border-radius: 14px; background: rgba(4, 30, 54, .95); border: 1px solid var(--line); font-weight: 700; font-size: 14px; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.warn { border-color: rgba(251, 191, 36, .6); color: #fde68a; }

@media (max-width: 420px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: 1fr; }
  .who b { max-width: 80px; }
  .cur { padding: 4px 7px 4px 5px; font-size: 12px; }
  .machine { grid-template-columns: 72px 1fr; }
  .capsule { width: 72px; height: 72px; }
  .oxy .bar { width: 64px; }
}
@media (max-height: 460px) {
  .hud-parts { display: none; }
}

/* ---- 레이스 등장 ---- */
#runView:not(.hidden) { animation: runIn .45s ease; }
@keyframes runIn { from { opacity: 0; } to { opacity: 1; } }
.pressure .ic { vertical-align: -3px; }
.rotate-tip .ic { vertical-align: -4px; }

/* 세로 화면: 위아래 여백(창틀)에 HUD를 둠 */
.letterbox .run-hud { top: max(0px, calc(var(--gap) / 2 - 58px)); }
.letterbox .hud-parts { bottom: max(calc(env(safe-area-inset-bottom) + 10px), calc(var(--gap) / 2 - 28px)); gap: 8px; }
.letterbox .hp { width: 46px; padding: 6px; }
.letterbox .hp svg { width: 32px; height: 26px; }
.letterbox .pressure { top: calc(var(--gap) + 10px); }
.letterbox .lives svg { width: 28px; height: 28px; }

/* ---- 장착 반짝 ---- */
.slot.pop { animation: slotPop .6s ease; }
@keyframes slotPop { 0% { transform: scale(1); } 30% { transform: scale(1.07); box-shadow: 0 0 26px var(--rc); } 100% { transform: none; } }

/* ---- 뽑기 캡슐 ---- */
.gacha-stage { position: relative; height: 230px; display: grid; place-items: center; cursor: pointer; }
.cap { position: relative; width: 120px; height: 120px; animation: capShake 1s ease-in infinite; }
.gacha-stage.rare .cap { animation-duration: .5s; filter: drop-shadow(0 0 18px var(--glow)); }
.cap .h { position: absolute; left: 0; right: 0; height: 50%; transition: transform .4s cubic-bezier(.2, .8, .3, 1), opacity .4s; }
.cap .top { top: 0; border-radius: 60px 60px 0 0; background: var(--c1); box-shadow: inset -10px 8px 18px rgba(255, 255, 255, .25), inset 6px -4px 10px rgba(0, 0, 0, .15); }
.cap .bot { bottom: 0; border-radius: 0 0 60px 60px; background: #e8f6ff; box-shadow: inset -10px -12px 18px rgba(0, 0, 0, .2); }
.cap .shine { position: absolute; left: 22%; top: 13%; width: 24%; height: 15%; border-radius: 50%; background: rgba(255, 255, 255, .6); transition: opacity .2s; }
.cap::after { content: ""; position: absolute; left: -2px; right: -2px; top: calc(50% - 3px); height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .25); transition: opacity .2s; }
@keyframes capShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-9deg); } 30% { transform: rotate(8deg); }
  45% { transform: rotate(-12deg); } 60% { transform: rotate(11deg); }
  75% { transform: rotate(-5deg) translateY(-4px); }
}
.gacha-stage.pop .cap { animation: none; }
.gacha-stage.pop .top { transform: translate(-30px, -90px) rotate(-35deg); opacity: 0; }
.gacha-stage.pop .bot { transform: translate(30px, 90px) rotate(30deg); opacity: 0; }
.gacha-stage.pop .shine, .gacha-stage.pop .cap::after { opacity: 0; }
.burst { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: radial-gradient(circle, #fff, var(--glow) 40%, transparent 70%); transform: scale(0); opacity: 0; }
.gacha-stage.pop .burst { animation: burst .5s ease-out; }
@keyframes burst { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(3.2); opacity: 0; } }
.stage-tip { position: absolute; bottom: 0; margin: 0; font-size: 12px; color: var(--muted); }
.gacha-stage.pop .stage-tip { opacity: 0; }
.flash { position: fixed; inset: 0; z-index: 70; pointer-events: none; background: radial-gradient(circle, #fff 0%, var(--glow) 45%, transparent 85%); animation: flash .9s ease-out forwards; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.reveal { position: relative; }
.reveal.legend::before { content: ""; position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: -1; pointer-events: none; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--glow) 35%, transparent) 0 10deg, transparent 10deg 24deg); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); mask-image: radial-gradient(circle, #000 20%, transparent 65%); animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card.open .front { animation: cardPop .45s ease; }
@keyframes cardPop { 0% { filter: brightness(2.2); } 100% { filter: none; } }

/* ---- 로그인 바닷속 배경 ---- */
.seabed { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.login-card { position: relative; z-index: 1; }
.seabed .floor { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26vh; min-height: 120px; }
.seabed .weeds { position: absolute; bottom: 0; width: 50%; height: 22vh; min-height: 110px; }
.seabed .weeds.left { left: 0; }
.seabed .weeds.right { right: 0; }
.seabed .sway { transform-origin: 50% 100%; transform-box: fill-box; animation: sway 4s ease-in-out infinite; }
.seabed .s2 { animation-duration: 5s; animation-delay: -1s; }
.seabed .s3 { animation-duration: 4.6s; animation-delay: -2s; }
@keyframes sway { 50% { transform: rotate(6deg); } }
.seabed .rays i { position: absolute; top: -10%; width: 90px; height: 90vh; background: linear-gradient(180deg, rgba(200, 245, 255, .14), rgba(200, 245, 255, 0)); transform: skewX(-18deg); animation: ray 9s ease-in-out infinite; }
.seabed .rays i:nth-child(1) { left: 12%; }
.seabed .rays i:nth-child(2) { left: 46%; width: 60px; animation-delay: -3s; }
.seabed .rays i:nth-child(3) { left: 78%; width: 120px; animation-delay: -6s; }
@keyframes ray { 50% { opacity: .35; transform: skewX(-12deg) translateX(20px); } }
.seabed .fishes { position: absolute; left: 0; top: 14%; width: 100%; height: 120px; fill: rgba(140, 220, 255, .35); }
.seabed .school { animation: swim 24s linear infinite; }
@keyframes swim { from { transform: translateX(420px); } to { transform: translateX(-120px); } }

/* ---- 별 ---- */
.stars { display: inline-flex; gap: 1px; }
.stars span { color: rgba(255, 255, 255, .18); display: inline-flex; }
.stars span.on { color: var(--warn); filter: drop-shadow(0 0 3px rgba(251, 191, 36, .6)); }
.stars .ic { width: 12px; height: 12px; }

/* ---- 탐험 카드의 맵 칩 ---- */
.maprow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 12px; }
.mchip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px 5px; border-radius: 12px; background: rgba(0, 15, 30, .55); border: 1px solid var(--line); min-width: 0; }
.mchip .sw { position: relative; display: grid; place-items: center; width: 100%; height: 22px; border-radius: 8px; background: linear-gradient(180deg, var(--t), var(--b) 68%, var(--r) 68%); }
.mchip .mn { font-size: 10.5px; font-weight: 700; color: #cfe3f3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mchip.new::after { content: "NEW"; position: absolute; top: -6px; right: -3px; font-size: 9px; font-weight: 900; padding: 1px 5px; border-radius: 999px; background: var(--accent); color: #00213a; }

/* ---- 맵 소개 ---- */
.map-note { margin: 4px 0 10px; padding: 10px 12px; border-radius: 14px; background: rgba(0, 20, 40, .5); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.55; color: #d6ebfa; }
.phen { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(56, 225, 255, .18); color: var(--accent); font-size: 12px; font-weight: 800; }
.map-stars { display: flex; justify-content: center; gap: 14px; margin: 4px 0 2px; }
.map-stars span { display: flex; flex-direction: column; align-items: center; gap: 2px; color: rgba(255, 255, 255, .2); }
.map-stars span.on { color: var(--warn); }
.map-stars .ic { width: 22px; height: 22px; }
.map-stars small { font-size: 10.5px; color: var(--muted); }

/* ---- 결과: 별, 새 생물 ---- */
.star-row { display: flex; justify-content: center; gap: 8px; margin: 4px 0 10px; }
.star-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 88px; text-align: center; color: rgba(255, 255, 255, .15); }
.star-cell .ic { width: 38px; height: 38px; }
.star-cell small { font-size: 11px; line-height: 1.3; color: var(--muted); }
.star-cell.on { color: var(--warn); }
.star-cell.on .ic { animation: starIn .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d); }
.star-cell.on .ic { filter: drop-shadow(0 0 8px rgba(251, 191, 36, .7)); }
.star-cell.new small { color: var(--warn); font-weight: 800; }
.star-cell.new small::after { content: " NEW"; font-size: 9px; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.loot-row.extra { margin: 0 0 10px; }
.found-box { margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; background: rgba(126, 249, 197, .08); border: 1px solid rgba(126, 249, 197, .35); }
.found-box .fh { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: #b6fbe0; }
.found-list { display: flex; flex-wrap: wrap; gap: 8px; }
.found { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 76px; font-size: 12px; font-weight: 700; text-align: center; }
.found canvas { width: 76px; height: 52px; border-radius: 10px; background: rgba(0, 30, 60, .5); }
.found em { font-style: normal; color: var(--warn); font-size: 10px; }
.found-box .fr { margin: 8px 0 0; font-size: 12.5px; color: #b6fbe0; }

/* ---- 도감 ---- */
.dex-prog { padding: 12px 14px; margin-bottom: 14px; }
.dex-prog .bar { height: 10px; }
.dex-prog .bar div { background: linear-gradient(90deg, #34d399, #7ef9c5); }
.dex-prog p { margin: 8px 0 2px; font-weight: 700; font-size: 14px; }
.dex-prog small { color: var(--muted); font-size: 12px; }
.dex-sec { margin-bottom: 16px; }
.dex-sec h4 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dex-sec h4::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--dc); }
.dex-sec h4 small { color: var(--muted); font-weight: 600; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.dex-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(30, 90, 140, .4), rgba(8, 30, 55, .6)); font-size: 12.5px; font-weight: 800; }
.dex-card canvas { width: 100%; height: 62px; }
.dex-card.unknown span { color: var(--muted); }
.dex-card.rare { border-color: rgba(251, 191, 36, .5); }
.rare-tag { font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 999px; background: var(--warn); color: #3a2400; vertical-align: 3px; }
.dex-card .rare-tag { position: absolute; top: 5px; right: 5px; }
.dex-detail { text-align: center; }
.dex-detail canvas.big { width: 100%; height: 170px; border-radius: 16px; background: radial-gradient(circle, rgba(56, 225, 255, .15), rgba(0, 20, 40, .4)); margin-bottom: 10px; }
.facts.two { grid-template-columns: 1fr 1fr; }
.dex-fact { text-align: left; margin: 0 0 10px; padding: 12px 14px; border-radius: 14px; background: rgba(126, 249, 197, .08); border: 1px solid rgba(126, 249, 197, .3); line-height: 1.6; font-size: 14.5px; }
.dex-detail .sub-note { text-align: left; }

@media (max-width: 420px) {
  .tabbar button { font-size: 11px; }
  .mchip .mn { font-size: 9.5px; }
}
.mchip .pt { font-size: 9.5px; font-weight: 900; padding: 0 5px; border-radius: 6px; background: rgba(0, 20, 40, .65); color: #bff4ff; white-space: nowrap; }
.sheet { scrollbar-width: thin; scrollbar-color: rgba(120, 210, 255, .3) transparent; }
.sheet::-webkit-scrollbar { width: 6px; }
.sheet::-webkit-scrollbar-thumb { background: rgba(120, 210, 255, .3); border-radius: 3px; }

/* ---- 신화 등급: 무지개빛 ---- */
@property --hue { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.slot.r6, .part.r6, .pick.r6, .card.r6 .front { border-color: transparent !important; }
.pick.r6 { position: relative; }
.slot.r6::before, .part.r6::before, .pick.r6::before, .card.r6 .front::before {
  content: ""; position: absolute; inset: -2px; pointer-events: none; border-radius: inherit; padding: 2px;
  background: conic-gradient(from var(--hue), #ff4fa3, #ffb347, #fff176, #4ade80, #38e1ff, #a78bfa, #ff4fa3);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: hue 3s linear infinite;
}
@keyframes hue { to { --hue: 360deg; } }
.rtag-r6, .slot.r6 .rtag { background: linear-gradient(90deg, #ff4fa3, #ffb347, #38e1ff); -webkit-background-clip: text; background-clip: text; color: transparent !important; }
.reveal.mythic::before { background: repeating-conic-gradient(from 0deg, rgba(255, 79, 163, .35) 0 8deg, rgba(56, 225, 255, .3) 8deg 16deg, transparent 16deg 24deg) !important; animation-duration: 6s !important; }

/* ---- 어드민 등급: 붉게 고동치는 빛 ---- */
.slot.r7, .part.r7, .pick.r7 { border-color: #ff3b3b !important; background: linear-gradient(160deg, rgba(120, 10, 20, .55), rgba(20, 4, 8, .85)) !important; animation: adminPulse 1.6s ease-in-out infinite; }
.pick.r7 { position: relative; }
@keyframes adminPulse { 50% { box-shadow: 0 0 22px -2px rgba(255, 59, 59, .85); } }
.slot.r7 .rtag::before, .part.r7 .pv::before { content: "♛ "; color: #ffd166; }
.slot.r7 .rtag { color: #ff6b6b !important; }

/* ---- 관리자 선물 ---- */
.gift-list { display: grid; gap: 6px; margin: 10px 0; }
.gift-list p { margin: 0; padding: 9px 12px; border-radius: 12px; background: rgba(255, 209, 102, .1); border: 1px solid rgba(255, 209, 102, .35); color: #fde68a; font-weight: 700; }

/* ---- 강화 주문서·강화 ---- */
.ico-scroll { border-radius: 3px; background: linear-gradient(90deg, #b07a3a 0 14%, #f6e3b4 14% 86%, #b07a3a 86%); box-shadow: inset 0 0 0 1px rgba(90, 50, 10, .5); transform: rotate(-12deg); }
.ico-scroll.big { width: 54px; height: 64px; border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(90, 50, 10, .5), 0 8px 24px rgba(246, 227, 180, .25); }
.scroll-art { width: 96px; height: 96px; display: grid; place-items: center; }
.machine.shop h4 small { color: var(--muted); font-size: 12px; font-weight: 600; margin-left: 4px; }
.scroll-own { margin-left: 6px; }
.tools { flex-wrap: wrap; }
.part .lv, .slot .pname .lv { font-style: normal; color: var(--warn); font-weight: 900; }
.enh-card { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; border: 1.5px solid var(--rc); background: linear-gradient(160deg, color-mix(in srgb, var(--rc) 16%, transparent), rgba(8, 30, 55, .7)); position: relative; }
.enh-card .icon { width: 52px; height: 52px; border-radius: 13px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; }
.enh-card .icon svg { width: 40px; height: 40px; }
.enh-card b { display: block; font-size: 16px; }
.enh-card small { color: var(--muted); }
.enh-lv { font-size: 22px; font-weight: 900; }
.enh-lv i { font-style: normal; color: var(--muted); font-size: 16px; }
.enh-lv em { font-style: normal; color: var(--warn); }
.enh-lv .max { color: var(--warn); font-size: 16px; }
.enh-card.ok { animation: enhOk .7s ease; }
.enh-card.bad { animation: enhBad .45s ease; }
@keyframes enhOk { 0% { filter: brightness(2.4); transform: scale(1.06); box-shadow: 0 0 40px var(--rc); } 100% { filter: none; transform: none; } }
@keyframes enhBad { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.enh-msg { text-align: center; font-weight: 900; margin: 10px 0 0; }
.enh-msg.ok { color: var(--warn); }
.enh-msg.bad { color: var(--muted); }
.enh-pips { display: flex; justify-content: center; gap: 5px; margin: 12px 0 2px; }
.enh-pips span { width: 18px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.enh-pips span.on { background: linear-gradient(90deg, #fbbf24, #fde68a); box-shadow: 0 0 6px rgba(251, 191, 36, .6); }
.fact .up { color: var(--good); font-size: 13px; }

/* ---- 일괄 판매 ---- */
.bulk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.bulk-chip { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--rc); background: rgba(0, 20, 40, .5); cursor: pointer; position: relative; }
.bulk-chip input { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; accent-color: var(--accent); }
.bulk-chip span { font-weight: 900; color: var(--rc); }
.bulk-chip small { font-size: 11px; color: var(--muted); }
.bulk-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.bulk-opt input { width: 18px; height: 18px; accent-color: var(--accent); }
.bulk-sum { text-align: center; font-size: 16px; margin: 12px 0 0; }
@media (max-width: 420px) { .bulk-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- 친구와 실시간 경주 ---- */
.race-entry { display: grid; grid-template-columns: 64px 1fr; gap: 6px 12px; align-items: center; padding: 14px 16px; margin-bottom: 12px; border-radius: 20px; background: linear-gradient(135deg, rgba(255, 122, 162, .16), rgba(95, 184, 255, .18)); border: 1px solid rgba(160, 200, 255, .3); }
.race-entry .re-art svg { width: 64px; height: 40px; display: block; }
.race-entry h4 { margin: 0; font-size: 17px; }
.race-entry p { margin: 3px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.race-entry .re-btns { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sub-note.center { text-align: center; }
.room-code { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.room-code small { color: var(--muted); font-weight: 700; }
.room-code b { font-size: 34px; letter-spacing: 6px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.race-players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.rp { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 11px; border-radius: 14px; background: var(--glass-2); border: 1px solid var(--line); border-left: 4px solid var(--pc); min-width: 0; }
.rp .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); flex: none; }
.rp b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rp em { font-style: normal; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.rp em.me { background: var(--pc); color: #1b2033; }
.rp small { width: 100%; color: var(--muted); font-size: 11.5px; }
.rp.empty { border-left-color: var(--line); color: var(--muted); font-size: 13px; opacity: .6; --pc: transparent; }
.rp.empty .dot { border: 1.5px dashed var(--muted); }
.race-set { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, .18); }
.race-set label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.race-set label b { color: var(--text); font-size: 15px; }
.race-set select { font: inherit; font-size: 15px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: #082238; color: var(--text); }
.race-set .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.race-set .sub-note { margin: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 13px; background: rgba(0, 0, 0, .25); }
.seg button { border: 0; padding: 9px 6px; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 13.5px; }
.seg button.on { background: var(--accent); color: #032033; }
.seg button:disabled { cursor: default; }
.race-rules { margin: 12px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.race-rules b { color: var(--accent); }
.lobby-hide { display: block; margin: 8px auto 0; }
.join-form input { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--text); font: inherit; font-size: 28px; font-weight: 900; letter-spacing: 8px; text-align: center; text-transform: uppercase; margin: 10px 0 4px; }

.race-board { position: absolute; left: 10px; top: calc(env(safe-area-inset-top) + 76px); display: grid; gap: 4px; pointer-events: none; z-index: 2; }
.rb { display: grid; grid-template-columns: 18px auto auto; gap: 6px; align-items: center; padding: 4px 9px 4px 6px; border-radius: 999px; background: rgba(2, 16, 30, .62); border-left: 4px solid var(--pc); font-size: 12px; max-width: 190px; }
.rb b { text-align: center; font-weight: 900; color: var(--pc); }
.rb span { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.rb.me { background: rgba(2, 16, 30, .85); box-shadow: 0 0 0 1.5px var(--pc); }
.rb.out { opacity: .5; }
.letterbox .race-board { top: calc(var(--gap) + 10px); }
.race-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 96px; font-weight: 900; color: #fff; text-shadow: 0 6px 30px rgba(56, 225, 255, .7), 0 2px 0 #0b3b5c; pointer-events: none; z-index: 3; }
.race-count.pop { animation: countPop .8s ease-out; }
@keyframes countPop { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .85; } }

.race-result { margin: 12px 0; padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.race-result .rh { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.race-result .rh .ic { width: 18px; height: 18px; color: var(--accent); }
.rr { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; margin-top: 4px; border-radius: 12px; background: var(--glass-2); border-left: 4px solid var(--pc); }
.rr .pl { font-size: 18px; text-align: center; }
.rr span { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr i { font-style: normal; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rr.me { box-shadow: 0 0 0 1.5px var(--pc); }
.rbonus { margin: 10px 0 0; text-align: center; font-weight: 900; color: var(--warn); }
.rnote { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ---- 비밀번호 ---- */
.pw-box input, .pw-form input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--text); font: inherit; font-size: 16px; margin-top: 8px; }
.pw-box .row { margin-top: 6px; }
.pw-form { display: grid; gap: 2px; margin-top: 6px; }

/* ---- 패치 노트 ---- */
.patch-list { display: grid; gap: 12px; max-height: 52vh; overflow-y: auto; margin: 4px 0 6px; }
.patch { padding: 12px 14px; border-radius: 16px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.patch h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.patch h3 small { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.patch ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.patch li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-size: 14px; line-height: 1.55; }
.patch li b { color: var(--accent); }
.ptag { font-size: 11px; font-weight: 900; padding: 2px 7px; border-radius: 999px; margin-top: 2px; background: rgba(255, 255, 255, .12); white-space: nowrap; }
.ptag.race { background: rgba(255, 122, 162, .25); color: #ffb3c9; }
.ptag.bal { background: rgba(251, 191, 36, .22); color: #fde68a; }
.ptag.new { background: rgba(56, 225, 255, .2); color: #a5f3ff; }
.ptag.fix { background: rgba(74, 222, 128, .2); color: #bbf7d0; }

/* ---- 장비 컬렉션 ---- */
.dex-tabs { margin-bottom: 14px; }
.coll-prog .bar div { background: linear-gradient(90deg, #c084fc, #ff4fa3); }
.coll-table { display: grid; gap: 6px; padding: 10px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); overflow-x: auto; }
.coll-row { display: grid; grid-template-columns: 70px repeat(7, minmax(32px, 1fr)); gap: 4px; align-items: center; min-width: 310px; }
.coll-head span { font-size: 10.5px; font-weight: 800; text-align: center; white-space: nowrap; }
.coll-row .cs { display: flex; align-items: center; gap: 4px; font-size: 12px; min-width: 0; }
.coll-row .cs svg { width: 20px; height: 20px; flex: none; }
.coll-row .cs b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coll-cell { aspect-ratio: 1; border-radius: 10px; border: 1px dashed rgba(143, 179, 204, .35); background: rgba(0, 0, 0, .25); color: var(--muted); font-weight: 900; display: grid; place-items: center; padding: 0; }
.coll-cell svg { width: 70%; height: 70%; }
.coll-cell.adm:not(.got) svg { width: 50%; height: 50%; opacity: .5; }
.coll-cell.got { border: 1.5px solid var(--rc); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 30%, transparent), rgba(0, 0, 0, .25)); box-shadow: 0 0 10px color-mix(in srgb, var(--rc) 35%, transparent); }
.coll-sets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.cset { display: grid; grid-template-columns: 1fr auto; gap: 0 6px; padding: 8px 10px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); border-left: 4px solid var(--rc); font-size: 12px; }
.cset b { color: var(--rc); }
.cset span { font-weight: 800; text-align: right; }
.cset i { grid-column: 1 / -1; font-style: normal; color: var(--muted); }
.cset.done { background: color-mix(in srgb, var(--rc) 16%, transparent); }
.cset.done i { color: var(--good); font-weight: 800; }
.coll-detail { text-align: center; }
.coll-detail .cd-ico { width: 96px; height: 96px; margin: 0 auto 8px; border-radius: 24px; display: grid; place-items: center; border: 2px solid var(--rc); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 35%, transparent), rgba(0, 0, 0, .3)); }
.coll-detail .cd-ico svg { width: 64px; height: 64px; }
.coll-detail .tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--rc) 25%, transparent); color: var(--rc); }
.coll-detail h2 { margin: 8px 0 12px; }
.pw-intro { margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .35); font-size: 14px; line-height: 1.55; }
.pw-intro b { color: var(--warn); }
