
/*
  Pinball native BLK theme integration.
  This build uses the theme's own wrapper/page-header/squares structure,
  then places the pinball game inside it.
*/

:root {
  --pin-bg: #171941;
  --pin-panel: rgba(31, 35, 80, 0.84);
  --pin-panel-strong: rgba(24, 27, 66, 0.96);
  --pin-border: rgba(225, 78, 202, 0.25);
  --pin-border-blue: rgba(29, 140, 248, 0.35);
  --pin-text: #ffffff;
  --pin-muted: rgba(255, 255, 255, 0.68);
}

html,
body {
  min-height: 100%;
}

body.pinball-theme {
  color: var(--pin-text);
  background: #171941;
  overflow-x: hidden;
}

/* Keep the real BLK animated square background visible. */
.pinball-wrapper,
.pinball-game-header,
.pinball-form-header,
.pinball-builder-header {
  position: relative;
  overflow: hidden;
}

.index-page .pinball-game-header,
.index-page .pinball-form-header,
.index-page .pinball-builder-header {
  height: auto !important;
  min-height: 100vh;
  padding: 96px 0 42px;
}

.pinball-theme .squares {
  pointer-events: none;
  z-index: 0;
}

.pinball-theme .page-header::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 85% 12%, rgba(41, 45, 97, 0.70) 0%, rgba(23, 25, 65, 0.25) 45%, rgba(23, 25, 65, 0.05) 70%),
    linear-gradient(180deg, rgba(23, 25, 65, 0.18), rgba(8, 10, 35, 0.86));
}

.pinball-shell,
.pinball-form-shell,
.staff-page.builder-pro {
  position: relative;
  z-index: 2;
}

.navbar {
  background: rgba(23, 25, 65, 0.72) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.28);
}

.navbar .navbar-brand span {
  color: #e14eca;
  font-weight: 800;
}

.navbar .navbar-brand,
.navbar .nav-link {
  color: #fff !important;
}

.navbar .nav-link:hover {
  color: #e14eca !important;
}

.pinball-shell {
  width: min(1520px, calc(100% - 24px));
  margin: 0 auto;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 930px) minmax(280px, 390px);
  gap: 18px;
  align-items: start;
}

.card,
.machine-card,
.panel-box,
.editor-card,
.create-card,
.login-box {
  color: #fff;
  border: 1px solid var(--pin-border);
  border-radius: 0.4285rem;
  background:
    linear-gradient(145deg, rgba(42, 47, 107, 0.90), rgba(24, 27, 66, 0.96)),
    radial-gradient(circle at 12% 0%, rgba(225, 78, 202, 0.16), transparent 24rem);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.45);
}

.machine-card,
.panel-box,
.editor-card {
  overflow: hidden;
}

.card-header,
.card-body,
.card-footer {
  border-color: rgba(255, 255, 255, 0.07);
}

.machine-card .card-body,
.panel-box .card-body,
.create-card .card-body,
.login-box .card-body {
  padding: 18px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.hud div {
  min-height: 70px;
  padding: 13px 14px;
  border-radius: 0.4285rem;
  border: 1px solid rgba(29, 140, 248, 0.36);
  background:
    linear-gradient(145deg, rgba(29, 140, 248, 0.18), rgba(225, 78, 202, 0.12)),
    rgba(255, 255, 255, 0.04);
}

.hud span,
.muted,
.controls-mini span,
.field span {
  color: var(--pin-muted) !important;
}

.hud span {
  display: block;
  font-size: 0.67rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.hud strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 1.22rem;
  font-weight: 800;
}

.canvas-wrap,
.editor-canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 0.4285rem;
  border: 1px solid var(--pin-border-blue);
  background: #050814;
  box-shadow:
    inset 0 0 55px rgba(29, 140, 248, 0.16),
    0 20px 55px rgba(0, 0, 0, 0.42);
}

canvas {
  display: block;
  width: 100%;
  max-height: calc(100vh - 145px);
  object-fit: contain;
  background: #050814;
  touch-action: none;
}

#editorCanvas {
  max-height: none;
}

.message-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(225, 78, 202, 0.30), transparent 26rem),
    rgba(8, 10, 28, 0.88);
  backdrop-filter: blur(6px);
}

.message-overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(460px, 96%);
  padding: 34px 28px;
}

.message-overlay h2,
.title-box h1,
.create-card h1,
.login-box h1,
.builder-title-line h1 {
  margin: 0 0 10px;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.message-overlay h2 {
  font-size: clamp(2.5rem, 7vw, 5rem);
}

.message-overlay p,
.create-card p,
.login-box p {
  color: var(--pin-muted);
  line-height: 1.6;
}

/* Full replacement for old/default buttons, using BLK style everywhere. */
.btn,
button.btn,
a.btn,
.mobile-controls button,
.builder-add-grid button,
.stage-toolbar button,
.quick-transform button,
.selection-assist-grid button,
.item-list-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  border: none;
  border-radius: 0.4285rem;
  padding: 11px 18px;
  color: #fff !important;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  text-decoration: none !important;
  cursor: pointer;
  background: linear-gradient(135deg, #344675, #26345f);
  box-shadow: 0 4px 18px rgba(52, 70, 117, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  appearance: none;
}

.btn:hover,
button.btn:hover,
a.btn:hover,
.mobile-controls button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(52, 70, 117, 0.48);
}

.btn-primary,
.btn.primary,
.primary {
  background: linear-gradient(135deg, #e14eca, #ba54f5) !important;
  box-shadow: 0 4px 18px rgba(225, 78, 202, 0.38) !important;
}

.btn-info {
  background: linear-gradient(135deg, #1d8cf8, #3358f4) !important;
  box-shadow: 0 4px 18px rgba(29, 140, 248, 0.38) !important;
}

.btn-danger,
.btn.danger,
.danger {
  background: linear-gradient(135deg, #fd5d93, #ec250d) !important;
  box-shadow: 0 4px 18px rgba(253, 93, 147, 0.34) !important;
}

.btn-success {
  background: linear-gradient(135deg, #00f2c3, #0098f0) !important;
}

.btn-round {
  border-radius: 30px !important;
}

.btn-sm,
.btn.small,
.small.btn {
  min-height: 31px;
  padding: 7px 11px;
  font-size: 0.68rem;
}

.btn-link,
.icon-btn {
  min-height: 34px;
  padding: 4px 8px;
  color: #fff !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 1.4rem;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.side-actions,
.debug-actions,
.mobile-controls {
  display: grid;
  gap: 9px;
}

.side-actions {
  grid-template-columns: 1fr 1fr;
}

.side-actions .primary,
.side-actions #newGameBtn {
  grid-column: 1 / -1;
}

.debug-actions {
  grid-template-columns: 1fr 1fr;
}

.mobile-controls {
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 14px;
}

.leaderboard {
  margin: 0;
  padding-left: 20px;
  color: var(--pin-muted);
}

.leaderboard li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.leaderboard strong {
  color: #fff;
}

.leaderboard small {
  display: block;
  color: rgba(255, 255, 255, 0.44);
}

.controls-mini {
  display: grid;
  gap: 8px;
}

.controls-mini > div,
.control-row,
.shortcut-grid,
.selected-summary,
.item-list-row {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0.4285rem;
  background: rgba(255, 255, 255, 0.035);
}

.controls-mini > div,
.control-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
}

kbd {
  color: #fff;
  border: 1px solid rgba(225, 78, 202, 0.32);
  border-radius: 4px;
  background: rgba(11, 16, 46, 0.72);
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(29, 140, 248, 0.28);
  border-radius: 0.4285rem;
  padding: 9px 12px;
  color: #fff;
  background-color: rgba(31, 35, 80, 0.9);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #e14eca;
  box-shadow: 0 0 0 2px rgba(225, 78, 202, 0.18);
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  accent-color: #e14eca;
}

input[type="range"] {
  padding: 0;
  accent-color: #e14eca;
}

.field {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
}

.field span {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-line {
  color: #fff;
  border-radius: 0.4285rem;
  padding: 9px 11px;
  background: rgba(253, 93, 147, 0.18);
  border: 1px solid rgba(253, 93, 147, 0.3);
}

.pinball-form-shell {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  width: min(720px, calc(100% - 24px));
  margin: 0 auto;
}

.create-card,
.login-box {
  width: min(620px, 100%);
}

.create-card .card-header,
.login-box .card-header {
  position: relative;
  padding: 26px 24px 0;
}

.create-card .card-img,
.login-box .card-img {
  position: absolute;
  top: -70px;
  right: -50px;
  width: 230px;
  opacity: 0.18;
  pointer-events: none;
}

.create-card .card-title,
.login-box .card-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 7vw, 4.2rem);
  font-weight: 800;
}

/* Dialogs. */
dialog.pinball-dialog {
  width: min(620px, calc(100vw - 26px));
  padding: 0;
  border: 0;
  border-radius: 0.4285rem;
  color: #fff;
  background: transparent;
}

dialog.pinball-dialog::backdrop {
  background: rgba(5, 8, 20, 0.78);
  backdrop-filter: blur(6px);
}

.pinball-dialog form {
  margin: 0;
}

.pinball-dialog header,
.pinball-dialog .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.pinball-dialog .card-body {
  padding: 16px 20px;
}

.pinball-dialog menu,
.pinball-dialog .card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 10px 20px 20px;
}

/* Builder. */
.staff-page.builder-pro {
  width: min(1840px, calc(100% - 20px));
  margin: 0 auto;
}

.builder-compact-header {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.builder-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.builder-title-line h1 {
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
}

.builder-header-actions,
.stage-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-toolbar {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(255, 255, 255, 0.025);
}

.stage-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 31px;
  margin: 0;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 30px;
  color: var(--pin-muted);
  background: rgba(255,255,255,0.035);
  font-size: 0.72rem;
  font-weight: 600;
}

.stage-toolbar input[type="number"] {
  width: 76px;
  min-height: 31px;
  padding: 4px 8px;
}

.stage-toolbar input[type="range"] {
  width: 95px;
}

.editor-layout.pro-layout {
  display: grid;
  grid-template-columns: minmax(600px, 1fr) minmax(330px, 430px);
  gap: 14px;
  align-items: start;
}

.editor-stage-card {
  overflow: hidden;
}

.pro-canvas-wrap {
  border-radius: 0 0 0.4285rem 0.4285rem;
}

.builder-sidebar {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding-right: 2px;
}

.builder-section {
  padding: 0;
  overflow: hidden;
}

.builder-section summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 15px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(225, 78, 202, 0.16), rgba(29, 140, 248, 0.10));
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

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

.builder-section > *:not(summary) {
  margin: 12px;
}

.builder-add-grid,
.quick-transform,
.selection-assist-grid,
.item-list-toolbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.prop-grid,
.pro-props {
  display: grid;
  gap: 9px;
}

.prop-grid label,
.checkbox-field {
  display: grid;
  gap: 5px;
  margin: 0 0 8px;
}

.item-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.item-list-row {
  width: 100%;
  justify-content: flex-start !important;
  text-align: left;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  padding: 12px;
  color: var(--pin-muted);
}

.inline-status {
  background: rgba(0, 242, 195, 0.14);
  border-color: rgba(0, 242, 195, 0.28);
}

.card h1,
.card h2,
.card h3,
.card h4 {
  color: #fff;
}

.panel-box h2 {
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e14eca, #1d8cf8);
  border-radius: 999px;
}

@media (max-width: 1180px) {
  .game-layout,
  .editor-layout.pro-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .builder-sidebar {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .index-page .pinball-game-header,
  .index-page .pinball-form-header,
  .index-page .pinball-builder-header {
    padding-top: 84px;
  }

  .pinball-shell,
  .staff-page.builder-pro {
    width: min(100% - 12px, 100%);
  }

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

  .side-panel {
    grid-template-columns: 1fr;
  }

  .mobile-controls {
    display: grid;
  }

  canvas {
    max-height: calc(100vh - 220px);
  }

  .builder-header-actions,
  .stage-toolbar {
    align-items: stretch;
  }

  .builder-header-actions .btn,
  .stage-toolbar .btn,
  .stage-toolbar label {
    flex: 1 1 auto;
  }
}


/* Builder scroll fix
   The BLK theme's page-header is a hero layout. For the builder/editor it must behave
   like a normal tall admin page so the browser can scroll all the way down. */
html,
body,
body.pinball-theme,
body.staff-body {
  height: auto !important;
  min-height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.staff-body .pinball-wrapper,
body.staff-body .pinball-builder-header {
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  overflow: visible !important;
}

body.staff-body .pinball-builder-header {
  padding-top: 92px !important;
  padding-bottom: 80px !important;
}

body.staff-body .pinball-builder-header::after {
  min-height: 100% !important;
  height: 100% !important;
  max-height: none !important;
}

body.staff-body .pinball-builder-header .squares {
  position: fixed !important;
}

body.staff-body .staff-page.builder-pro {
  position: relative !important;
  z-index: 5 !important;
  padding-bottom: 90px !important;
}

body.staff-body .editor-layout.pro-layout {
  align-items: start !important;
}

body.staff-body .builder-sidebar {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  padding-bottom: 80px !important;
}

body.staff-body .editor-stage-card {
  align-self: start !important;
}

body.staff-body .editor-canvas-wrap {
  max-height: none !important;
  overflow: auto !important;
}

body.staff-body #editorCanvas {
  max-height: none !important;
}

/* Keep the object list usable without forcing the whole right sidebar to become
   its own trapped scroll area. */
body.staff-body .item-list {
  max-height: 360px !important;
  overflow-y: auto !important;
}

/* The fixed navbar can cover the top of the builder when jumping/scrolling. */
body.staff-body .builder-compact-header {
  scroll-margin-top: 95px;
}




/* Builder right-menu normal-flow fix
   The right menu should not be fixed/sticky. It should sit beside the canvas
   and use its own scroll area when its contents are taller than the viewport. */
body.staff-body .pinball-wrapper,
body.staff-body .pinball-builder-header {
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  overflow: visible !important;
}

body.staff-body .pinball-builder-header {
  padding-top: 92px !important;
  padding-bottom: 80px !important;
}

body.staff-body .staff-page.builder-pro {
  position: relative !important;
  z-index: 5 !important;
  padding-bottom: 80px !important;
}

body.staff-body .editor-layout.pro-layout {
  align-items: start !important;
}

body.staff-body .builder-sidebar {
  position: static !important;
  top: auto !important;
  align-self: start !important;
  height: auto !important;
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 8px !important;
  padding-bottom: 20px !important;
}

body.staff-body .builder-sidebar > .builder-section:last-child {
  margin-bottom: 24px !important;
}

body.staff-body .editor-stage-card {
  align-self: start !important;
}

body.staff-body .editor-canvas-wrap {
  max-height: none !important;
  overflow: auto !important;
}

body.staff-body #editorCanvas {
  max-height: none !important;
}

body.staff-body .item-list {
  max-height: 360px !important;
  overflow-y: auto !important;
}

@media (max-width: 1180px) {
  body.staff-body .builder-sidebar {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 80px !important;
  }
}


/* Create table page theme visibility/fallback fix */
body.pinball-theme.create-page-native,
body.create-page-native {
  background:
    radial-gradient(circle at 15% 5%, rgba(225, 78, 202, 0.32), transparent 28rem),
    radial-gradient(circle at 85% 12%, rgba(29, 140, 248, 0.26), transparent 30rem),
    #171941 !important;
}

.create-page-native .pinball-form-header {
  min-height: 100vh !important;
  height: auto !important;
  overflow: hidden !important;
  padding-top: 112px !important;
  padding-bottom: 70px !important;
  background:
    radial-gradient(ellipse at top right, rgba(41, 45, 97, 0.82) 0%, rgba(23, 25, 65, 0.36) 56%, rgba(23, 25, 65, 0.12) 100%),
    #171941 !important;
}

.create-page-native .squares {
  display: block !important;
  opacity: inherit;
  pointer-events: none;
}

.create-page-native .pinball-form-shell {
  position: relative;
  z-index: 5;
}

.create-page-native .create-card {
  position: relative;
  overflow: hidden;
}

.create-page-native .result-box {
  margin-top: 18px;
}

.create-page-native .result-box input {
  margin-bottom: 10px;
}
