:root {
  --bg-0: #070a10;
  --bg-1: #0f1a2a;
  --bg-2: #1d2f47;
  --panel-a: rgba(13, 22, 35, 0.96);
  --panel-b: rgba(8, 14, 24, 0.96);
  --line: #38557c;
  --line-soft: rgba(114, 157, 230, 0.35);
  --text: #e9f4ff;
  --text-dim: #9eb7d6;
  --chips: #6fc3ff;
  --mult: #ff8c7f;
  --ok: #7ef1bc;
  --warn: #f6c14b;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text);
  font-family: "Trebuchet MS", "Verdana", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(65, 110, 180, 0.22), transparent 45%),
    radial-gradient(circle at 88% 85%, rgba(162, 64, 64, 0.16), transparent 40%),
    linear-gradient(135deg, var(--bg-0), var(--bg-1));
  padding: 14px;
  overflow: hidden;
}

.app {
  position: relative;
  width: min(1400px, calc(100vw - 28px), calc((100vh - 28px) * (16 / 9)));
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  max-height: calc(100vh - 28px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 0%, rgba(99, 149, 226, 0.09), transparent 46%),
    linear-gradient(180deg, rgba(15, 24, 38, 0.98), rgba(8, 13, 21, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 220px;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  animation: fadeIn 260ms ease;
}

.top-banner {
  grid-column: 1 / -1;
  grid-row: 1;
  z-index: 2;
}

.top-banner h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.15em;
  font-weight: 900;
}

.top-banner p {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 22;
  padding: 7px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.menu-modal {
  position: absolute;
  inset: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(2px);
  z-index: 1;
}

.menu-dialog {
  position: relative;
  width: min(1120px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  height: auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  z-index: 2;
  border-color: rgba(140, 190, 255, 0.62);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menu-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.menu-body {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
}

.menu-section {
  min-height: 0;
  border: 1px solid rgba(121, 169, 236, 0.34);
  border-radius: 8px;
  padding: 8px;
  background: rgba(8, 15, 25, 0.84);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.menu-section h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.07em;
  color: #b4d2f3;
  text-transform: uppercase;
}

.menu-slot {
  min-height: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
}

.menu-slot .owned-jokers {
  max-height: none;
}

.menu-slot .owned-joker .meta {
  white-space: pre-line;
}

.menu-section-settings {
  grid-template-rows: auto;
  align-content: start;
  grid-column: 1 / -1;
}

.menu-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #a9c6e7;
}

.confirm-modal {
  position: absolute;
  inset: 0;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.68);
  backdrop-filter: blur(2px);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 24px));
  display: grid;
  gap: 10px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.confirm-dialog p {
  margin: 0;
  color: #bcd5ef;
  font-size: 13px;
  line-height: 1.4;
}

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

.achievement-toast-stack {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 34;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.achievement-toast {
  min-width: 240px;
  max-width: min(360px, 56vw);
  border: 1px solid rgba(137, 194, 255, 0.6);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(20, 45, 73, 0.96), rgba(12, 26, 42, 0.96));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.46);
  padding: 10px;
  animation: achievementToastIn 240ms ease-out forwards;
}

.achievement-toast.is-out {
  animation: achievementToastOut 220ms ease-in forwards;
}

.achievement-toast .k {
  display: block;
  font-size: 10px;
  color: #97bee9;
}

.achievement-toast .v {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #ecf7ff;
  font-weight: 800;
  line-height: 1.35;
}

.panel {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b));
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.hidden {
  display: none !important;
}

.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.board-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.75;
}

.title-panel {
  grid-column: 2;
  grid-row: 2 / span 3;
  align-self: center;
  justify-self: center;
  width: min(440px, 100%);
  padding: 14px;
  border-color: rgba(130, 172, 246, 0.54);
}

.title-panel h2 {
  margin: 0 0 12px;
  letter-spacing: 0.08em;
}

.title-panel label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.title-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

select,
input,
button {
  appearance: none;
  border: 1px solid rgba(106, 144, 204, 0.48);
  border-radius: 8px;
  background: linear-gradient(180deg, #223a59, #1b2c43);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

input {
  background: linear-gradient(180deg, #1a2d47, #15253c);
}

button {
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hud-panel {
  grid-column: 1;
  grid-row: 2 / span 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.hud-item,
.rail-item {
  border: 1px solid rgba(107, 147, 210, 0.25);
  background: rgba(13, 21, 34, 0.88);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.k {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.v {
  font-size: 16px;
  font-weight: 800;
}

#money {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#money::after {
  content: attr(data-money-delta);
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%) scale(0.88);
  opacity: 0;
  pointer-events: none;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(121, 169, 236, 0.42);
  color: #d5ecff;
  background: rgba(15, 28, 44, 0.92);
}

#money.money-delta-up {
  color: #93f6c6;
  text-shadow: 0 0 12px rgba(126, 241, 188, 0.42);
  animation: moneyValuePulse 320ms ease;
}

#money.money-delta-down {
  color: #ffb7af;
  text-shadow: 0 0 12px rgba(255, 107, 107, 0.36);
  animation: moneyValuePulse 320ms ease;
}

#money.money-fail-pulse {
  color: #ffb7af;
  animation: moneyFailPulse 360ms ease;
}

#money.money-delta-up::after,
#money.money-delta-down::after,
#money.money-fail-pulse::after {
  animation: moneyDeltaPop 920ms ease-out;
}

#money.money-delta-up::after {
  border-color: rgba(126, 241, 188, 0.62);
  background: rgba(14, 43, 40, 0.92);
  color: #ddfff0;
}

#money.money-delta-down::after,
#money.money-fail-pulse::after {
  border-color: rgba(255, 130, 130, 0.62);
  background: rgba(56, 21, 25, 0.9);
  color: #ffd5cf;
}

.run-line .v {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  min-height: 30px;
  color: #b7d2f0;
}

.hud-panel .run-line {
  display: none;
}

.menu-slot .run-line {
  display: grid;
}

#scoreMeter {
  margin-top: 2px;
  position: relative;
  height: 18px;
  border: 1px solid rgba(103, 142, 204, 0.34);
  border-radius: 999px;
  overflow: hidden;
  background: #0b1625;
}

#scoreMeterFill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--chips), var(--ok));
  transition: width 280ms ease;
}

#scoreMeterText {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.status-panel {
  grid-column: 2;
  grid-row: 2;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #cce3ff;
  font-weight: 600;
}

.table-panel {
  grid-column: 2;
  grid-row: 3;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.table-canvas {
  width: 100%;
  height: 100%;
  min-height: 188px;
  display: block;
  border: 1px solid rgba(126, 167, 235, 0.32);
  border-radius: 10px;
  cursor: pointer;
  touch-action: none;
  background:
    radial-gradient(circle at 30% 10%, rgba(120, 170, 255, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(16, 27, 44, 0.98), rgba(8, 13, 22, 0.98));
  transition: filter 120ms ease;
}

.cards {
  display: none;
}

.action-panel {
  grid-column: 2;
  grid-row: 4;
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
}

#shopBtn {
  display: none;
}

.selection-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(122, 167, 232, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(11, 20, 34, 0.95), rgba(8, 14, 25, 0.95));
  color: #9fb7d8;
  font-size: 12px;
}

.selection-summary .k {
  flex: 0 0 auto;
  color: #87a7cf;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.selection-summary .v {
  color: #b9cde6;
  font-weight: 600;
  line-height: 1.35;
}

.selection-summary.has-selection .v {
  color: #d8ecff;
}

.target-picker-modal {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
}

.target-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 18, 0.8);
  backdrop-filter: blur(2px);
}

.target-picker-dialog {
  position: relative;
  width: min(620px, calc(100% - 24px));
  max-height: min(86vh, 680px);
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(125, 171, 235, 0.58);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(16, 28, 44, 0.98), rgba(8, 14, 24, 0.98));
  box-shadow: 0 26px 46px rgba(0, 0, 0, 0.5);
}

.target-picker-dialog h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.06em;
}

.target-picker-hint {
  margin: 0;
  font-size: 12px;
  color: #a8c4e6;
}

.target-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  max-height: min(44vh, 340px);
  overflow: auto;
  padding-right: 2px;
}

.target-picker-card {
  border: 1px solid rgba(102, 146, 209, 0.34);
  border-radius: 8px;
  background: rgba(11, 19, 31, 0.95);
  color: #cfe4ff;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  min-height: 42px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.target-picker-card:hover:not(:disabled) {
  border-color: rgba(132, 182, 255, 0.68);
}

.target-picker-card:disabled,
.target-picker-card.is-disabled {
  border-color: rgba(86, 112, 146, 0.32);
  background: rgba(10, 15, 24, 0.92);
  color: #7890ac;
  cursor: not-allowed;
}

.target-picker-card.is-selected {
  border-color: rgba(126, 241, 188, 0.76);
  background: linear-gradient(180deg, rgba(21, 50, 60, 0.95), rgba(11, 34, 43, 0.95));
  color: #e4fff2;
}

.target-picker-card .ord {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #a9ffda;
  border: 1px solid rgba(126, 241, 188, 0.65);
  background: rgba(14, 38, 41, 0.9);
  font-size: 11px;
  font-weight: 800;
}

.target-picker-card .tp-label {
  color: inherit;
  line-height: 1.35;
}

.target-picker-card .tp-status {
  justify-self: end;
  font-size: 10px;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid rgba(121, 168, 233, 0.45);
  color: #bdd6f3;
  background: rgba(12, 21, 33, 0.9);
}

.target-picker-card .tp-status.is-eligible {
  border-color: rgba(128, 184, 255, 0.6);
  color: #d2e7ff;
}

.target-picker-card .tp-status.is-order {
  border-color: rgba(126, 241, 188, 0.75);
  color: #dcffef;
  background: rgba(14, 43, 40, 0.92);
}

.target-picker-card .tp-status.is-ineligible {
  border-color: rgba(122, 142, 172, 0.42);
  color: #8ca3bf;
  background: rgba(12, 19, 29, 0.9);
}

.target-picker-card.is-ineligible .tp-label {
  opacity: 0.68;
}

.target-picker-summary {
  min-height: 34px;
  border: 1px solid rgba(121, 169, 236, 0.3);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.4;
  color: #c2dcfb;
  background: rgba(10, 17, 28, 0.94);
}

.target-picker-summary.is-ready {
  border-color: rgba(126, 241, 188, 0.58);
  color: #dcfff0;
  background: rgba(10, 29, 30, 0.92);
}

.target-picker-summary.is-waiting {
  border-color: rgba(121, 169, 236, 0.3);
}

.target-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#results {
  grid-column: 2;
  grid-row: 5;
  min-height: 148px;
  padding: 8px 10px 9px;
  overflow-y: auto;
  overflow-x: hidden;
  border-color: rgba(153, 188, 241, 0.42);
  background: linear-gradient(180deg, rgba(25, 39, 60, 0.96), rgba(13, 21, 34, 0.96));
}

.results-shell {
  display: grid;
  gap: 7px;
}

.result-transition {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(123, 165, 231, 0.34);
  border-radius: 8px;
  padding: 6px 8px;
  background: linear-gradient(180deg, rgba(19, 35, 56, 0.92), rgba(11, 21, 34, 0.92));
}

.result-phase-pill {
  flex: 0 0 auto;
  min-width: 88px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(129, 176, 248, 0.38);
  background: linear-gradient(180deg, rgba(76, 120, 188, 0.74), rgba(45, 76, 130, 0.74));
  color: #e6f5ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.result-phase-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.result-phase-title {
  font-size: 12px;
  font-weight: 800;
  color: #edf7ff;
}

.result-phase-desc {
  font-size: 11px;
  line-height: 1.2;
  color: #9fc0e5;
}

.result-score-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(147, 187, 241, 0.3);
  border-radius: 8px;
  padding: 7px 9px 8px;
  background: linear-gradient(180deg, rgba(18, 34, 57, 0.95), rgba(10, 18, 30, 0.95));
}

.result-score-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 20%, rgba(141, 196, 255, 0.14) 46%, transparent 72%);
}

.result-score-label {
  font-size: 10px;
  letter-spacing: 0.09em;
  color: #8fb1d7;
  text-transform: uppercase;
}

.result-score-formula {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 900;
  color: #f3fbff;
  letter-spacing: 0.03em;
}

.result-score-gain {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 900;
  color: #ffd484;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 201, 96, 0.42);
}

.result-progress-wrap {
  display: grid;
  gap: 4px;
}

.result-progress-bar {
  height: 9px;
  border: 1px solid rgba(107, 147, 210, 0.35);
  border-radius: 999px;
  background: rgba(8, 14, 22, 0.9);
  overflow: hidden;
}

.result-progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(109, 189, 255, 0.95), rgba(126, 241, 188, 0.95));
  transition: width 320ms ease;
}

.result-progress-text {
  font-size: 11px;
  color: #abc6e8;
  letter-spacing: 0.02em;
}

.result-log-list {
  max-height: 96px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.result-log-line {
  border: 1px solid rgba(102, 142, 206, 0.24);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.35;
  color: #b7d1ee;
  background: rgba(10, 19, 31, 0.86);
}

.result-log-line.is-latest {
  border-color: rgba(152, 202, 255, 0.48);
  color: #e8f6ff;
  background: rgba(18, 33, 52, 0.94);
}

.result-log-line.is-empty {
  color: #97b3d3;
}

#results[data-phase="blind-clear"] .result-phase-pill,
#results[data-phase="boss-clear"] .result-phase-pill,
#results[data-phase="run-win"] .result-phase-pill {
  border-color: rgba(121, 236, 182, 0.56);
  background: linear-gradient(180deg, rgba(39, 122, 89, 0.88), rgba(22, 79, 57, 0.88));
}

#results[data-phase="blind-fail"] .result-phase-pill {
  border-color: rgba(248, 136, 133, 0.58);
  background: linear-gradient(180deg, rgba(137, 53, 53, 0.9), rgba(98, 37, 37, 0.9));
}

#results[data-phase="skip"] .result-phase-pill {
  border-color: rgba(142, 189, 255, 0.6);
  background: linear-gradient(180deg, rgba(50, 93, 156, 0.9), rgba(35, 68, 122, 0.9));
}

#results.results-phase-pop .result-transition {
  animation: resultPhasePop 420ms ease;
}

#results.results-phase-pop .result-phase-pill {
  animation: resultPillPulse 420ms ease;
}

#results.results-score-bursting .result-score-card {
  animation: resultScoreBurst 620ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

#results.results-score-bursting .result-score-gain {
  animation: resultGainPulse 620ms ease-out;
}

#results.results-score-bursting .result-progress-bar span {
  animation: resultProgressPop 620ms ease-out;
}

.shop-panel {
  grid-column: 2;
  grid-row: 3 / span 3;
  z-index: 8;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
}

.pack-panel {
  grid-column: 2;
  grid-row: 3 / span 3;
  z-index: 9;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

#shopItems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 0;
  overflow-y: auto;
  align-content: start;
}

.shop-item {
  text-align: left;
  min-height: 86px;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 9px;
  border-color: rgba(107, 147, 210, 0.38);
  background: linear-gradient(180deg, rgba(25, 40, 62, 0.96), rgba(15, 26, 41, 0.96));
  animation: popIn 180ms ease both;
}

.shop-item:disabled {
  opacity: 0.76;
}

.shop-item-title {
  font-size: 13px;
  font-weight: 900;
  color: #e8f5ff;
  line-height: 1.24;
}

.shop-item-body {
  font-size: 11px;
  line-height: 1.35;
  color: #b7d1ed;
  min-height: 30px;
}

.shop-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.shop-item-price {
  font-size: 12px;
  font-weight: 900;
  color: #d8eeff;
  letter-spacing: 0.02em;
}

.shop-item-badge {
  border-radius: 999px;
  border: 1px solid rgba(121, 169, 236, 0.42);
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #c7dffb;
  background: rgba(10, 20, 32, 0.86);
}

.shop-item-badge.is-ok {
  border-color: rgba(126, 241, 188, 0.6);
  color: #dbffef;
  background: rgba(14, 42, 39, 0.9);
}

.shop-item-badge.is-warn {
  border-color: rgba(246, 193, 75, 0.65);
  color: #ffe8b2;
  background: rgba(58, 43, 13, 0.88);
}

.shop-item-badge.is-fail {
  border-color: rgba(255, 130, 130, 0.62);
  color: #ffd6cf;
  background: rgba(63, 22, 27, 0.88);
}

.shop-item-badge.is-delta {
  border-color: rgba(132, 191, 255, 0.62);
  color: #d8ecff;
  background: rgba(20, 37, 56, 0.9);
}

.shop-item.is-unaffordable {
  border-color: rgba(255, 130, 130, 0.58);
  background: linear-gradient(180deg, rgba(58, 25, 33, 0.94), rgba(35, 16, 22, 0.94));
}

.shop-item.is-unaffordable .shop-item-price {
  color: #ffd1ca;
}

.shop-item.is-sold {
  border-color: rgba(126, 241, 188, 0.45);
  background: linear-gradient(180deg, rgba(19, 47, 53, 0.95), rgba(11, 31, 35, 0.95));
  opacity: 0.92;
}

.shop-item.is-just-sold,
.shop-item.shop-item-feedback-success {
  animation: popIn 180ms ease both, shopItemSuccessPulse 460ms ease;
}

.shop-item.shop-item-feedback-fail {
  animation: shopItemFailPulse 420ms ease;
}

.shop-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.shop-summary {
  border: 1px solid rgba(107, 147, 210, 0.25);
  background: rgba(13, 21, 34, 0.88);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 0;
  max-height: 140px;
  overflow: auto;
}

.shop-summary h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#shopOwnedList {
  margin: 0;
  padding-left: 18px;
  max-height: 120px;
  overflow: auto;
  font-size: 12px;
  color: #c2d8f3;
  line-height: 1.4;
}

#shopOwnedList li {
  margin-bottom: 3px;
}

.shop-owned-item {
  position: relative;
}

.shop-owned-item.is-new {
  color: #ddfff0;
  text-shadow: 0 0 9px rgba(126, 241, 188, 0.28);
  animation: shopOwnedEntry 460ms ease;
}

#shopOwnedList.shop-owned-list-pop {
  animation: shopOwnedListPop 380ms ease;
}

.pack-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 0;
  overflow-y: auto;
  align-content: start;
}

.pack-choice {
  text-align: left;
  min-height: 74px;
}

.rail-panel {
  grid-column: 3;
  grid-row: 2 / span 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.aux-rail-hidden {
  display: none !important;
}

.rail-panel h2 {
  margin: 2px 0 6px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.rail-tip {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #a8c4e5;
}

.joker-rail {
  min-height: 130px;
}

.owned-jokers {
  display: grid;
  gap: 6px;
  max-height: 184px;
  overflow: auto;
}

.collection-controls {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

.collection-controls-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.collection-controls input,
.collection-controls select {
  padding: 6px 7px;
  font-size: 11px;
  border-radius: 6px;
}

.owned-joker {
  border: 1px solid rgba(107, 147, 210, 0.25);
  border-radius: 7px;
  background: rgba(12, 20, 31, 0.95);
  padding: 6px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.owned-joker.joker-seq-fire {
  border-color: rgba(126, 241, 188, 0.82);
  box-shadow: 0 0 0 1px rgba(126, 241, 188, 0.38), 0 0 16px rgba(126, 241, 188, 0.24);
  animation: jokerSeqFire 320ms ease;
}

.owned-joker.joker-seq-fire.shake {
  animation: jokerSeqFire 320ms ease, shake 260ms ease;
}

.owned-joker.is-missing {
  opacity: 0.76;
  border-style: dashed;
}

.owned-joker.boss-facedown {
  border-color: rgba(255, 205, 120, 0.45);
  background: linear-gradient(180deg, rgba(33, 28, 23, 0.96), rgba(18, 15, 12, 0.96));
}

.owned-joker.boss-facedown .name {
  letter-spacing: 0.08em;
}

.owned-joker .name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.owned-joker .meta {
  display: block;
  font-size: 11px;
  color: #a9c8ea;
  margin-bottom: 5px;
  line-height: 1.35;
}

.owned-joker .actions {
  display: flex;
  gap: 4px;
}

.owned-joker .actions button {
  flex: 1;
  font-size: 11px;
  padding: 5px 4px;
}

.debug-filter-actions {
  flex-wrap: wrap;
}

.owned-joker .actions.debug-filter-actions .debug-filter-btn {
  flex: 0 0 auto;
  min-width: 0;
  font-size: 10px;
  padding: 4px 6px;
}

.debug-filter-btn.is-active {
  border-color: rgba(126, 241, 188, 0.74);
  background: linear-gradient(180deg, #234d59, #173947);
  color: #daf7ea;
}

.fx-pop {
  position: absolute;
  pointer-events: none;
  font-weight: 900;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: fxPop 900ms ease-out forwards;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.55);
}

.fx-pop.score {
  color: var(--ok);
  font-size: 22px;
}

.fx-pop.fail {
  color: var(--danger);
  font-size: 18px;
}

.fx-pop.blind-clear {
  color: var(--warn);
  font-size: 24px;
}

.floating-coin {
  position: absolute;
  pointer-events: none;
  color: var(--warn);
  font-weight: 800;
  animation: coinFloat 900ms ease-out forwards;
}

.fx-shine {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent 60%);
  animation: burst 700ms ease-out forwards;
}

.shake {
  animation: shake 260ms ease;
}

.status-pop {
  animation: statusPop 260ms ease;
}

.app.is-resolving .table-canvas {
  filter: brightness(1.08) saturate(1.08);
}

.meter-pulse {
  animation: meterPulse 180ms ease;
}

#activeChips.is-rolling-chips {
  color: #86d3ff;
  text-shadow: 0 0 10px rgba(111, 195, 255, 0.34);
}

#activeMult.is-rolling-mult {
  color: #ffad9f;
  text-shadow: 0 0 10px rgba(255, 140, 127, 0.33);
}

.meter-pulse-chips {
  animation: meterPulse 180ms ease, chipsBeat 210ms ease-out;
}

.meter-pulse-mult {
  animation: meterPulse 180ms ease, multBeat 210ms ease-out;
}

.app.mode-title .hud-panel,
.app.mode-title .status-panel,
.app.mode-title .table-panel,
.app.mode-title .action-panel,
.app.mode-title .rail-panel,
.app.mode-title #results,
.app.mode-title .shop-panel,
.app.mode-title .pack-panel {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes statusPop {
  0% {
    transform: scale(1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
  45% {
    transform: scale(1.01);
    box-shadow: 0 0 0 1px rgba(127, 241, 188, 0.35), 0 0 20px rgba(127, 241, 188, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
}

@keyframes meterPulse {
  0% {
    filter: brightness(1);
  }
  45% {
    filter: brightness(1.35) saturate(1.2);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes chipsBeat {
  0% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-1px) scale(1.05);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes multBeat {
  0% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-1px) scale(1.08);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes popIn {
  from {
    opacity: 0.4;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fxPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -25%) scale(0.8);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -130%) scale(1.08);
  }
}

@keyframes coinFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.84);
  }
  28% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -68px) scale(1);
  }
}

@keyframes burst {
  0% {
    opacity: 0.8;
    transform: scale(0.38);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes jokerSeqFire {
  0% {
    transform: translateX(0) scale(1);
  }
  45% {
    transform: translateX(1px) scale(1.03);
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

@keyframes resultPhasePop {
  0% {
    transform: translateY(3px);
    filter: brightness(1);
  }
  42% {
    transform: translateY(0);
    filter: brightness(1.26);
  }
  100% {
    transform: translateY(0);
    filter: brightness(1);
  }
}

@keyframes resultPillPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 rgba(126, 241, 188, 0);
  }
  38% {
    transform: scale(1.07);
    box-shadow: 0 0 14px rgba(126, 241, 188, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(126, 241, 188, 0);
  }
}

@keyframes resultScoreBurst {
  0% {
    transform: scale(0.97);
    filter: brightness(1);
  }
  36% {
    transform: scale(1.02);
    filter: brightness(1.24) saturate(1.2);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes resultGainPulse {
  0% {
    transform: translateY(0) scale(1);
  }
  26% {
    transform: translateY(-2px) scale(1.13);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes resultProgressPop {
  0% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.32);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes moneyValuePulse {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  42% {
    transform: translateY(-1px) scale(1.06);
    filter: brightness(1.18);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes moneyDeltaPop {
  0% {
    opacity: 0;
    transform: translate(-5px, -50%) scale(0.86);
  }
  24% {
    opacity: 1;
    transform: translate(0, -58%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(1px, -118%) scale(1.02);
  }
}

@keyframes moneyFailPulse {
  0% {
    transform: translateX(0);
    filter: brightness(1);
  }
  24% {
    transform: translateX(-3px);
    filter: brightness(1.18);
  }
  52% {
    transform: translateX(3px);
    filter: brightness(1.14);
  }
  100% {
    transform: translateX(0);
    filter: brightness(1);
  }
}

@keyframes shopItemSuccessPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  36% {
    transform: scale(1.02);
    filter: brightness(1.2) saturate(1.15);
    box-shadow: 0 0 0 1px rgba(126, 241, 188, 0.35), 0 0 16px rgba(126, 241, 188, 0.26);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow: none;
  }
}

@keyframes shopItemFailPulse {
  0% {
    transform: translateX(0);
    filter: brightness(1);
  }
  26% {
    transform: translateX(-4px);
    filter: brightness(1.16);
  }
  54% {
    transform: translateX(3px);
    filter: brightness(1.12);
  }
  100% {
    transform: translateX(0);
    filter: brightness(1);
  }
}

@keyframes shopOwnedEntry {
  0% {
    transform: translateX(-4px);
    opacity: 0.55;
  }
  46% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes shopOwnedListPop {
  0% {
    filter: brightness(1);
  }
  44% {
    filter: brightness(1.2);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes achievementToastIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes achievementToastOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

@media (max-width: 1020px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app {
    width: min(980px, 100%);
    aspect-ratio: auto;
    height: auto;
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(170px, 1fr) auto auto auto;
  }

  .hud-panel,
  .status-panel,
  .table-panel,
  .action-panel,
  #results,
  .shop-panel,
  .pack-panel,
  .rail-panel,
  .title-panel {
    grid-column: 1;
  }

  .hud-panel {
    grid-row: 2;
  }

  .status-panel {
    grid-row: 3;
  }

  .table-panel {
    grid-row: 4;
  }

  .action-panel {
    grid-row: 5;
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .target-picker-dialog {
    width: min(560px, calc(100% - 18px));
    max-height: min(88vh, 640px);
  }

  .target-picker-list {
    grid-template-columns: 1fr;
    max-height: min(46vh, 320px);
  }

  #results {
    grid-row: 6;
  }

  .shop-panel,
  .pack-panel,
  .rail-panel {
    grid-row: 7;
  }

  .title-panel {
    grid-row: 2 / span 4;
  }

  .collection-controls-row {
    grid-template-columns: 1fr;
  }

  .menu-dialog {
    width: min(980px, calc(100% - 16px));
    height: min(92vh, 860px);
  }

  .menu-body {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(0, auto);
    overflow: auto;
  }

  .achievement-toast-stack {
    right: 8px;
    bottom: 8px;
  }
}
