:root {
  --bg: #061226;
  --panel: #0e2246;
  --card: #17345f;
  --card2: #1e4275;
  --line: #040b19;
  --muted: #9fb6da;
  --gold: #ffd24a;
  --teal: #3fe0d0;
  --stroke: 0 1px 0 #040b19, 0 -1px 0 #040b19, 1px 0 0 #040b19, -1px 0 0 #040b19, 1px 1px 0 #040b19, -1px 1px 0 #040b19, 0 2px 0 rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  height: 100vh; height: 100dvh;
  background: radial-gradient(ellipse at 50% 20%, #17407a, #040b19 70%);
  color: #fff;
  font-family: "Jua", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; }
img { -webkit-user-drag: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

#app {
  /* Scale the entire phone layout together, including buttons and text. */
  --game-height: 800px;
  --sheet-height: min(calc(var(--game-height) * .46), 400px);
  position: absolute;
  left: 50%; top: 50%;
  width: 400px;
  height: var(--game-height);
  aspect-ratio: 1 / 2;
  transform: translate(-50%, -50%) scale(var(--game-scale, 1));
  transform-origin: center;
  margin: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 0 60px rgba(0, 0, 0, .6);
  text-shadow: var(--stroke);
}

/* ---------- top bar ---------- */
#topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
  background: linear-gradient(#1d4680, #12305c);
  border-bottom: 2px solid var(--line);
  z-index: 5;
}
.profile { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.avatar {
  width: 40px; height: 40px; flex: 0 0 auto; overflow: hidden;
  border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(#7fd8ff, #3a8fd8);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3);
}
.avatar canvas { width: 38px; height: 38px; display: block; }
.pinfo { display: flex; flex-direction: column; min-width: 0; }
.pname { font-size: 11px; color: var(--muted); white-space: nowrap; }
.power { font-size: 14px; color: #ffe08a; white-space: nowrap; }
.power b { font-weight: normal; }
.cur {
  display: flex; align-items: center; gap: 3px;
  height: 28px; min-width: 80px; padding: 0 10px 0 0;
  border-radius: 999px; border: 2px solid var(--line);
  background: rgba(0, 0, 0, .38);
  font-size: 14px;
}
.cur img { width: 30px; height: 30px; margin-left: -8px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.cur.pulse img { animation: coinPop .25s; }
.roundbtn {
  width: 34px; height: 34px; flex: 0 0 auto; padding: 0;
  border-radius: 50%; border: 2px solid var(--line);
  background: linear-gradient(#4f8fe0, #2a5aa8);
  display: grid; place-items: center;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), 0 2px 0 rgba(0, 0, 0, .4);
}

/* ---------- sea & HUD ---------- */
#sea {
  position: relative; flex: 1 1 auto; min-height: 0; /* the sea takes every pixel the dock leaves */
  background: #3fb8e8;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
#hud {
  position: absolute; inset: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 6px; padding: 6px;
  pointer-events: none;
}
.glass, #questBox, #stageBox {
  background: rgba(6, 18, 44, .7);
  border: 2px solid rgba(255, 255, 255, .14);
}
#questBox {
  pointer-events: auto; cursor: pointer;
  width: 124px; flex: 0 0 auto;
  padding: 4px 7px 6px; border-radius: 10px;
  font-size: 10px;
}
#questBox.done { border-color: var(--gold); animation: glow 1s infinite alternate; }
#questBox.claim { animation: bump .3s; }
.qhead { display: flex; justify-content: space-between; align-items: center; color: #ffd56b; }
.qrew { display: flex; align-items: center; gap: 2px; }
.qrew img { width: 14px; height: 14px; }
.qrew b { font-weight: normal; color: #fff; }
#questText { font-size: 11px; margin: 2px 0 4px; line-height: 1.2; }
.qbar, .sbar, .rbar {
  position: relative; overflow: hidden;
  height: 11px; border-radius: 6px; background: rgba(0, 0, 0, .5);
}
.qbar i, .sbar i, .rbar i { display: block; height: 100%; width: 0; transition: width .2s; }
.qbar i { background: linear-gradient(#8ff58a, #34b44b); }
.qbar span, .sbar span, .rbar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; line-height: 1; }
#stageBox {
  flex: 0 1 150px; min-width: 0; text-align: center;
  padding: 3px 10px 6px; border-radius: 12px;
}
#zoneName { font-size: 10px; color: #9fe8ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stageLabel { font-size: 15px; margin: 0 0 3px; }
.sbar i { background: linear-gradient(#7fe8ff, #2a9fe0); }
#stageBox.boss .sbar i { background: linear-gradient(#ff9a8a, #e0342a); }
#stageBox.boss #stageLabel { color: #ffb0a6; }
/* bottom of the sea, like the boss bar (they never show together), clear of the ship */
#btnChallenge {
  pointer-events: auto;
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  padding: 7px 18px; white-space: nowrap;
  border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(#ff8a78, #d6302a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 3px 0 rgba(0, 0, 0, .45);
  font-size: 15px;
  animation: blink .6s infinite alternate;
  transition: bottom .2s ease-out;
}
#app.sheet #btnChallenge { bottom: calc(var(--sheet-height) + 10px); }
#hudRight { pointer-events: auto; display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto; }
.hudbtn {
  width: 38px; height: 28px; padding: 0; border-radius: 8px;
  background: rgba(6, 18, 44, .7); border: 2px solid rgba(255, 255, 255, .15);
  font-size: 12px; display: grid; place-items: center;
}
.hudbtn.on { color: var(--gold); border-color: var(--gold); }
#btnSound.off .w, #btnSound:not(.off) .x { display: none; }
#btnSound.off { color: #ff8a7a; }
/* at the bottom of the sea so it never covers the ship and captain; rides above the tab sheet */
#bossBar {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  width: 76%; pointer-events: none;
  padding: 4px 8px 6px; border-radius: 10px; background: rgba(6, 18, 44, .55);
  transition: bottom .2s ease-out;
}
#app.sheet #bossBar { bottom: calc(var(--sheet-height) + 8px); }
.btop { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 2px; }
.bname { color: #ffb0a6; }
.bbar { height: 11px; border-radius: 6px; border: 2px solid #1a0505; background: #3a1010; overflow: hidden; }
.bbar i { display: block; height: 100%; background: linear-gradient(#ff7a6a, #c8201a); transition: width .15s; }

#toasts {
  position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%);
  transition: bottom .2s ease-out;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none; width: 92%;
}
.toast {
  padding: 5px 12px; border-radius: 999px;
  background: rgba(6, 18, 44, .82); border: 2px solid rgba(255, 255, 255, .2);
  font-size: 13px; text-align: center;
  animation: toastIn .25s;
  transition: opacity .4s, transform .4s;
}
.toast.good { border-color: #ffd24a; color: #ffe8a0; }
.toast.boss { border-color: #ff5a55; color: #ffc0b8; font-size: 15px; }
.toast.warn { border-color: #ff9a4a; color: #ffd0a0; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.banner {
  position: absolute; left: 0; right: 0; top: 38%;
  text-align: center; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(4, 12, 30, .75) 20%, rgba(4, 12, 30, .75) 80%, transparent);
  padding: 8px 0 10px;
  animation: banner 3.2s forwards;
}
.banner small { display: block; font-size: 12px; color: #9fe8ff; }
.banner b { font-weight: normal; font-size: 26px; color: #fff3b0; }

/* ---------- action bar ---------- */
#actionbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 6px;
  background: linear-gradient(#143260, #0e2246);
  border-bottom: 2px solid var(--line);
}
#skillSlots { flex: 1 1 auto; display: flex; gap: 4px; justify-content: space-between; min-width: 0; }
.skill {
  position: relative; flex: 1 1 0; max-width: 50px; aspect-ratio: 1; padding: 0;
  border-radius: 12px; border: 2px solid var(--line);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--cc) 55%, #1a2a50), #10203e);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), 0 2px 0 rgba(0, 0, 0, .4);
  overflow: hidden;
}
.skill .si { position: absolute; inset: 14%; width: 72%; height: 72%; }
.skill .cd { position: absolute; inset: 0; }
.skill .cdt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: normal; font-size: 15px; }
.skill.empty { background: rgba(8, 20, 44, .6); border-style: dashed; border-color: rgba(255, 255, 255, .25); box-shadow: none; }
.skill .plus { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; color: rgba(255, 255, 255, .45); }
.skill.ready { border-color: #fff6c0; box-shadow: 0 0 8px var(--cc), inset 0 2px 0 rgba(255, 255, 255, .3); }
.skill.active { animation: blink .4s infinite alternate; border-color: var(--gold); }
.skill:active { transform: scale(.94); }
#btnAuto {
  flex: 0 0 auto; width: 46px; height: 46px; padding: 0;
  border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(#55607a, #333b50);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2), 0 2px 0 rgba(0, 0, 0, .4);
}
#btnAuto b { font-weight: normal; font-size: 13px; }
#btnAuto small { font-size: 9px; color: #c8d0e0; }
#btnAuto.on { background: linear-gradient(#4fe08a, #1f9a4a); }
#btnAuto.on b { animation: blink .8s infinite alternate; }

/* ---------- panel ---------- */
#dock { position: relative; flex: 0 0 auto; z-index: 6; }
/* tab content: a sheet sliding up from behind the skill bar over the lower sea */
#panel {
  position: absolute; left: 0; right: 0; bottom: 100%;
  height: var(--sheet-height);
  display: flex; flex-direction: column;
  background: linear-gradient(rgba(14, 34, 70, .97), rgba(10, 26, 56, .98));
  border-top: 2px solid var(--line); border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
  transform: translateY(24px); opacity: 0;
  transition: transform .2s ease-out, opacity .2s ease-out;
}
#panel.open { transform: none; opacity: 1; }
#panelHead {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; position: relative;
  padding: 7px 10px 4px; font-size: 15px; color: #fff3b0;
}
#panelHead::before {
  content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 42px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25);
}
#panelTitle { margin-top: 4px; }
#panelClose {
  position: absolute; right: 8px; top: 6px; width: 30px; height: 28px; padding: 0;
  border-radius: 8px; border: 2px solid var(--line); background: linear-gradient(#4a5878, #2c3550);
  font-size: 14px; line-height: 1;
}
#panelBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 10px; }
.thead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 2px 6px; }
.thead .stat { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.thead .stat b { font-weight: normal; color: var(--gold); }
.sub { font-size: 11px; color: var(--muted); margin-left: 4px; }
.hi { width: 22px; height: 22px; }
.seg { display: flex; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; padding: 3px 9px; font-size: 12px; background: #23406e; }
.seg button.on { background: linear-gradient(#ffd96a, #e6a020); color: #3a2200; text-shadow: none; }

.row, .crew, .shiprow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 7px; margin-bottom: 6px;
  border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(var(--card2), var(--card));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08);
}
.ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #2f5c9a, #10264a);
  border: 2px solid var(--line); display: grid; place-items: center;
}
.ico .i { width: 32px; height: 32px; }
.info { flex: 1 1 auto; min-width: 0; }
.info .t { font-size: 14px; }
.info .t em { font-style: normal; font-size: 12px; color: var(--gold); margin-left: 2px; }
.info .d { font-size: 11px; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.info .d b { font-weight: normal; color: #fff; }
.info .d b.nx, .estat b.nx { color: #8ff58a; }
.ci { width: 15px; height: 15px; vertical-align: -3px; margin-right: 1px; }

.buy {
  flex: 0 0 auto; min-width: 82px; padding: 4px 6px 5px;
  border-radius: 10px; border: 2px solid var(--line);
  background: linear-gradient(#5fd06a, #2a9a3e);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 2px 0 rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.buy .bl { font-size: 13px; }
.buy .bc { font-size: 12px; white-space: nowrap; }
.buy .bc.small { font-size: 10px; color: #dfe6f5; }
.buy.no { background: linear-gradient(#5a6478, #3c4458); }
.buy.no .bc { color: #ff9a8a; }
.buy.gem { background: linear-gradient(#ff7ac8, #c83a8a); }
.buy.gem.no { background: linear-gradient(#5a6478, #3c4458); }
.buy.promo { background: linear-gradient(#ffd96a, #e08a10); color: #fff; animation: glow 1s infinite alternate; }
.buy.big { min-width: 96px; }
.buy:disabled { background: linear-gradient(#3c4a66, #2a3450); cursor: default; }
.buy.on:disabled { background: linear-gradient(#3fb0e8, #1f6fb0); }
.buy.max:disabled { background: linear-gradient(#ffd96a, #c08a10); }
.buy:not(:disabled):active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35); }

/* equipment */
.eqgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.eq {
  padding: 7px; border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(color-mix(in srgb, var(--gc) 26%, var(--card2)), var(--card));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gc) 60%, transparent);
  display: flex; flex-direction: column; gap: 5px;
}
.etop { display: flex; gap: 6px; align-items: center; }
.eico { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; border: 2px solid var(--gc); background: #0c1e3e; display: grid; place-items: center; }
.eico .i { width: 30px; height: 30px; }
.slot { font-size: 10px; color: var(--muted); }
.ename { font-size: 13px; color: var(--gc); line-height: 1.15; }
.estat { font-size: 11px; color: var(--muted); }
.estat b { font-weight: normal; color: #fff; }
.pips { display: flex; gap: 2px; }
.pips i { flex: 1; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .45); }
.pips i.f { background: var(--gc); }
.eq .buy { width: 100%; }

/* crew */
.crew { align-items: stretch; }
.crew .pt {
  flex: 0 0 auto; width: 62px; height: 94px; border-radius: 10px;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--cc) 45%, #fff), color-mix(in srgb, var(--cc) 35%, #10264a));
  border: 2px solid var(--line); overflow: hidden;
}
.crew .pt canvas { width: 60px; height: 92px; display: block; }
.crew.off .pt canvas { filter: brightness(.55) saturate(.6); }
.crew .info { display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.crew .ttl { font-size: 11px; color: var(--cc); }
.crew .sk { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.crew .sk b { font-weight: normal; color: #fff3b0; }
.crew .si { width: 18px; height: 18px; }
.crew .cdl { font-size: 10px; color: var(--muted); }
.crew .d2 { font-size: 11px; color: #bfe0ff; }
.crew .q { font-size: 11px; color: #ffd6ec; }
.crew .buy { align-self: center; }

/* ships */
.shiprow.now { border-color: #7fe8ff; box-shadow: 0 0 0 2px rgba(127, 232, 255, .35) inset; }
.shiprow.off { opacity: .6; }
.spv { flex: 0 0 auto; width: 134px; height: 80px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: linear-gradient(#8fdcff, #cdeeff 70%, #3fb8e8 70%); }
.spv canvas { width: 132px; height: 78px; display: block; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.tags span { font-size: 10px; padding: 1px 5px; border-radius: 6px; background: rgba(0, 0, 0, .35); }
.shiprow .buy { min-width: 74px; }

/* raid */
.raidcard {
  display: flex; gap: 8px; align-items: center;
  padding: 8px; border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(#5a1a46, #2a0e2e);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .1);
}
.raidcard .kr { width: 64px; height: 64px; }
.rbar { height: 14px; margin-top: 5px; border: 2px solid #1a0510; }
.rbar i { background: linear-gradient(#ff7aa8, #c8205a); }
.raidact { display: flex; gap: 6px; align-items: center; margin: 7px 0; }
.tix { flex: 1 1 auto; display: flex; align-items: center; gap: 4px; font-size: 15px; }
.tix b { font-weight: normal; }
.raidgo { background: linear-gradient(#ff8a5a, #d6302a); }
.lockmsg { margin: 8px 0; padding: 10px; text-align: center; border-radius: 10px; background: rgba(0, 0, 0, .3); color: var(--muted); font-size: 13px; }
.sec { display: flex; justify-content: space-between; align-items: center; margin: 10px 2px 5px; font-size: 14px; color: #9fe8ff; }
.pearls { font-size: 14px; color: #fff; }
.guild { border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.guild .g { display: flex; align-items: center; gap: 8px; padding: 4px 9px; font-size: 12px; background: #142c55; }
.guild .g:nth-child(even) { background: #18335f; }
.guild .g.me { background: linear-gradient(90deg, #3a6a2a, #1e4a2e); }
.guild .rk { width: 18px; color: var(--gold); }
.guild .gn { flex: 1; }
.guild b { font-weight: normal; }

/* ---------- nav ---------- */
#nav {
  flex: 0 0 auto; display: flex;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  gap: 4px;
  background: linear-gradient(#1a3a6c, #0f2448);
  border-top: 2px solid var(--line);
}
#nav button {
  position: relative; flex: 1; padding: 3px 0 2px;
  border: 2px solid var(--line); border-radius: 10px;
  background: linear-gradient(#2a4f86, #1a3360);
  display: flex; flex-direction: column; align-items: center; font-size: 12px;
}
#nav button img { width: 28px; height: 28px; }
#nav button.on { background: linear-gradient(#ffd96a, #e09a20); color: #fff; }
#nav button.badge::after {
  content: ''; position: absolute; top: 3px; right: 6px; width: 9px; height: 9px;
  border-radius: 50%; background: #ff4a4a; border: 2px solid var(--line);
}

/* ---------- modal ---------- */
#modal {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(2, 8, 20, .65);
  display: grid; place-items: center; padding: 16px;
}
.mbox {
  width: 100%; max-width: 340px; max-height: 92%; overflow-y: auto;
  padding: 14px 14px 12px; border-radius: 16px;
  border: 3px solid var(--line);
  background: linear-gradient(#1f4880, #10264a);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), inset 0 2px 0 rgba(255, 255, 255, .15);
  text-align: center; animation: pop .25s;
}
.mbox h2 { margin: 2px 0 8px; font-weight: normal; font-size: 21px; color: #fff3b0; }
.mbox h2 small { font-size: 13px; color: #9fe8ff; }
.mbox p { margin: 6px 0; font-size: 14px; line-height: 1.45; }
.mbox p b { font-weight: normal; color: var(--gold); }
.mbox .q { color: #ffd6ec; }
.mbox .pt.big { width: 132px; height: 192px; margin: 0 auto; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #bfeaff, #2a6fb0); border: 2px solid var(--line); }
.mbox.welcome .pt.big { width: 122px; height: 172px; }
.mbox .pt.big canvas { display: block; width: 100%; height: 100%; }
.how { text-align: left; font-size: 13px; line-height: 1.5; padding-left: 20px; margin: 6px 0 10px; color: #dfe9fb; }
.how b { font-weight: normal; color: var(--gold); }
.skbox { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, .3); font-size: 13px; margin: 6px 0 10px; }
.skbox .si { width: 24px; height: 24px; }
.skbox b { font-weight: normal; color: #fff3b0; }
.skbox span { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.reward { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 24px; margin: 10px 0; }
.reward .ci { width: 30px; height: 30px; }
.reward b { font-weight: normal; margin-right: 8px; }
.reward.kill { font-size: 16px; color: #ffe8a0; }
.reward.kill .ci { width: 20px; height: 20px; }
.kr.big { width: 84px; height: 84px; }
.mbtn {
  display: block; width: 100%; margin-top: 8px; padding: 9px;
  border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(#5fd06a, #2a9a3e); font-size: 17px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 3px 0 rgba(0, 0, 0, .45);
}
.mbtn.gray { background: linear-gradient(#6a7488, #444c60); }
.mbtn.danger, button.danger { background: linear-gradient(#ff7a6a, #c8302a); }
.mrow { display: flex; gap: 8px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid rgba(255, 255, 255, .1); text-align: left; font-size: 15px; }
.opt small { display: block; font-size: 11px; color: var(--muted); }
.opt.cheat span { color: #ffe08a; }
.tgl, .opt .danger {
  flex: 0 0 auto; min-width: 70px; padding: 6px 10px;
  border-radius: 10px; border: 2px solid var(--line);
  background: linear-gradient(#5a6478, #3c4458); font-size: 14px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25);
}
.tgl.on { background: linear-gradient(#5fd06a, #2a9a3e); }
.ver { font-size: 11px !important; color: var(--muted); }

/* ---------- loading ---------- */
#loading {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1f5aa0, #061226 75%);
  transition: opacity .5s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading h1 { font-weight: normal; font-size: 38px; margin: 0; color: #fff3b0; }
#loading p { color: #9fe8ff; margin: 6px 0 18px; }
.lbar { width: 60%; height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.lbar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #7fe8ff, #3f8fff); animation: load 1s infinite ease-in-out; }

@keyframes coinPop { 50% { transform: scale(1.3); } }
@keyframes glow { from { box-shadow: 0 0 2px rgba(255, 210, 74, .3); } to { box-shadow: 0 0 12px rgba(255, 210, 74, .9); } }
@keyframes bump { 50% { transform: scale(1.08); } }
@keyframes blink { from { opacity: 1; } to { opacity: .55; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes banner { 0% { opacity: 0; transform: scaleY(.3); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.opt .danger { background: linear-gradient(#ff7a6a, #c8302a); }

/* skills tab */
.skact { display: flex; gap: 4px; }
.buy.small { min-width: 0; padding: 3px 7px 4px; }
.buy.small .bl { font-size: 12px; }
.buy.small .bc { font-size: 11px; }
.buy.gray { background: linear-gradient(#6a7488, #444c60); }
.buy.sp { background: linear-gradient(#5fb8ff, #2a6fd0); }
.buy.sp.learn { background: linear-gradient(#ffd96a, #e08a10); }
.buy.sp.no { background: linear-gradient(#5a6478, #3c4458); }
.tier { margin-bottom: 8px; }
.tierh { display: flex; align-items: center; gap: 6px; margin: 4px 2px 5px; font-size: 13px; color: #9fe8ff; }
.tier.locked .row { opacity: .55; }
.skrow { border-left: 4px solid var(--cc); }
.skrow.off .ico { filter: grayscale(.8); }
.ico.sk { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--cc) 60%, #1a2a50), #10264a); }
.new { font-size: 11px; color: #ffd24a; }
.cdl { font-size: 10px; color: var(--muted); }

/* avatar tab */
.deckrow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dslot {
  padding: 3px 0 2px; border-radius: 10px; border: 2px solid var(--line);
  background: linear-gradient(var(--card2), var(--card));
  display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10px;
}
.dslot .hd { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 35%, #bfeaff, #2a6fb0); display: grid; place-items: center; font-size: 16px; }
.dslot .hd canvas { width: 40px; height: 40px; display: block; }
.dslot .hd.empty { background: rgba(0, 0, 0, .35); color: var(--muted); }
.dslot.sel { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 210, 74, .7); }
.dslot.locked { opacity: .45; }
.dhint { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 6px 2px; font-size: 11px; color: var(--muted); min-height: 24px; }
.mini { flex: 0 0 auto; padding: 3px 8px; border-radius: 8px; border: 2px solid var(--line); background: linear-gradient(#6a7488, #444c60); font-size: 11px; }
.avgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.avcard {
  padding: 5px 4px 6px; border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(color-mix(in srgb, var(--cc) 30%, var(--card2)), var(--card));
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.avcard .pt { width: 68px; height: 100px; border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--cc) 45%, #fff), color-mix(in srgb, var(--cc) 35%, #10264a)); }
.avcard .pt canvas { width: 66px; height: 98px; display: block; }
.avcard b { font-weight: normal; font-size: 14px; }
.avcard small { font-size: 10px; color: #dfe6f5; line-height: 1.25; }
.avcard.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.banner.fail { background: linear-gradient(90deg, transparent, rgba(60, 4, 10, .8) 20%, rgba(60, 4, 10, .8) 80%, transparent); }
.banner.fail small { color: #ffb0a6; }
.banner.fail b { color: #ff6a5a; font-size: 30px; }
.warp { display: flex; gap: 5px; align-items: center; padding: 0 4px 10px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.warp select {
  flex: 0 0 auto; min-width: 0; padding: 5px 2px;
  border-radius: 8px; border: 2px solid var(--line); background: #17345f; color: #fff;
  font: inherit; font-size: 13px;
}
.warp #wZone { flex: 1 1 auto; }
.warp #wStage { width: 74px; }
.warp #wCycle { width: 64px; }
.warp .tgl { min-width: 54px; }
.avcard.soon { position: relative; cursor: default; filter: saturate(.35); opacity: .75; }
.avcard.soon .pt canvas { filter: brightness(.5); }
.avcard.soon small { color: #ffd88a; font-size: 12px; }
.soonTag {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
  padding: 2px 7px; border-radius: 8px; background: rgba(4, 11, 25, .85); border: 1px solid rgba(255, 255, 255, .3);
  font-size: 11px; white-space: nowrap;
}

/* skill loadout editor */
.loadout { margin: 0 0 10px; padding: 7px; border-radius: 12px; border: 2px solid var(--line); background: rgba(0, 0, 0, .25); }
.lohead { font-size: 13px; color: #9fe8ff; margin: 0 2px 6px; }
.lohead .sub { display: block; margin: 2px 0 0; }
.loslots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.loslot {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0 3px; min-width: 0;
  border-radius: 10px; border: 2px solid var(--line);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--cc, #2a4f86) 55%, #1a2a50), #10203e);
}
.loslot .si { width: 30px; height: 30px; }
.loslot span { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.loslot b { font-weight: normal; font-size: 20px; line-height: 30px; height: 30px; color: rgba(255, 255, 255, .45); }
.loslot.empty { background: rgba(8, 20, 44, .6); border-style: dashed; border-color: rgba(255, 255, 255, .25); }
.loslot.sel { border-color: var(--gold); border-style: solid; box-shadow: 0 0 8px rgba(255, 210, 74, .8); }
.lo-un { margin-top: 6px; }
.btncol { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.btncol .buy { min-width: 82px; }
.buy.eqoff { background: linear-gradient(#5fd06a, #2a9a3e); }
.buy.eqon { background: linear-gradient(#6a7488, #444c60); }
.skrow.equipped { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cc) 70%, transparent); }
#app.sheet #toasts { bottom: calc(var(--sheet-height) + 62px); }

/* ---------- 장비 tab: gear / ship segments ---------- */
.seg.wide { flex: 1; }
.seg.wide button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; font-size: 14px; position: relative; }
.seg.wide .si { width: 20px; height: 20px; }
.seg button.badge::after {
  content: ''; position: absolute; top: 4px; right: 8px; width: 8px; height: 8px;
  border-radius: 50%; background: #ff4a4a; border: 2px solid var(--line);
}
