:root {
  color-scheme: dark;
  --ui-bg: #05070c;
  --ui-panel: rgba(7, 12, 20, 0.82);
  --ui-cyan: #7efcff;
  --ui-cyan-soft: rgba(126, 252, 255, 0.28);
  --ui-lime: #b7ff1a;
  --ui-lime-soft: rgba(183, 255, 26, 0.22);
  --ui-magenta: #ff4ee8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ui-bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(115deg, rgba(126, 252, 255, 0.1), transparent 34% 66%, rgba(183, 255, 26, 0.075)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 38px),
    linear-gradient(180deg, #111827 0%, #070a12 56%, #030407 100%);
}

.game-page {
  position: relative;
  display: grid;
  place-items: center;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.game-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(126, 252, 255, 0.055), transparent),
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 255, 255, 0.018) 7px 8px);
  mix-blend-mode: screen;
  opacity: 0.44;
}

.game-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.game-stage {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(280px, 1fr);
  align-items: center;
  gap: 12px;
  width: min(1012px, calc(100vw - 48px));
}

.dev-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 42px;
  padding: 6px;
  border: 1px solid var(--ui-cyan-soft);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(126, 252, 255, 0.08), transparent 34% 68%, rgba(183, 255, 26, 0.065)),
    var(--ui-panel);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(44, 240, 255, 0.08),
    inset 0 0 20px rgba(44, 240, 255, 0.055);
}

.dev-rail::before {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 6px;
}

.dev-rail__button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(126, 252, 255, 0.26);
  border-radius: 6px;
  color: rgba(231, 251, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.018)),
    rgba(3, 7, 13, 0.82);
  box-shadow: inset 0 0 10px rgba(44, 240, 255, 0.035);
  cursor: pointer;
  outline: none;
  transition: border-color 120ms linear, color 120ms linear, background 120ms linear, box-shadow 120ms linear;
}

.dev-rail__button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.dev-rail__button:hover,
.dev-rail__button:focus-visible {
  border-color: rgba(126, 252, 255, 0.58);
  color: var(--ui-cyan);
  background: rgba(44, 240, 255, 0.1);
  box-shadow:
    0 0 14px rgba(44, 240, 255, 0.16),
    inset 0 0 10px rgba(44, 240, 255, 0.08);
}

.dev-rail__button.is-active {
  border-color: rgba(183, 255, 26, 0.58);
  color: var(--ui-lime);
  background: rgba(183, 255, 26, 0.12);
  box-shadow:
    0 0 16px rgba(183, 255, 26, 0.16),
    inset 0 0 12px rgba(183, 255, 26, 0.1);
}

.game-screen {
  position: relative;
  width: min(960px, 100%, calc((100vh - 48px) * 4 / 3));
  aspect-ratio: 4 / 3;
  min-width: 280px;
  overflow: hidden;
  border: 1px solid rgba(126, 252, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(126, 252, 255, 0.08), transparent 32%),
    #050815;
  box-shadow:
    0 30px 72px rgba(0, 0, 0, 0.54),
    0 0 54px rgba(44, 240, 255, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.045),
    inset 0 0 42px rgba(44, 240, 255, 0.08),
    inset 0 0 64px rgba(183, 255, 26, 0.035);
}

.game-screen::before,
.game-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.game-screen::before {
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    inset 0 0 30px rgba(126, 252, 255, 0.12);
}

.game-screen::after {
  background:
    linear-gradient(90deg, rgba(126, 252, 255, 0.13), transparent 13% 86%, rgba(183, 255, 26, 0.11)),
    repeating-linear-gradient(180deg, transparent 0 5px, rgba(255, 255, 255, 0.018) 5px 6px);
  mix-blend-mode: screen;
  opacity: 0.58;
}

.thunder-shooter-effect-2 {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: none;
  align-self: auto;
}

.thunder-shooter-resize-handle,
.thunder-rail-resize-handle {
  display: none !important;
}

.console-page {
  min-height: 100vh;
  padding: 14px;
  overflow: auto;
}

.console-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.weapon-console {
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(126, 252, 255, 0.22);
  border-radius: 8px;
  color: #e7fbff;
  background: rgba(9, 13, 22, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34), inset 0 0 24px rgba(44, 240, 255, 0.035);
}

.weapon-console__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(126, 252, 255, 0.14);
}

.weapon-console__head h1 {
  margin: 0;
  color: #b7ff1a;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.weapon-console__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weapon-console__actions a,
.weapon-console__actions button {
  display: inline-grid;
  place-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(183, 255, 26, 0.38);
  border-radius: 6px;
  color: #b7ff1a;
  background: rgba(183, 255, 26, 0.08);
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.weapon-console__actions #weaponSave {
  border-color: rgba(126, 252, 255, 0.58);
  color: #7efcff;
  background: rgba(44, 240, 255, 0.1);
}

.weapon-console__actions button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.weapon-console__sync,
.weapon-save-status {
  padding: 5px 9px;
  border-bottom: 1px solid rgba(126, 252, 255, 0.1);
  color: rgba(231, 251, 255, 0.74);
  font-size: 11px;
  line-height: 1.25;
}

.weapon-save-status[data-tone="ok"] {
  color: #b7ff1a;
}

.weapon-save-status[data-tone="error"] {
  color: #ff9a88;
}

.weapon-table-wrap {
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.weapon-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  line-height: 1.15;
}

.weapon-table th,
.weapon-table td {
  height: 30px;
  padding: 2px 4px;
  border-bottom: 1px solid rgba(126, 252, 255, 0.08);
  vertical-align: middle;
}

.weapon-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #7efcff;
  background: rgba(8, 12, 20, 0.98);
  font-weight: 700;
  text-align: left;
}

.weapon-table th:nth-child(1),
.weapon-table td:nth-child(1) {
  width: 42px;
  color: rgba(231, 251, 255, 0.7);
  text-align: center;
}

.weapon-table th:nth-child(2),
.weapon-table td:nth-child(2) {
  width: 124px;
}

.weapon-table th:nth-child(3),
.weapon-table td:nth-child(3),
.weapon-table th:nth-child(4),
.weapon-table td:nth-child(4),
.weapon-table th:nth-child(5),
.weapon-table td:nth-child(5),
.weapon-table th:nth-child(6),
.weapon-table td:nth-child(6),
.weapon-table th:nth-child(7),
.weapon-table td:nth-child(7),
.weapon-table th:nth-child(8),
.weapon-table td:nth-child(8),
.weapon-table th:nth-child(9),
.weapon-table td:nth-child(9),
.weapon-table th:nth-child(10),
.weapon-table td:nth-child(10) {
  width: 70px;
}

.weapon-table th:nth-child(7),
.weapon-table td:nth-child(7) {
  width: 240px;
}

.weapon-table input {
  width: 100%;
  height: 22px;
  min-width: 0;
  border: 1px solid rgba(126, 252, 255, 0.18);
  border-radius: 4px;
  color: #e7fbff;
  background: rgba(0, 0, 0, 0.28);
  font: inherit;
  font-size: 11px;
  outline: none;
}

.weapon-table input:focus {
  border-color: rgba(183, 255, 26, 0.65);
}

.weapon-table input[data-field="traits"] {
  font-family: Consolas, "SFMono-Regular", ui-monospace, monospace;
  font-size: 10px;
}

.weapon-table input.is-invalid {
  border-color: #ff705a;
  color: #ffb6aa;
}

.formula-cell,
.traits-cell {
  overflow: hidden;
  color: rgba(231, 251, 255, 0.84);
  font-family: Consolas, "SFMono-Regular", ui-monospace, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.confirm-modal.hidden {
  display: none;
}

.confirm-modal__panel {
  width: min(760px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(126, 252, 255, 0.32);
  border-radius: 8px;
  background: #090d16;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.54), inset 0 0 24px rgba(44, 240, 255, 0.05);
}

.confirm-modal__head {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(126, 252, 255, 0.14);
}

.confirm-modal__head h2 {
  margin: 0;
  color: #b7ff1a;
  font-size: 15px;
  line-height: 1.2;
}

.confirm-modal__list {
  max-height: 500px;
  overflow: auto;
  padding: 8px 12px;
}

.confirm-modal__item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(126, 252, 255, 0.08);
  color: #e7fbff;
  font: 12px/1.35 Consolas, "SFMono-Regular", ui-monospace, monospace;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(126, 252, 255, 0.14);
}

.confirm-modal__actions button {
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(126, 252, 255, 0.32);
  border-radius: 6px;
  color: #e7fbff;
  background: rgba(126, 252, 255, 0.08);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.confirm-modal__actions #changeConfirm {
  border-color: rgba(183, 255, 26, 0.55);
  color: #b7ff1a;
  background: rgba(183, 255, 26, 0.1);
}

.weapon-icon {
  width: 24px;
  height: 24px;
  margin-right: 6px;
  vertical-align: middle;
  image-rendering: pixelated;
}

.weapon-name {
  display: inline-block;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 720px) {
  .game-page {
    padding: 12px;
  }

  .game-stage {
    width: min(100%, calc(100vw - 24px));
  }

  .game-screen {
    width: min(100%, calc((100vh - 24px) * 4 / 3));
  }

  .console-page {
    padding: 10px;
  }

  .weapon-table {
    min-width: 1260px;
  }
}

@media (max-width: 420px) {
  .game-stage {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dev-rail {
    flex-direction: row;
    justify-self: center;
    width: auto;
  }
}
