/* ASMR Shredder — illustrated abyss arcade interface. */
:root {
  color-scheme: dark;
  --bg-deep: #06111e;
  --panel-top: #153347;
  --panel-bot: #0a1b2b;
  --line: rgba(163, 207, 221, .15);
  --line-strong: rgba(163, 207, 221, .3);
  --gold: #f6cc74;
  --cyan: #63e7dd;
  --text-main: #f1f7f8;
  --text-sub: #a6bdca;
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: "Barlow", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

[hidden] {
  display: none !important;
}

html, body {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  background: #06111e;
  color: var(--text-main);
  font-family: var(--font);
  touch-action: none;
}

body {
  background: linear-gradient(90deg, rgba(3, 12, 22, .38), rgba(3, 12, 22, .76) 48%, rgba(3, 12, 22, .38)), url('../assets/ui/abyss-backdrop.webp') center 64% / cover;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid #d3fff5;
  outline-offset: 4px;
}

button:disabled {
  cursor: default;
}

#stageWrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameShell {
  position: relative;
  aspect-ratio: 9 / 16;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(5, 19, 32, .64), rgba(5, 17, 29, .72) 52%, rgba(5, 17, 29, .45)), url('../assets/ui/abyss-backdrop.webp') center / cover;
  box-shadow: 0 0 0 1px rgba(140, 201, 218, .18), 0 0 100px 24px rgba(0, 5, 13, .7);
}

#gameShell.bonus-round {
  background-blend-mode: screen, normal;
}

#gameShell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 15, 25, .48), transparent 22%, transparent 72%, rgba(3, 15, 25, .5));
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

#hudCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.boot-loader {
  position: absolute;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 30px;
  background: linear-gradient(180deg, rgba(5, 18, 31, .4), rgba(5, 18, 31, .45)), url('../assets/ui/abyss-backdrop.webp') center / cover;
}

.boot-blade, .ui-blade, .weapon-art {
  display: block;
  background-image: url('../assets/ui/weapon-atlas.webp');
  background-repeat: no-repeat;
  background-size: 400% 300%;
  background-position: 0 0;
}

.boot-blade {
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 12px 30px rgba(79, 238, 219, .22));
}

.boot-title {
  font-size: clamp(23px, 5vw, 32px);
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
}

.boot-spinner {
  width: 130px;
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(116, 217, 217, .18);
}

.boot-spinner::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  background: var(--cyan);
  animation: loading 1.4s ease-in-out infinite;
}

.boot-text {
  color: #a9c9d3;
  font-size: 10px;
  letter-spacing: .28em;
  font-weight: 700;
}

@keyframes loading {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(325%);
  }
}

.hud-top {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  z-index: 20;
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  min-width: 0;
}

.hud-left {
  align-items: flex-start;
  max-width: 34%;
}

.hud-right {
  align-items: flex-end;
  max-width: 34%;
}

.hud-row {
  display: flex;
  gap: 7px;
}

.pill, .hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(29, 62, 77, .94), rgba(8, 27, 41, .95));
  box-shadow: inset 0 1px 0 rgba(220, 255, 255, .08), 0 5px 15px rgba(0, 7, 15, .24);
  backdrop-filter: blur(12px);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.level-pill {
  color: #d5fff6;
  border-color: rgba(99, 231, 221, .38);
}

.level-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
}

.level-pill.bonus-active {
  color: #ffdfa4;
  border-color: var(--gold);
}

.level-pill.bonus-active::before {
  background: var(--gold);
}

.coin-pill {
  color: var(--gold);
  padding-left: 7px;
  transition: transform .18s ease;
}

.coin-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe6a1, #c78d30);
  border: 2px solid #f5cc74;
  color: #8b571e;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px #aa7027;
}

.coin-pill.pop {
  transform: scale(1.12);
}

.hud-btn {
  position: relative;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}

.hud-btn:hover {
  border-color: var(--cyan);
  background: #1b4455;
}

.hud-btn:active {
  transform: scale(.95);
}

.hud-btn.icon-only {
  padding: 0;
  width: 38px;
  min-width: 38px;
}

.armory-btn {
  border-color: #779ba7;
  color: #e3fff8;
  padding-left: 6px;
}

.ui-blade {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

#armoryBtnLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-btn #langCodeLabel {
  color: #d2efef;
}

.ui-globe {
  display: block;
  width: 16px;
  height: 16px;
  border: 1.5px solid #a7c9d3;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.ui-globe::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -1.5px;
  bottom: -1.5px;
  border: 1px solid #a7c9d3;
  border-radius: 50%;
}

.ui-globe::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  border-top: 1px solid #a7c9d3;
}

.ui-speaker {
  position: relative;
  display: block;
  width: 19px;
  height: 20px;
}

.ui-speaker::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 11px;
  height: 12px;
  background: #c1dce4;
  clip-path: polygon(0 28%, 38% 28%, 100% 0, 100% 100%, 38% 72%, 0 72%);
}

.ui-speaker::after {
  content: "";
  position: absolute;
  right: 0;
  top: 4px;
  width: 7px;
  height: 12px;
  border-right: 2px solid #c1dce4;
  border-radius: 50%;
}

.is-muted .ui-speaker::after {
  width: 2px;
  height: 19px;
  top: 1px;
  right: 7px;
  background: #d9b282;
  border: 0;
  border-radius: 0;
  transform: rotate(-36deg);
}

.notify-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f6cc74;
  border: 2px solid #0b2130;
  box-shadow: 0 0 9px rgba(246, 204, 116, .4);
}

.run-intro {
  position: absolute;
  top: 21%;
  left: 28px;
  right: 28px;
  z-index: 11;
  text-align: center;
  pointer-events: none;
}

.run-intro h1 {
  margin: 0;
  font-size: clamp(20px, 4.5vh, 34px);
  line-height: 1.45;
  letter-spacing: .04em;
  font-weight: 800;
  color: #e6f9f6;
  text-shadow: 0 3px 22px #041421;
  text-wrap: balance;
}

.toast-box {
  position: absolute;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 16px));
  left: 50%;
  transform: translate(-50%, 10px);
  padding: 12px 18px;
  border: 1px solid rgba(99, 231, 221, .5);
  border-radius: 12px;
  background: rgba(11, 39, 53, .97);
  color: #eafff8;
  max-width: 90%;
  width: max-content;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 10px 24px rgba(0, 5, 14, .3);
}

.toast-box.visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(2, 10, 19, .77);
  backdrop-filter: blur(10px);
  touch-action: pan-y;
  animation: fadeIn .18s ease;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #385c70 transparent;
  touch-action: pan-y;
  border: 1px solid #426473;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0, rgba(66, 128, 142, .18), transparent 60%), linear-gradient(165deg, var(--panel-top), var(--panel-bot) 72%);
  box-shadow: inset 0 1px 0 rgba(219, 255, 252, .12), 0 26px 80px rgba(0, 0, 0, .45);
  animation: modalPop .24s cubic-bezier(.2, .8, .3, 1);
}

.modal-title {
  margin: 0 0 14px;
  color: #ecf8f8;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.35;
  text-wrap: balance;
}

.modal-desc {
  margin: 0 0 22px;
  color: #b2c8d3;
  font-size: 13px;
  line-height: 1.85;
}

.danger-text {
  color: #ffbaa9;
}

.gold-text {
  color: #ffe0a1;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 17px;
  flex-shrink: 0;
}

.modal-header-titles {
  min-width: 0;
}

.modal-header-row .modal-title {
  text-align: left;
  margin-bottom: 4px;
  font-size: 20px;
}

.modal-sub {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #9eb8c7;
}

.icon-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid #496575;
  border-radius: 10px;
  background: #203b4d;
  color: #c4d9e1;
  font-size: 14px;
  transition: background .15s ease;
}

.icon-close-btn:hover {
  background: #36576a;
  color: white;
}

.rescue-art {
  position: relative;
  width: 144px;
  height: 150px;
  margin: -5px auto 20px;
}

.rescue-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(34, 211, 209, .18));
}

.penalty-badge {
  position: absolute;
  right: -4px;
  bottom: 2px;
  min-width: 48px;
  height: 34px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffb4a0;
  border-radius: 9px;
  background: #793e3c;
  color: #fff1e8;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 4px 12px #061827;
}

.penalty-card {
  border-color: #7d6564;
}

.cta-btn {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  transition: transform .15s ease, filter .15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 0 #041824, 0 8px 20px rgba(0, 0, 0, .18);
}

.cta-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.cta-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.cta-primary, .cta-shield {
  color: #062a33;
  background: linear-gradient(120deg, #9aeee1, #52c8c1);
}

.cta-primary {
  margin-top: 14px;
}

.cta-shield {
  margin-bottom: 12px;
}

.cta-reward, .cta-topup, .cta-gacha {
  color: #3b2a15;
  background: linear-gradient(120deg, #ffe5a3, #e5b667);
}

.cta-reward::before, .cta-topup::before, .cta-shield::before {
  content: "▶";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  font-size: 9px;
  flex-shrink: 0;
}

.cta-gacha:disabled {
  color: #9aadb9;
  background: #294050;
  border-color: #3f5664;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.ghost-btn {
  width: 100%;
  padding: 12px;
  min-height: 44px;
  border: 1px solid #385264;
  border-radius: var(--radius-sm);
  background: rgba(6, 24, 37, .3);
  color: #afc5d0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.ghost-btn:hover {
  color: white;
  background: #243e50;
}

.reward-art {
  display: block;
  width: 190px;
  height: 126px;
  object-fit: contain;
  margin: -10px auto 8px;
}

.result-card {
  border-color: #8c7b5a;
}

.result-card .modal-title {
  margin-bottom: 18px;
}

.bonus-banner {
  padding: 10px;
  border: 1px solid #8d794b;
  border-radius: 10px;
  background: #433c26;
  color: #ffdf99;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 14px 0;
  border-block: 1px solid var(--line);
  margin-bottom: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 5px;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--line);
}

.stat-label {
  font-size: 11px;
  color: #b4c7d1;
  line-height: 1.5;
}

.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: white;
  font-variant-numeric: tabular-nums;
}

.stat-val.accent {
  color: var(--cyan);
}

.earned-box {
  margin: 4px 0 20px;
  padding: 4px 0 8px;
}

.earned-label {
  color: #bcd0d7;
  font-size: 12px;
  margin-bottom: 8px;
}

.earned-amount {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(28px, 5vh, 44px);
  line-height: 1.1;
  font-weight: 800;
  color: #ffe1a0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.earned-amount .coin-dot {
  width: 27px;
  height: 27px;
  font-size: 17px;
}

.mult-meter-wrap {
  margin-bottom: 6px;
}

.mult-meter-bar {
  position: relative;
  height: 28px;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid #476271;
  border-radius: 9px;
  background: #061623;
  margin: 6px 0 15px;
  font-size: 12px;
  font-weight: 800;
}

.mult-meter-bar .zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}

.mult-meter-bar .z2 {
  background: #285468;
  color: #c2e5ed;
}

.mult-meter-bar .z3 {
  background: #e7bf77;
  color: #3c2e1b;
}

.mult-needle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: #fff9e6;
  box-shadow: 0 0 0 2px #071c2c;
  border-radius: 2px;
}

.mult-needle::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #fff9e6;
}

.armory-shortcut-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  min-height: 42px;
  border: 1px solid #5d7d85;
  border-radius: 10px;
  background: #203f4b;
  color: #d6eee9;
  font-size: 12px;
}

.armory-card {
  display: flex;
  flex-direction: column;
  max-width: 440px;
  padding: 20px;
  text-align: left;
  overflow-y: auto;
}

.weapon-showcase {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 86px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #3c6b78;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, rgba(68, 168, 170, .18), transparent 65%), #0a2131;
}

.weapon-showcase::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 10px;
  width: 98px;
  height: 4px;
  background: #45838a;
  border-radius: 50%;
  filter: blur(3px);
}

#weaponPreviewCanvas {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 52px;
  flex-shrink: 0;
}

.showcase-info {
  min-width: 0;
}

.showcase-name {
  color: #f6d696;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.showcase-desc {
  margin-top: 4px;
  color: #9db9c7;
  font-size: 11px;
  line-height: 1.6;
}

.weapon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  min-height: 105px;
  max-height: 500px;
  grid-auto-rows: minmax(116px, auto);
  padding: 3px;
  margin: -3px -3px 14px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: #3d6879 transparent;
}

.w-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 100px;
  padding: 6px 5px 9px;
  color: #e5f1f2;
  border: 1px solid #365469;
  border-radius: 12px;
  background: linear-gradient(155deg, #244354, #132a3c);
  transition: transform .15s ease, border-color .15s ease;
}

.w-card.unlocked:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.w-card.equipped {
  border-color: #84ded2;
  background: radial-gradient(ellipse at 50% 10%, #346c70, #183745 80%);
}

.w-card.equipped::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8bdfcc;
  color: #113e41;
  font-size: 10px;
  font-weight: 800;
}

.weapon-art {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 3px rgba(0, 4, 12, .4));
}

.w-card.locked {
  background: linear-gradient(155deg, #193344, #102638);
  border-color: #2a4458;
}

.w-card.locked .weapon-art {
  opacity: .33;
  filter: grayscale(.8) brightness(.7);
}

.w-card-name {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 700;
}

.w-card.locked .w-card-name {
  color: #91aaba;
  letter-spacing: 2px;
}

.w-card-tag {
  max-width: 100%;
  color: #a1dfd6;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.w-card.locked .w-card-tag {
  color: #8da7b7;
}

.w-card.locked .w-card-tag::before {
  content: "";
  display: inline-block;
  margin-right: 4px;
  width: 6px;
  height: 6px;
  border: 1px solid #8da7b7;
  border-radius: 1px;
  box-shadow: 0 -3px 0 -1px #8da7b7;
}

.w-card.roulette-lit {
  border-color: #ffe2a1 !important;
  background: #6e6041 !important;
  transform: scale(.96);
}

.w-card.roulette-lit .weapon-art {
  opacity: .85;
  filter: none;
}

.gacha-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.topup-box {
  padding: 12px;
  border: 1px solid #887751;
  border-radius: 12px;
  background: #373c32;
  text-align: center;
}

.topup-hint {
  color: #ead6a4;
  font-size: 11px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.cta-topup {
  min-height: 44px;
  font-size: 12px;
  padding: 10px;
}

.lang-card {
  max-width: 390px;
  text-align: left;
  padding: 24px;
}

.lang-card .modal-header-row {
  align-items: center;
  margin-bottom: 24px;
}

.lang-card .modal-title {
  font-size: 20px;
  margin: 0;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.lang-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 56px;
  padding: 12px 10px;
  border: 1px solid #355366;
  border-radius: 11px;
  color: #d5e3eb;
  background: #132e40;
  font-size: 12px;
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}

.lang-option-btn:hover {
  border-color: #79bdb9;
  background: #23495b;
}

.lang-option-btn.active {
  color: #ddfff3;
  background: #225455;
  border-color: #77d3c5;
}

.lang-option-short {
  padding: 4px;
  min-width: 25px;
  text-align: center;
  border-radius: 5px;
  background: #254455;
  color: #9fbccc;
  font-size: 9px;
  font-weight: 700;
}

.lang-option-btn.active .lang-option-short {
  color: #123a3c;
  background: #98e3cf;
}

#devAdPreviewOverlay {
  background: rgba(3, 15, 26, .92);
}

.dev-ad-card {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  text-align: center;
  border: 1px solid #507d87;
  border-radius: 20px;
  background: linear-gradient(160deg, #1c4355, #0b2132);
  box-shadow: 0 20px 60px #020a13;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-aspect-ratio: 3/4), (pointer: coarse), (max-height: 580px) {
  #gameShell {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    max-width: none;
    max-height: none;
    box-shadow: none;
  }
}

@media (max-width: 380px) {
  .hud-top {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
  }
  .pill, .hud-btn {
    min-height: 36px;
    padding: 6px 9px;
    font-size: 11px;
  }
  .hud-btn.icon-only {
    width: 36px;
    min-width: 36px;
  }
  .armory-btn {
    padding-left: 3px;
    gap: 3px;
  }
  .hud-row {
    gap: 5px;
  }
  .modal-card {
    padding: 18px;
  }
  .modal-title {
    font-size: 21px;
  }
  #weaponPreviewCanvas {
    width: 108px;
    height: 43px;
  }
  .weapon-showcase {
    gap: 8px;
  }
  .lang-option-btn {
    padding-inline: 8px;
    font-size: 11px;
  }
}

@media (max-width: 338px) {
  #armoryBtnLabel {
    display: none;
  }
  .ui-blade {
    width: 28px;
  }
  .run-intro {
    top: 20%;
  }
}

@media (max-height: 740px) {
  .modal-card {
    padding: 18px;
  }
  .reward-art {
    width: 150px;
    height: 96px;
    margin-top: -6px;
  }
  .rescue-art {
    width: 118px;
    height: 122px;
    margin-bottom: 14px;
  }
  .modal-title {
    font-size: 20px;
    margin-bottom: 12px;
  }
  .result-card .modal-title {
    margin-bottom: 12px;
  }
  .stats-grid {
    padding: 11px 0;
    margin-bottom: 10px;
  }
  .earned-box {
    margin-bottom: 15px;
  }
  .stat-val {
    font-size: 21px;
  }
  .weapon-grid {
    max-height: 350px;
    grid-auto-rows: minmax(104px, auto);
  }
  .w-card {
    min-height: 93px;
  }
  .weapon-art {
    width: 54px;
    height: 54px;
  }
}

@media (max-height: 540px) {
  .modal-backdrop {
    padding-block: max(10px, env(safe-area-inset-top));
  }
  .modal-card {
    max-width: 480px;
    padding: 16px 20px;
  }
  .run-intro {
    top: 25%;
  }
  .run-intro h1 {
    font-size: 22px;
  }
  .rescue-art {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
  }
  .penalty-badge {
    font-size: 16px;
    min-width: 35px;
    height: 26px;
    right: -12px;
  }
  .modal-desc {
    margin-bottom: 14px;
    font-size: 12px;
    line-height: 1.6;
  }
  .reward-art {
    float: left;
    width: 108px;
    height: 88px;
    margin: 0 16px 2px 0;
  }
  .result-card .modal-title {
    margin-top: 4px;
    font-size: 18px;
  }
  .stats-grid {
    border-top: 0;
    padding: 6px 0 10px;
    margin-bottom: 6px;
  }
  .stat-val {
    font-size: 18px;
  }
  .earned-box {
    clear: both;
    margin: 2px 0 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .earned-label {
    margin: 0;
  }
  .earned-amount {
    font-size: 28px;
  }
  .cta-btn {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 12px;
  }
  .cta-primary {
    margin-top: 10px;
  }
  .modal-header-row {
    margin-bottom: 10px;
  }
  .modal-header-row .modal-title {
    font-size: 18px;
  }
  .modal-sub {
    font-size: 10px;
  }
  .weapon-showcase {
    min-height: 62px;
    padding: 6px 10px;
    margin-bottom: 10px;
  }
  #weaponPreviewCanvas {
    width: 108px;
    height: 43px;
  }
  .weapon-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 155px;
    grid-auto-rows: minmax(94px, auto);
    margin-bottom: 10px;
  }
  .w-card {
    min-height: 83px;
  }
  .weapon-art {
    width: 44px;
    height: 44px;
  }
  .gacha-footer {
    gap: 8px;
  }
  .lang-card {
    max-width: 500px;
  }
  .lang-card .modal-header-row {
    margin-bottom: 12px;
  }
  .lang-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .lang-option-btn {
    min-height: 42px;
    padding: 9px;
  }
}

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

.ready-prompt, .shatter-prompt, .phase-hint {
  position: absolute;
  z-index: 12;
  pointer-events: none;
  text-align: center;
  border: 1px solid #5b9d9f;
  background: linear-gradient(155deg, rgba(22, 57, 72, .96), rgba(7, 28, 42, .97));
  box-shadow: 0 8px 30px rgba(0, 7, 16, .3), inset 0 1px 0 rgba(200, 255, 248, .08);
}

.ready-prompt {
  left: 7%;
  right: 7%;
  bottom: max(7%, calc(env(safe-area-inset-bottom) + 20px));
  border-radius: 16px;
  padding: 16px 18px;
}

.ready-prompt strong {
  display: block;
  color: #edfff8;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  text-wrap: balance;
}

.ready-prompt p {
  color: #aacbd3;
  font-size: 12px;
  margin: 7px 0 0;
  line-height: 1.8;
  text-wrap: balance;
}

.phase-hint {
  top: max(116px, 14%);
  left: 8%;
  right: 8%;
  width: fit-content;
  max-width: 84%;
  margin-inline: auto;
  padding: 10px 16px;
  border-radius: 12px;
  color: #c9f6ec;
  font-size: 13px;
  line-height: 1.7;
  text-wrap: balance;
}

.phase-hint[data-phase="APPROACH_WALL"], .phase-hint[data-phase="PLINKO_CASCADE"] {
  border-color: #8d7b50;
  color: #f6d89d;
}

.shatter-prompt {
  top: 50%;
  left: 7%;
  right: 7%;
  transform: translateY(-50%);
  padding: 24px;
  border-radius: 22px;
  border-color: #876d68;
}

.shatter-prompt .boot-blade {
  width: 100px;
  height: 100px;
  margin: 0 auto 18px;
  filter: grayscale(.7) drop-shadow(0 0 16px rgba(255, 159, 132, .25));
  transform: rotate(-18deg);
}

.shatter-prompt h2 {
  color: #ffc7b4;
  font-size: 26px;
  line-height: 1.4;
  margin: 0 0 12px;
}

.shatter-prompt p {
  color: #c5d5df;
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 24px;
  text-wrap: balance;
}

.retry-action {
  display: block;
  border-radius: 12px;
  background: #8bddd0;
  color: #0b3b43;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
}

@media (max-height: 540px) {
  .ready-prompt {
    bottom: max(5%, env(safe-area-inset-bottom));
    left: 22%;
    right: 22%;
    padding: 10px 16px;
  }
  .ready-prompt strong {
    font-size: 14px;
  }
  .ready-prompt p {
    font-size: 11px;
    margin-top: 3px;
  }
  .phase-hint {
    top: 106px;
    padding: 6px 12px;
    font-size: 12px;
  }
  .shatter-prompt {
    max-width: 440px;
    margin-inline: auto;
    padding: 20px;
  }
  .shatter-prompt .boot-blade {
    float: left;
    margin: 0 15px 0 0;
  }
  .shatter-prompt h2 {
    font-size: 22px;
  }
  .shatter-prompt p {
    margin-bottom: 16px;
    font-size: 12px;
  }
  .retry-action {
    clear: both;
    padding: 10px;
  }
}

@media (max-height: 540px) and (min-width: 560px) {
  .armory-card {
    display: grid;
    grid-template-columns: clamp(140px, 22vw, 180px) minmax(0, 1fr);
    gap: 10px;
    max-width: 720px;
  }

  .armory-card .modal-header-row,
  .armory-card .gacha-footer {
    grid-column: 1 / -1;
    margin: 0;
  }

  .armory-card .weapon-showcase {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 8px;
    text-align: center;
    min-height: 0;
  }

  .armory-card #weaponPreviewCanvas {
    width: 86px;
    height: 34px;
  }

  .armory-card .showcase-name {
    font-size: 12px;
  }

  .armory-card .showcase-desc {
    font-size: 10px;
    line-height: 1.35;
  }

  .armory-card .weapon-grid {
    grid-column: 2;
    grid-row: 2;
    height: 130px;
    max-height: 130px;
    min-height: 0;
    margin: 0;
  }

  .armory-card .gacha-footer {
    flex-direction: row;
    align-items: center;
  }

  .armory-card .topup-box,
  .armory-card .cta-gacha {
    flex: 1;
    min-width: 0;
  }

  .armory-card .topup-box {
    padding: 8px;
  }

  .armory-card .topup-hint {
    margin-bottom: 6px;
  }
}

/* ==========================================================================
   EXPANDED CAMPAIGN, ENDLESS ABYSS, WORKSHOP, FEVER & BOSS UI STYLES
   ========================================================================== */

.hud-btn-pill {
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.hud-btn-pill:hover {
  border-color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(220, 255, 255, .14), 0 0 12px rgba(99, 231, 221, .26);
}

.hud-btn-pill:active {
  transform: scale(.96);
}

.level-pill.endless-active {
  color: #f5d0fe;
  border-color: rgba(192, 132, 252, .65);
}

.level-pill.endless-active::before {
  background: #c084fc;
}

.map-btn {
  padding: 5px 9px;
  min-height: 34px;
  gap: 5px;
  border-color: rgba(246, 204, 116, .42);
  color: #fef3c7;
  font-size: 11px;
}

.ui-star-ico {
  color: var(--gold);
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 0 5px rgba(246, 204, 116, .45));
}

.stars-hud-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(246, 204, 116, .16);
  border: 1px solid rgba(246, 204, 116, .36);
  color: #ffe299;
  font-size: 10.5px;
  font-weight: 800;
}

.upgrade-btn {
  padding: 5px 10px;
  min-height: 34px;
  gap: 5px;
  border-color: rgba(99, 231, 221, .42);
  color: #d9fff8;
  font-size: 11px;
}

.ui-workshop-ico {
  color: #fde047;
  font-size: 13px;
  line-height: 1;
}

#mapBtnLabel,
#upgradeBtnLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Golden Fever Overdrive Screen Aura */
#gameShell.fever-active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  box-shadow: inset 0 0 56px rgba(251, 191, 36, .34), inset 0 0 18px rgba(245, 158, 11, .42);
  animation: feverScreenPulse .7s ease-in-out infinite alternate;
}

@keyframes feverScreenPulse {
  from {
    opacity: .68;
  }
  to {
    opacity: 1;
  }
}

/* In-Run Mission Objective Pill */
.mission-hud {
  position: absolute;
  top: calc(max(16px, env(safe-area-inset-top)) + 132px);
  left: max(16px, env(safe-area-inset-left));
  z-index: 15;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 44%;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 210, 224, .28);
  background: linear-gradient(160deg, rgba(13, 36, 51, .84), rgba(6, 19, 31, .88));
  backdrop-filter: blur(8px);
  color: #d5eef4;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 4px 12px rgba(0, 6, 15, .25);
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.mission-hud #missionText {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mission-hud.done,
.mission-hud.completed {
  border-color: rgba(52, 211, 153, .65);
  background: linear-gradient(160deg, rgba(14, 62, 52, .9), rgba(7, 32, 28, .92));
  color: #a7f3d0;
}

/* In-Run Combo & Fever Gauge HUD */
.fever-hud {
  position: absolute;
  top: calc(max(16px, env(safe-area-inset-top)) + 132px);
  right: max(16px, env(safe-area-inset-right));
  z-index: 15;
  pointer-events: none;
  width: clamp(106px, 28%, 146px);
  padding: 6px 9px 7px;
  border-radius: 11px;
  border: 1px solid rgba(99, 231, 221, .32);
  background: linear-gradient(160deg, rgba(15, 38, 54, .86), rgba(7, 20, 32, .9));
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 6, 15, .28);
  transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}

.fever-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 5px;
}

.combo-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(46, 242, 216, .18);
  border: 1px solid rgba(46, 242, 216, .45);
  color: #72f7e8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

.fever-label {
  margin-left: auto;
  color: #b7dce6;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fever-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(5, 14, 24, .85);
  border: 1px solid rgba(163, 207, 221, .2);
  overflow: hidden;
}

.fever-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #06b6d4, #2ef2d8 55%, #fde047);
  transition: width .12s ease-out;
}

.fever-hud.fever-active,
#gameShell.fever-active .fever-hud {
  border-color: #fbbf24;
  background: linear-gradient(160deg, rgba(78, 46, 10, .92), rgba(34, 19, 6, .95));
  box-shadow: 0 0 18px rgba(251, 191, 36, .45);
  transform: scale(1.04);
}

.fever-hud.fever-active .fever-label,
#gameShell.fever-active .fever-hud .fever-label {
  color: #fde047;
  text-shadow: 0 0 8px rgba(251, 191, 36, .65);
}

.fever-hud.fever-active .combo-badge,
#gameShell.fever-active .fever-hud .combo-badge {
  background: rgba(251, 191, 36, .24);
  border-color: #fde047;
  color: #fef08a;
}

.fever-hud.fever-active .fever-bar-fill,
#gameShell.fever-active .fever-hud .fever-bar-fill {
  background: linear-gradient(90deg, #f59e0b, #fde047, #fffbeb, #f97316);
  background-size: 200% 100%;
  animation: feverBarShimmer .65s linear infinite;
}

@keyframes feverBarShimmer {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 200% 50%;
  }
}

/* Top-Center Armored Boss HP Bar */
.boss-hud {
  position: absolute;
  top: clamp(114px, 12.6%, 146px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  pointer-events: none;
  width: min(296px, 72%);
  padding: 7px 12px 9px;
  border-radius: 13px;
  border: 1px solid rgba(251, 146, 60, .68);
  background: linear-gradient(165deg, rgba(58, 17, 29, .94), rgba(22, 10, 24, .96));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .46), 0 0 18px rgba(244, 63, 94, .28);
  backdrop-filter: blur(10px);
}

.boss-hud.boss-hit,
.boss-hud.shake {
  animation: bossHudShake .22s ease;
  border-color: #fde047;
  box-shadow: 0 0 22px rgba(253, 224, 71, .55);
}

@keyframes bossHudShake {
  0%, 100% {
    transform: translateX(-50%) scale(1);
  }
  25% {
    transform: translateX(calc(-50% - 5px)) scale(1.03);
  }
  75% {
    transform: translateX(calc(-50% + 5px)) scale(1.03);
  }
}

.boss-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 11.5px;
}

.boss-badge-ico {
  font-size: 13px;
  flex-shrink: 0;
}

.boss-name {
  color: #ffe4e6;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boss-hp-text {
  margin-left: auto;
  color: #fde047;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.boss-hp-track {
  width: 100%;
  height: 9px;
  padding: 1px;
  border-radius: 999px;
  background: rgba(9, 6, 16, .9);
  border: 1px solid rgba(251, 113, 133, .38);
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e11d48, #f97316 65%, #fde047);
  box-shadow: 0 0 10px rgba(249, 115, 22, .55);
  transition: width .14s ease-out;
}

#bossHud:not([hidden]) ~ #phaseHint {
  top: clamp(174px, 19%, 212px);
}

/* Result Modal: 3-Star Rating, Mission Status & Map Action */
.result-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -8px 0 8px;
  font-size: 30px;
  line-height: 1;
  color: #ffe082;
}

.result-stars > span,
.result-star,
.result-stars .star {
  display: inline-block;
  color: rgba(148, 179, 196, .28);
  text-shadow: none;
  transform: scale(.92);
  transition: transform .25s ease, color .25s ease;
}

.result-stars > span.earned,
.result-stars > span.lit,
.result-stars > span.active,
.result-stars > span.filled,
.result-star.earned,
.result-star.lit,
.result-star.active {
  color: #ffd54f;
  text-shadow: 0 0 16px rgba(251, 191, 36, .65), 0 2px 4px rgba(0, 0, 0, .5);
  transform: scale(1.08);
  animation: starPop .42s cubic-bezier(.2, 1.3, .4, 1) backwards;
}

.result-stars > span:nth-child(2).earned,
.result-stars > span:nth-child(2).lit,
.result-stars > span:nth-child(2).active {
  animation-delay: .09s;
}

.result-stars > span:nth-child(3).earned,
.result-stars > span:nth-child(3).lit,
.result-stars > span:nth-child(3).active {
  animation-delay: .18s;
}

@keyframes starPop {
  0% {
    opacity: 0;
    transform: scale(.35) rotate(-22deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.25) rotate(6deg);
  }
  100% {
    opacity: 1;
    transform: scale(1.08) rotate(0);
  }
}

.result-mission-status {
  margin: 0 auto 12px;
  padding: 6px 12px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148, 197, 214, .28);
  background: rgba(8, 27, 41, .65);
  color: #bfd7e2;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.result-mission-status:empty {
  display: none;
}

.result-mission-status.done,
.result-mission-status.completed {
  border-color: rgba(52, 211, 153, .55);
  background: rgba(16, 68, 56, .65);
  color: #a7f3d0;
}

.result-actions-row {
  display: flex;
  align-items: stretch;
  gap: 9px;
  margin-top: 12px;
}

.result-actions-row .result-map-btn {
  width: auto;
  flex: 0 0 38%;
  min-height: 50px;
  padding: 10px 10px;
  border-color: #4b6e82;
  background: rgba(16, 43, 60, .75);
  color: #d6ecf3;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.result-actions-row .cta-primary {
  flex: 1;
  margin-top: 0;
  min-height: 50px;
}

/* Armory Passive Perk Pill */
.showcase-perk {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(99, 231, 221, .38);
  background: rgba(46, 242, 216, .12);
  color: #84f5e8;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.4;
}

.showcase-perk:empty {
  display: none;
}

/* Modal 5: Chapter & Level Select + Endless Abyss */
.level-card-modal {
  max-width: 456px;
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.level-card-modal .modal-header-row {
  margin-bottom: 0;
}

.chapter-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.chapter-tabs > button,
.chapter-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 6px 4px;
  border: 1px solid #355468;
  border-radius: 10px;
  background: #10283a;
  color: #abc4d1;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.chapter-tabs > button:hover:not(:disabled),
.chapter-tab:hover:not(:disabled) {
  border-color: #6ccbc5;
  color: #e8fbfa;
}

.chapter-tabs > button.active,
.chapter-tabs > button[aria-selected="true"],
.chapter-tab.active {
  background: linear-gradient(155deg, #215761, #143746);
  border-color: var(--cyan);
  color: #e6fffb;
  box-shadow: 0 0 12px rgba(99, 231, 221, .22);
}

.chapter-tabs > button.locked,
.chapter-tabs > button:disabled,
.chapter-tab.locked {
  opacity: .48;
  background: #0c1d2b;
  border-color: #243949;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-height: 270px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: #3b6376 transparent;
}

.level-grid .chapter-header,
.level-grid .level-chapter-header {
  grid-column: 1 / -1;
  font-size: 11.5px;
  font-weight: 800;
  color: #9de8e0;
  padding: 4px 2px 0;
}

.level-grid > button,
.level-card,
.lv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 98px;
  padding: 10px 7px 9px;
  border: 1px solid #36586d;
  border-radius: 13px;
  background: linear-gradient(160deg, #1d3d50, #0f2435);
  color: #edf8fa;
  text-align: center;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.level-grid > button:hover:not(:disabled),
.level-card:hover:not(:disabled),
.lv-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.level-grid > button.current,
.level-grid > button.active,
.level-card.current,
.level-card.active,
.lv-card.current {
  border-color: var(--cyan);
  background: radial-gradient(ellipse at 50% 0%, rgba(99, 231, 221, .24), transparent 70%), linear-gradient(160deg, #214a5c, #11293b);
  box-shadow: 0 0 14px rgba(99, 231, 221, .22);
}

.level-grid > button.boss,
.level-grid > button.boss-level,
.level-card.boss,
.level-card.boss-level,
.lv-card.boss {
  border-color: rgba(246, 204, 116, .58);
  background: radial-gradient(ellipse at 50% 0%, rgba(244, 63, 94, .22), transparent 70%), linear-gradient(160deg, #372334, #152133);
}

.level-grid > button.locked,
.level-grid > button:disabled,
.level-card.locked,
.lv-card.locked {
  opacity: .5;
  background: #102130;
  border-color: #263c4c;
  color: #8ca4b3;
}

.lv-num,
.level-num {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.lv-name,
.level-name,
.level-title {
  max-width: 100%;
  font-size: 10.5px;
  font-weight: 600;
  color: #b7d2de;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lv-stars,
.level-stars {
  font-size: 12px;
  letter-spacing: 2px;
  color: #ffd54f;
}

.boss-badge,
.lv-boss-badge,
.boss-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(244, 63, 94, .24);
  border: 1px solid rgba(251, 113, 133, .55);
  color: #fecdd3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
}

/* Endless Abyss Launch Card */
.endless-launch-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 15px;
  border: 1px solid rgba(192, 132, 252, .52);
  background: radial-gradient(ellipse at 15% 20%, rgba(168, 85, 247, .24), transparent 65%), linear-gradient(155deg, #251d43, #111c30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 22px rgba(0, 0, 0, .28);
}

.endless-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.endless-vortex-ico {
  font-size: 16px;
}

.endless-title {
  color: #f3e8ff;
  font-size: 14.5px;
  font-weight: 800;
}

.endless-desc {
  margin: 4px 0 6px;
  color: #c4b5fd;
  font-size: 11px;
  line-height: 1.5;
}

.endless-best-stat {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(250, 204, 21, .14);
  border: 1px solid rgba(250, 204, 21, .36);
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
}

.cta-endless {
  min-height: 44px;
  padding: 10px 14px;
  color: #1e1033;
  background: linear-gradient(120deg, #f5d0fe, #c084fc 48%, #fbbf24);
  font-size: 13px;
}

/* Modal 6: Abyss Workshop — Upgrades & Achievements */
.upgrade-card-modal {
  max-width: 450px;
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upgrade-card-modal .modal-header-row {
  margin-bottom: 0;
}

.workshop-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #0a1b2a;
  border: 1px solid #2d4c5e;
}

.workshop-tab {
  position: relative;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #9cb8c7;
  font-size: 12.5px;
  font-weight: 800;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.workshop-tab:hover {
  color: #e6f7f8;
}

.workshop-tab.active,
.workshop-tab[aria-selected="true"] {
  background: linear-gradient(145deg, #215560, #153646);
  border-color: rgba(99, 231, 221, .55);
  color: #eafffb;
}

.upgrade-list,
.achievement-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #3b6376 transparent;
}

.upgrade-list > *,
.achievement-list > *,
.upgrade-item,
.ach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid #35566a;
  background: linear-gradient(160deg, rgba(27, 58, 74, .92), rgba(12, 29, 43, .95));
}

.achievement-list > .claimable,
.ach-item.claimable {
  border-color: rgba(246, 204, 116, .68);
  background: radial-gradient(ellipse at 15% 50%, rgba(250, 204, 21, .16), transparent 65%), linear-gradient(160deg, #2b4448, #122938);
}

.achievement-list > .claimed,
.ach-item.claimed {
  opacity: .76;
  border-color: rgba(52, 211, 153, .35);
}

.upg-info,
.upgrade-info,
.ach-info {
  flex: 1;
  min-width: 0;
}

.upg-title-row,
.upgrade-header,
.ach-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.upg-name,
.upgrade-name,
.ach-name {
  color: #f0f9fa;
  font-size: 13px;
  font-weight: 800;
}

.upg-lv,
.upgrade-lv,
.ach-progress-text {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(99, 231, 221, .14);
  color: #84f5e8;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.upg-desc,
.upgrade-desc,
.ach-desc {
  margin-top: 3px;
  color: #a3bfcd;
  font-size: 11px;
  line-height: 1.45;
}

.upg-bar,
.ach-bar {
  margin-top: 6px;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(6, 16, 26, .85);
  overflow: hidden;
}

.upg-bar-fill,
.ach-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ef2d8, #f6cc74);
}

.upgrade-list button,
.achievement-list button,
.upg-buy-btn,
.ach-claim-btn {
  flex-shrink: 0;
  min-width: 92px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  background: linear-gradient(120deg, #ffe5a3, #e5b667);
  color: #382610;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 #071925;
  transition: transform .12s ease, filter .12s ease;
}

.upgrade-list button:hover:not(:disabled),
.achievement-list button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.upgrade-list button:active:not(:disabled),
.achievement-list button:active:not(:disabled) {
  transform: translateY(1px);
}

.upgrade-list button:disabled,
.achievement-list button:disabled {
  background: #233a4a;
  border-color: #365062;
  color: #8ca4b3;
  box-shadow: none;
}

.upgrade-list button.maxed,
.achievement-list button.claimed {
  background: rgba(16, 78, 66, .75);
  border-color: rgba(52, 211, 153, .45);
  color: #a7f3d0;
  box-shadow: none;
}

/* Responsive Refinements for Narrow Portrait & Short Landscape Screens */
@media (max-width: 380px) {
  .mission-hud {
    top: calc(max(12px, env(safe-area-inset-top)) + 124px);
    left: max(10px, env(safe-area-inset-left));
    font-size: 10px;
    padding: 4px 8px;
  }
  .fever-hud {
    top: calc(max(12px, env(safe-area-inset-top)) + 124px);
    right: max(10px, env(safe-area-inset-right));
    padding: 5px 7px 6px;
  }
  .boss-hud {
    width: min(260px, 76%);
    padding: 6px 10px 8px;
  }
  .chapter-tabs {
    gap: 4px;
  }
  .chapter-tabs > button,
  .chapter-tab {
    font-size: 9.5px;
    padding: 5px 2px;
  }
}

@media (max-width: 345px) {
  #mapBtnLabel,
  #upgradeBtnLabel {
    display: none;
  }
}

@media (max-height: 740px) {
  .result-stars {
    font-size: 25px;
    margin: -6px 0 6px;
  }
  .level-grid {
    max-height: 215px;
  }
  .upgrade-list,
  .achievement-list {
    max-height: 280px;
  }
}

@media (max-height: 540px) {
  .hud-left,
  .hud-right {
    flex-direction: row;
    flex-wrap: wrap;
    max-width: 38%;
    gap: 5px;
  }
  .pill,
  .hud-btn {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 10.5px;
  }
  .hud-btn.icon-only {
    width: 32px;
    min-width: 32px;
  }
  .mission-hud {
    top: calc(max(10px, env(safe-area-inset-top)) + 74px);
    max-width: 34%;
  }
  .fever-hud {
    top: calc(max(10px, env(safe-area-inset-top)) + 74px);
    width: clamp(110px, 24%, 150px);
  }
  .boss-hud {
    top: 94px;
    width: min(260px, 52%);
    padding: 5px 10px 7px;
  }
  .result-stars {
    font-size: 22px;
    margin: -2px 0 4px;
  }
  .result-mission-status {
    margin-bottom: 6px;
    padding: 3px 9px;
    font-size: 10.5px;
  }
  .result-actions-row {
    margin-top: 8px;
  }
  .result-actions-row .result-map-btn,
  .result-actions-row .cta-primary {
    min-height: 40px;
  }
  .level-card-modal,
  .upgrade-card-modal {
    max-width: 640px;
    padding: 14px 18px;
    gap: 8px;
  }
  .level-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: 140px;
  }
  .level-grid > button,
  .level-card,
  .lv-card {
    min-height: 76px;
    padding: 6px 5px;
  }
  .endless-launch-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
  }
  .cta-endless {
    width: auto;
    min-width: 150px;
    min-height: 38px;
  }
  .upgrade-list,
  .achievement-list {
    max-height: 195px;
    gap: 6px;
  }
}

