:root {
  --pk-bg: #0d0914;
  --pk-panel: #17101f;
  --pk-panel-2: #1d1528;
  --pk-panel-3: #241e2a;
  --pk-line: #3a3045;
  --pk-line-soft: rgba(58, 48, 69, 0.62);
  --pk-gold: #f0c060;
  --pk-gold-bright: #ffe8b0;
  --pk-purple: #b89fff;
  --pk-cyan: #8fd8ff;
  --pk-green: #6fcf97;
  --pk-red: #ef4444;
  --pk-text: #e0d8ec;
  --pk-muted: #8a7e9a;
}

body {
  display: block;
  padding: 72px 16px 40px;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 18% 0%, rgba(184, 159, 255, 0.1) 0%, transparent 48%),
    radial-gradient(ellipse at 84% 100%, rgba(240, 192, 96, 0.08) 0%, transparent 52%);
}

#mmsAuthEntry {
  display: none !important;
}

.hide {
  display: none !important;
}

.pachinko-page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.page-head {
  max-width: 820px;
  margin: 0 auto 24px;
  text-align: center;
  animation: pkFade 0.4s ease both;
}

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

.page-kicker {
  color: var(--pk-gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 4px;
  opacity: 0.82;
  margin-bottom: 8px;
}

.page-head h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: 3px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pk-gold), #fff4d2 48%, var(--pk-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(240, 192, 96, 0.18));
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--pk-purple);
  font-size: 11px;
  letter-spacing: 3px;
}

.page-lead {
  max-width: 700px;
  margin: 12px auto 0;
  color: var(--pk-muted);
  font-size: 12px;
  line-height: 1.9;
}

.page-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-btn,
.mini-btn,
.icon-btn,
.quick-chip,
.launch-btn {
  font-family: inherit;
  cursor: pointer;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--pk-line);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--pk-purple);
  font-size: 11px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ghost-btn:hover {
  border-color: var(--pk-gold);
  color: var(--pk-gold);
  background: rgba(240, 192, 96, 0.06);
}

.stage-chip {
  border: 1px solid rgba(184, 159, 255, 0.28);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--pk-muted);
  font-size: 10px;
  letter-spacing: 1px;
  background: rgba(184, 159, 255, 0.03);
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.cabinet-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 4%, rgba(184, 159, 255, 0.09), transparent 34%),
    linear-gradient(160deg, #241e2a 0%, #17101f 72%);
  border: 1px solid var(--pk-line);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.48);
}

.cabinet-card::before,
.panel::before,
.start-card::before,
.help-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pk-gold), var(--pk-purple), var(--pk-gold));
  opacity: 0.8;
}

.cabinet-hud {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(13, 9, 20, 0.62);
  border: 1px solid var(--pk-line-soft);
  border-radius: 14px;
}

.hud-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-balance {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hud-label {
  color: var(--pk-muted);
  font-size: 10px;
  letter-spacing: 1px;
}

.hud-balance strong {
  color: var(--pk-gold);
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.hud-unit {
  color: var(--pk-gold);
  font-size: 10px;
  opacity: 0.7;
}

.hud-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hud-chip {
  border: 1px solid rgba(58, 48, 69, 0.9);
  border-radius: 10px;
  padding: 4px 8px;
  color: var(--pk-muted);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.02);
}

.hud-chip b {
  color: var(--pk-text);
  font-weight: 700;
}

.hud-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(58, 48, 69, 0.5);
  color: var(--pk-muted);
  font-size: 9px;
}

.hud-sub b {
  color: var(--pk-cyan);
  font-weight: 700;
}

.hud-status {
  margin-left: auto;
  color: var(--pk-purple);
  font-weight: 700;
  letter-spacing: 1px;
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--pk-line);
  border-radius: 16px;
  background: #0b0712;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.65);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.canvas-shell.running {
  border-color: rgba(240, 192, 96, 0.7);
  box-shadow:
    inset 0 0 36px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(240, 192, 96, 0.13);
}

#pachinkoCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 820;
}

.canvas-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.canvas-badge {
  padding: 4px 9px;
  border: 1px solid rgba(58, 48, 69, 0.75);
  border-radius: 20px;
  background: rgba(10, 6, 18, 0.72);
  color: var(--pk-muted);
  font-size: 8px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(3px);
}

.canvas-badge b {
  color: var(--pk-gold);
}

.controls {
  margin-top: 12px;
}

.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--pk-muted);
  font-size: 11px;
}

.count-value {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--pk-muted);
  font-size: 10px;
}

.count-value input {
  width: 58px;
  padding: 7px 6px;
  border: 1px solid var(--pk-line);
  border-radius: 10px;
  background: #0f0a16;
  color: var(--pk-gold);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.count-value input:focus {
  border-color: var(--pk-gold);
}

.marble-range {
  width: 100%;
  height: 22px;
  margin: 6px 0 2px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.marble-range:disabled {
  opacity: 0.45;
  cursor: default;
}

.marble-range::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(240, 192, 96, 0.7), rgba(184, 159, 255, 0.55));
}

.marble-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid #1a1520;
  background: var(--pk-gold-bright);
  box-shadow: 0 0 10px rgba(240, 192, 96, 0.45);
}

.marble-range::-moz-range-track {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(240, 192, 96, 0.7), rgba(184, 159, 255, 0.55));
}

.marble-range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #1a1520;
  background: var(--pk-gold-bright);
}

.quick-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.quick-chip {
  min-width: 34px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--pk-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--pk-muted);
  font-size: 10px;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.quick-chip:hover {
  border-color: var(--pk-purple);
  color: var(--pk-purple);
}

.quick-chip.on {
  border-color: var(--pk-gold);
  background: rgba(240, 192, 96, 0.12);
  color: var(--pk-gold);
}

.quick-chip:disabled {
  opacity: 0.4;
  cursor: default;
}

.cost-preview {
  margin-left: auto;
  color: var(--pk-gold);
  font-size: 10px;
  white-space: nowrap;
}

.launch-row {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.launch-btn {
  flex: 1;
  min-width: 150px;
  height: 50px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0c060, #e2a62f);
  color: #170f08;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 8px 24px rgba(240, 192, 96, 0.18);
  transition: transform 0.12s, filter 0.15s, opacity 0.2s;
}

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

.launch-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.launch-btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.icon-btn {
  min-width: 52px;
  height: 50px;
  padding: 0 8px;
  border: 1px solid var(--pk-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--pk-muted);
  font-size: 10px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--pk-gold);
  color: var(--pk-gold);
}

.icon-btn.on {
  border-color: var(--pk-purple);
  color: var(--pk-purple);
  background: rgba(184, 159, 255, 0.08);
}

.icon-btn.armed {
  border-color: var(--pk-red);
  color: var(--pk-red);
  background: rgba(239, 68, 68, 0.08);
}

.icon-btn.danger:hover {
  border-color: var(--pk-red);
  color: var(--pk-red);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.control-hint {
  margin-top: 7px;
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.7;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--pk-line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(240, 192, 96, 0.05), transparent 38%),
    linear-gradient(155deg, #241e2a, #17101f);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.26);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
  color: var(--pk-gold);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
}

.panel-note {
  color: var(--pk-muted);
  font-size: 9px;
  letter-spacing: 0.5px;
}

.control-panel .controls {
  margin-top: 0;
}

.mini-btn {
  border: 1px solid var(--pk-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--pk-muted);
  padding: 6px 9px;
  font-size: 9px;
  transition: border-color 0.15s, color 0.15s;
}

.mini-btn:hover:not(:disabled) {
  border-color: var(--pk-gold);
  color: var(--pk-gold);
}

.mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.empty-state {
  padding: 20px 14px;
  border: 1px dashed var(--pk-line);
  border-radius: 12px;
  color: var(--pk-muted);
  font-size: 10px;
  line-height: 1.9;
  text-align: center;
}

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

.summary-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--pk-line-soft);
  border-radius: 10px;
  background: rgba(13, 9, 20, 0.42);
}

.summary-item span {
  display: block;
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.4;
}

.summary-item b {
  display: block;
  margin-top: 2px;
  color: var(--pk-gold);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-item b.positive {
  color: var(--pk-green);
}

.summary-item b.negative {
  color: var(--pk-red);
}

.balance-line {
  margin: 8px 0;
  padding: 6px 8px;
  border: 1px solid rgba(58, 48, 69, 0.55);
  border-radius: 8px;
  background: rgba(184, 159, 255, 0.035);
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.6;
}

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

.stat-grid > div {
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(58, 48, 69, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
}

.stat-grid span {
  display: block;
  color: var(--pk-muted);
  font-size: 8px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-grid b {
  display: block;
  margin-top: 1px;
  color: var(--pk-text);
  font-size: 11px;
  font-weight: 700;
}

.seed-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  color: var(--pk-muted);
  font-size: 9px;
}

.seed-line b {
  color: var(--pk-purple);
}

.seed-line span {
  margin-left: auto;
  opacity: 0.65;
}

.verify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 6px;
  color: var(--pk-muted);
  font-size: 10px;
}

.verify-state {
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--pk-line);
  color: var(--pk-muted);
  font-size: 9px;
  letter-spacing: 1px;
}

.verify-state.ok {
  border-color: rgba(111, 207, 151, 0.55);
  color: var(--pk-green);
  background: rgba(111, 207, 151, 0.07);
}

.verify-state.fail {
  border-color: rgba(239, 68, 68, 0.55);
  color: var(--pk-red);
  background: rgba(239, 68, 68, 0.07);
}

.verify-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.check {
  padding: 3px 7px;
  border: 1px solid var(--pk-line);
  border-radius: 20px;
  color: var(--pk-muted);
  font-size: 8px;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.015);
}

.check.ok {
  border-color: rgba(111, 207, 151, 0.3);
  color: rgba(111, 207, 151, 0.9);
}

.check.fail {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ff9a9a;
  background: rgba(239, 68, 68, 0.06);
}

.slot-dist-head {
  margin: 10px 0 5px;
  color: var(--pk-gold);
  font-size: 10px;
}

.slot-dist {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  min-height: 104px;
  padding: 8px 6px 6px;
  border: 1px solid var(--pk-line-soft);
  border-radius: 10px;
  background: rgba(13, 9, 20, 0.42);
}

.slot-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
}

.slot-bar {
  width: 100%;
  max-width: 20px;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(240, 192, 96, 0.8), rgba(184, 159, 255, 0.4));
  opacity: 0.65;
}

.slot-cell.center .slot-bar {
  background: linear-gradient(180deg, #ffe8b0, #f0c060);
  box-shadow: 0 0 8px rgba(240, 192, 96, 0.35);
  opacity: 1;
}

.slot-cell b {
  color: var(--pk-text);
  font-size: 9px;
  line-height: 1;
}

.slot-cell span {
  width: 100%;
  color: var(--pk-muted);
  font-size: 7px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-cell em {
  color: var(--pk-gold);
  font-size: 7px;
  font-style: normal;
  line-height: 1;
}

.marble-details {
  margin-top: 10px;
  border-top: 1px solid rgba(58, 48, 69, 0.55);
  padding-top: 8px;
}

.marble-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--pk-purple);
  font-size: 10px;
  cursor: pointer;
  list-style: none;
}

.marble-details summary::-webkit-details-marker {
  display: none;
}

.marble-details summary::before {
  content: '▸';
  color: var(--pk-gold);
  margin-right: 4px;
}

.marble-details[open] summary::before {
  content: '▾';
}

.marble-details summary span {
  margin-left: auto;
  color: var(--pk-muted);
  font-size: 9px;
}

.marble-table-wrap {
  max-height: 280px;
  overflow: auto;
  margin-top: 6px;
  border: 1px solid var(--pk-line-soft);
  border-radius: 8px;
}

.marble-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.marble-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 4px;
  background: #1c1426;
  color: var(--pk-muted);
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid var(--pk-line);
  white-space: nowrap;
}

.marble-table td {
  padding: 4px 4px;
  color: var(--pk-text);
  text-align: center;
  border-bottom: 1px solid rgba(58, 48, 69, 0.28);
  white-space: nowrap;
}

.marble-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.012);
}

.row-state {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--pk-line);
  border-radius: 20px;
  font-size: 8px;
}

.row-state.ok {
  border-color: rgba(111, 207, 151, 0.4);
  color: var(--pk-green);
}

.row-state.warn {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ff9a9a;
}

.row-state.run {
  border-color: rgba(184, 159, 255, 0.4);
  color: var(--pk-purple);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 46px;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid rgba(58, 48, 69, 0.55);
  border-radius: 8px;
  background: rgba(13, 9, 20, 0.35);
  color: var(--pk-text);
  font-family: inherit;
  font-size: 9px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.history-row:hover {
  border-color: var(--pk-purple);
}

.history-row.on {
  border-color: rgba(240, 192, 96, 0.65);
  background: rgba(240, 192, 96, 0.05);
}

.history-id {
  color: var(--pk-purple);
  font-weight: 700;
}

.history-net {
  text-align: right;
  color: var(--pk-gold);
}

.history-net.positive {
  color: var(--pk-green);
}

.history-net.negative {
  color: var(--pk-red);
}

.history-check {
  text-align: right;
  font-size: 8px;
  letter-spacing: 0.5px;
}

.history-check.ok {
  color: var(--pk-green);
}

.history-check.fail {
  color: var(--pk-red);
}

.bench-copy {
  margin: 0 0 8px;
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.8;
}

.bench-status {
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(58, 48, 69, 0.55);
  border-radius: 8px;
  background: rgba(184, 159, 255, 0.035);
  color: var(--pk-purple);
  font-size: 9px;
}

.bench-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--pk-line-soft);
  border-radius: 8px;
}

.bench-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 9px;
}

.bench-table th {
  padding: 5px 4px;
  color: var(--pk-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--pk-line);
  white-space: nowrap;
  text-align: center;
}

.bench-table td {
  padding: 5px 4px;
  color: var(--pk-text);
  text-align: center;
  border-bottom: 1px solid rgba(58, 48, 69, 0.28);
  white-space: nowrap;
}

.bench-table tr.bad td {
  background: rgba(239, 68, 68, 0.05);
}

.bench-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.run-only {
  display: none;
}

body.mode-run .run-only {
  display: block;
}

body.mode-run .lab-only {
  display: none !important;
}

.run-strip {
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(58, 48, 69, 0.55);
  color: var(--pk-muted);
  font-size: 9px;
}

body.mode-run .run-strip {
  display: flex;
}

.run-strip b {
  color: var(--pk-gold);
  font-weight: 800;
}

.run-strip span {
  white-space: nowrap;
}

.start-lab-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--pk-line);
  border-radius: 12px;
  padding: 11px 0;
  background: transparent;
  color: var(--pk-purple);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.start-lab-btn:hover {
  border-color: var(--pk-purple);
}

.launch-monitor-panel {
  border-color: rgba(240, 192, 96, 0.28);
}

.launch-monitor {
  padding: 10px 11px;
  border: 1px solid rgba(58, 48, 69, 0.7);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(111, 207, 151, 0.025), rgba(240, 192, 96, 0.045)),
    #0b0712;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.45);
}

.lm-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--pk-muted);
  font-size: 9px;
  letter-spacing: 1px;
}

.lm-main b {
  color: var(--pk-gold-bright);
  font-size: 27px;
  line-height: 1;
  font-family: "Consolas", "Courier New", monospace;
  text-shadow: 0 0 12px rgba(240, 192, 96, 0.35);
}

.lm-main em {
  color: var(--pk-muted);
  font-style: normal;
  font-size: 14px;
}

.lm-main span:last-child {
  color: var(--pk-gold);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 15px;
}

.lm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(58, 48, 69, 0.5);
  color: var(--pk-muted);
  font-size: 9px;
}

.lm-grid b {
  color: var(--pk-purple);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
}

.lm-cap {
  margin-top: 6px;
  color: var(--pk-muted);
  font-size: 8px;
  letter-spacing: 0.5px;
}

.lm-cap b {
  color: var(--pk-cyan);
}
.build-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 210px;
  overflow-y: auto;
}

.build-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(58, 48, 69, 0.5);
  border-radius: 8px;
  background: rgba(13, 9, 20, 0.35);
  font-size: 10px;
  color: var(--pk-text);
}

.build-row span {
  color: var(--pk-muted);
  font-size: 9px;
}

.build-row b {
  color: var(--pk-purple);
  font-size: 9px;
}

.shop-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--pk-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 0%, rgba(240, 192, 96, 0.09), transparent 34%),
    linear-gradient(155deg, #241e2a, #17101f);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.shop-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pk-gold), var(--pk-purple), var(--pk-gold));
}

.shop-kicker {
  color: var(--pk-gold);
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
}

.shop-card > .launch-btn {
  width: 100%;
  margin-top: 10px;
}

.shop-card h2 {
  margin: 5px 0 6px;
  color: var(--pk-text);
  font-size: 22px;
  letter-spacing: 1px;
}

.shop-sub {
  margin: 0 0 14px;
  color: var(--pk-muted);
  font-size: 11px;
  line-height: 1.8;
}

.pick-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pick-card {
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 13px 12px 11px;
  border: 1px solid var(--pk-line);
  border-radius: 14px;
  background: rgba(13, 9, 20, 0.5);
  color: var(--pk-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.pick-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--pk-gold);
  background: rgba(240, 192, 96, 0.06);
}

.pick-card:disabled {
  opacity: 0.38;
  cursor: default;
}

.pick-card.rarity-rare {
  border-color: rgba(143, 216, 255, 0.42);
}

.pick-card.rarity-advanced {
  border-color: rgba(240, 192, 96, 0.58);
  box-shadow: 0 0 18px rgba(240, 192, 96, 0.08);
}

.pick-card .pc-rarity {
  color: var(--pk-gold);
  font-size: 8px;
  letter-spacing: 1.5px;
}

.pick-card .pc-name {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
}

.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.pc-tag {
  padding: 2px 6px;
  border: 1px solid rgba(58, 48, 69, 0.7);
  border-radius: 20px;
  color: var(--pk-muted);
  font-size: 8px;
}

.pc-desc {
  margin-top: 8px;
  color: var(--pk-muted);
  font-size: 10px;
  line-height: 1.65;
}

.pc-effect {
  margin-top: 7px;
  color: var(--pk-purple);
  font-size: 9px;
  line-height: 1.55;
}

.pc-requirement {
  margin-top: 5px;
  color: var(--pk-red);
  font-size: 8px;
  line-height: 1.5;
}

.pc-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--pk-muted);
  font-size: 9px;
}

.pc-price {
  color: var(--pk-gold);
  font-size: 14px;
  font-weight: 800;
}

.pc-price.free {
  color: var(--pk-green);
}

.pc-stacks {
  color: var(--pk-muted);
  font-size: 9px;
}

.shop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(58, 48, 69, 0.55);
  color: var(--pk-muted);
  font-size: 10px;
}

.shop-footer b {
  color: var(--pk-gold);
  font-size: 14px;
}

.shop-hint {
  margin: 9px 0 0;
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
}

.rent-card {
  max-width: 440px;
}

.rent-card .launch-btn {
  width: 100%;
  margin-top: 14px;
}

.rent-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0;
}

.rent-figures > div {
  padding: 10px 8px;
  border: 1px solid rgba(58, 48, 69, 0.6);
  border-radius: 10px;
  background: rgba(13, 9, 20, 0.4);
  text-align: center;
}

.rent-figures span {
  display: block;
  color: var(--pk-muted);
  font-size: 9px;
}

.rent-figures b {
  display: block;
  margin-top: 4px;
  color: var(--pk-gold);
  font-size: 20px;
}

.result-actions {
  display: flex;
  gap: 7px;
  margin-top: 16px;
}

.result-actions .launch-btn {
  flex: 1;
  min-width: 0;
}

.result-actions .ghost-btn {
  min-height: 50px;
}

#shopOverlay,
#dayEndOverlay,
#rentOverlay,
#runResultOverlay {
  z-index: 90;
}

@media (max-width: 640px) {
  .pick-cards {
    grid-template-columns: 1fr;
  }

  .pick-card {
    min-height: 0;
  }

  .shop-card {
    padding: 18px;
    border-radius: 20px;
  }

  .rent-figures {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .ghost-btn {
    min-height: 44px;
  }
}
.page-foot {
  max-width: 900px;
  margin: 24px auto 0;
  padding-top: 14px;
  border-top: 1px solid rgba(58, 48, 69, 0.55);
  color: var(--pk-muted);
  font-size: 9px;
  line-height: 1.8;
  text-align: center;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(10, 6, 18, 0.88);
  backdrop-filter: blur(6px);
}

.start-card,
.help-card,
.shop-card {
  box-sizing: border-box;
}

.start-card,
.help-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 540px;
  padding: 24px;
  border: 1px solid var(--pk-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 10% 0%, rgba(184, 159, 255, 0.11), transparent 36%),
    linear-gradient(160deg, #241e2a, #17101f);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.start-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.start-portrait {
  flex-shrink: 0;
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(240, 192, 96, 0.55);
  background: #0d0914;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.start-kicker {
  color: var(--pk-gold);
  font-size: 9px;
  letter-spacing: 3px;
  opacity: 0.8;
}

.start-top h2 {
  margin: 5px 0 6px;
  font-size: 24px;
  line-height: 1.2;
  color: var(--pk-text);
  letter-spacing: 1px;
}

.start-top p {
  margin: 0;
  color: var(--pk-muted);
  font-size: 11px;
  line-height: 1.85;
}

.start-points {
  display: grid;
  gap: 7px;
  margin: 18px 0;
}

.start-points > div {
  padding: 9px 11px;
  border: 1px solid rgba(58, 48, 69, 0.62);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
}

.start-points b {
  display: block;
  color: var(--pk-gold);
  font-size: 11px;
  margin-bottom: 2px;
}

.start-points span {
  color: var(--pk-muted);
  font-size: 10px;
  line-height: 1.6;
}

.start-card .launch-btn {
  width: 100%;
  flex: none;
}

.start-note {
  margin-top: 10px;
  color: var(--pk-muted);
  font-size: 8px;
  line-height: 1.7;
  text-align: center;
  opacity: 0.75;
}

.help-card {
  max-width: 620px;
  max-height: 86vh;
  overflow-y: auto;
}

.help-block h3 {
  margin: 14px 0 4px;
  color: var(--pk-gold);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.help-block h3:first-child {
  margin-top: 0;
}

.help-block p {
  margin: 0;
  color: var(--pk-muted);
  font-size: 11px;
  line-height: 1.9;
}

.mobile-launch-bar {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border: 1px solid rgba(240, 192, 96, 0.5);
  border-radius: 12px;
  background: #241e2a;
  color: var(--pk-text);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.22s, transform 0.22s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fatal {
  position: fixed;
  inset: 20px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1px solid rgba(239, 68, 68, 0.6);
  border-radius: 16px;
  background: rgba(20, 8, 12, 0.96);
  color: #ffb4b4;
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(240, 192, 96, 0.75);
  outline-offset: 2px;
}

@media (min-width: 981px) and (max-height: 1000px) {
  .page-head {
    margin-bottom: 12px;
  }

  .page-kicker {
    margin-bottom: 4px;
  }

  .page-head h1 {
    font-size: 30px;
  }

  .page-subtitle {
    margin-top: 4px;
  }

  .page-lead {
    display: none;
  }

  .page-actions {
    margin-top: 8px;
  }
}

@media (max-width: 980px) {
  body {
    padding-bottom: 92px;
  }

  .mobile-launch-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(240, 192, 96, 0.45);
    background: rgba(18, 12, 28, 0.96);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
  }

  .mobile-launch-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    color: var(--pk-muted);
    font-size: 10px;
  }

  .mobile-launch-info b {
    color: var(--pk-gold);
    font-size: 16px;
  }

  .mobile-launch-info em {
    color: var(--pk-gold);
    font-size: 9px;
    font-style: normal;
  }

  .mobile-launch-bar .launch-btn {
    flex: 0 0 142px;
    min-width: 0;
    height: 42px;
    font-size: 15px;
    letter-spacing: 1px;
  }

  .canvas-shell {
    width: calc(100% - 8px);
    margin-left: auto;
    margin-right: auto;
  }

  .lab-grid {
    grid-template-columns: 1fr;
  }

  .cabinet-card {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
  }

  .side-panel {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  body {
    padding: 64px 10px 92px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .page-head h1 {
    font-size: 28px;
    letter-spacing: 2px;
  }

  .page-subtitle {
    font-size: 10px;
    letter-spacing: 2px;
  }

  .page-lead {
    display: none;
  }

  .page-actions {
    margin-top: 8px;
  }

  .cabinet-card {
    padding: 10px;
    border-radius: 18px;
  }

  .cabinet-hud {
    padding: 9px 10px;
  }

  .hud-balance strong {
    font-size: 22px;
  }

  .hud-sub {
    gap: 8px;
  }

  .hud-status {
    width: 100%;
    margin-left: 0;
  }

  .launch-row {
    flex-wrap: wrap;
  }

  .launch-btn {
    flex: 1 1 100%;
  }

  .icon-btn {
    flex: 1;
    min-width: 0;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overlay {
    align-items: flex-start;
  }

  .start-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .start-card,
  .help-card {
    padding: 18px;
    border-radius: 20px;
  }

  .start-top h2 {
    font-size: 21px;
  }

  .toast {
    bottom: 76px;
  }
}

@media (max-width: 380px) {
  .quick-chip {
    min-width: 30px;
    padding: 0 7px;
  }

  .cost-preview {
    flex-basis: 100%;
    margin-left: 0;
  }

  .slot-dist {
    gap: 2px;
    padding: 6px 4px 5px;
  }

  .slot-cell span,
  .slot-cell em {
    font-size: 6px;
  }
}

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

  .launch-btn:hover:not(:disabled) {
    transform: none;
  }
}

/* Player layout: cabinet first, a quiet command column second. */
:root { --pk-muted: #b2a5bd; --pk-line: #4a3c50; }
.pachinko-page { max-width: 1040px; }
.lab-grid { grid-template-columns: minmax(0, 600px) minmax(280px, 340px); gap: 24px; justify-content: center; }
.side-panel { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.control-panel { order: -2; }
.build-panel { order: -1; }
.panel-toggle { cursor: pointer; padding: 4px 0; color: var(--pk-text); font-size: 13px; }
.panel-content { margin-top: 12px; }
.panel-content > .panel-head { display: none; }
.panel-content .panel-head:has(button) { display: flex; }
.build-guide { font-size: 12px; line-height: 1.7; color: var(--pk-muted); }
.build-list { max-height: 420px; }
.build-row { font-size: 12px; min-height: 36px; }
.build-row span { flex: 1; font-size: 12px; }
.synergy { padding: 9px 10px; border: 1px solid var(--pk-line); border-radius: 8px; opacity: .75; }
.synergy b, .synergy span { display: block; font-size: 12px; line-height: 1.6; }
.synergy span { font-size: 11px; color: var(--pk-muted); }
.synergy.active { opacity: 1; border-color: var(--pk-gold); background: #f0c0600d; color: var(--pk-gold); }
.settings-menu { position: relative; }
.settings-menu > summary { cursor: pointer; padding: 12px; font-size: 12px; }
.settings-items { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
body.mode-run .hud-chips, body.mode-run .hud-sub > span:not(.hud-status), body.mode-run .canvas-badges, body.mode-run .quick-row { display: none; }
.run-strip { font-size: 12px; gap: 8px 14px; }
.run-strip > span:last-child { display: none; }
.hud-status { font-size: 12px; }
.pc-desc, .pc-effect { font-size: 12px; }
.pc-tags .pc-tag { font-size: 10px; }
.overlay { max-height: 100dvh; box-sizing: border-box; }
.start-card { max-height: calc(100dvh - 40px); overflow-y: auto; }
@media (max-width: 980px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cabinet-card { max-width: 540px; }
  .side-panel { max-width: 540px; }
  .mobile-launch-bar { justify-content: space-between; }
}
@media (max-width: 640px) {
  body { padding: 56px 8px 90px; }
  .page-head { margin-bottom: 10px; }
  .page-head h1 { font-size: 23px; }
  .page-kicker, .page-subtitle { display: none; }
  .page-actions { margin-top: 6px; }
  .cabinet-card { padding: 5px; border-radius: 14px; }
  .cabinet-hud { padding: 8px; margin-bottom: 4px; }
  .canvas-shell { width: 100%; }
  .run-strip { font-size: 11px; gap: 6px 10px; }
  .run-strip > span:nth-last-child(2) { display: none; }
  .panel { padding: 12px; }
  .control-hint { font-size: 11px; }
  .ghost-btn, .mini-btn, .icon-btn { min-height: 36px; }
  .marble-range { min-height: 36px; }
  .count-value input { font-size: 16px; }
  .launch-row > .launch-btn { flex: 1; }
  .launch-row > .icon-btn { flex: 0 0 64px; }
  .settings-menu { flex: 0 0 100%; }
  .settings-menu > summary { padding: 8px; }
  .shop-card { padding: 14px; max-height: calc(100dvh - 24px); }
  .overlay { padding: 12px; }
  .pick-cards { gap: 8px; }
  .pick-card { padding: 10px 12px; }
  .pick-card .pc-name { font-size: 15px; }
  .pc-desc { margin-top: 5px; }
  .pc-effect { display: none; }
  .pc-meta { padding-top: 6px; }
  .start-top { flex-direction: row; text-align: left; gap: 12px; }
  .start-portrait { width: 64px; height: 64px; }
  .start-top h2 { font-size: 19px; }
  .start-points { margin: 12px 0; gap: 5px; }
  .start-points span { font-size: 12px; }
  .start-card { max-height: calc(100dvh - 24px); }
}

.rent-progress { margin-top: 8px; }
.rent-progress progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 6px; accent-color: var(--pk-gold); overflow: hidden; }
.rent-progress progress::-webkit-progress-bar { background: #3a3045; }
.rent-progress progress::-webkit-progress-value { background: linear-gradient(90deg, #b89fff, #f0c060); }
.rent-progress span { display: block; margin-top: 5px; font-size: 11px; color: var(--pk-gold); }

@media (min-width: 981px) {
  .canvas-shell { max-width: max(300px, calc((100dvh - 390px) * .7317)); margin-inline: auto; }
  .hud-sub { margin-top: 3px; padding-top: 3px; }
}
@media (max-width: 640px) {
  body.mode-run .hud-sub { display: none; }
  .page-head h1 { font-weight: 800; }
}

.mobile-step { flex: 0 0 36px; width: 36px; height: 40px; border: 1px solid var(--pk-line); border-radius: 10px; background: var(--pk-panel); color: var(--pk-gold); font-size: 22px; cursor: pointer; }
@media (max-width: 640px) {
  .mobile-launch-bar { gap: 7px; }
  .mobile-launch-bar .launch-btn { flex-basis: 120px; }
  .mobile-launch-info { flex: 1; }
}

@media (max-width: 980px) {
  .page-lead { display: none; }
  .page-head { margin-bottom: 10px; }
  .page-head h1 { font-size: 26px; }
  .page-kicker, .page-subtitle { display: none; }
}
@media (max-width: 640px) {
  .canvas-shell { max-width: min(100%, max(240px, calc((100svh - 330px) * .7317))); }
}

@media (min-width: 641px) and (max-width: 980px) {
  .canvas-shell { max-width: min(100%, max(280px, calc((100svh - 400px) * .7317))); }
}
