:root {
  --bg: #0f0f0f;
  --panel: #151515;
  --border: #2a2a2a;
  --text: #ffffff;
  --muted: #bbbbbb;
  --accent: #00b36b;
}

* { box-sizing: border-box; }

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 20px;
  margin: 0;
}

h1 { margin: 0 0 14px; }
h2 { margin: 16px 0 8px; font-size: 16px; }

.grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: #1c1c1c;
  border: 1px solid #333;
  color: #fff;
  border-radius: 6px;
}

textarea {
  width: 100%;
  height: 550px;
  padding: 12px;
  margin-top: 8px;
  background: #0c0c0c;
  border: 1px solid #333;
  color: #fff;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.35;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  background: var(--accent);
  color: #000;
}

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

.box {
  background: #0c0c0c;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  min-height: 110px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

code {
  background: #101010;
  border: 1px solid #2a2a2a;
  padding: 1px 6px;
  border-radius: 6px;
}

.sim-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch; /* 👈 IMPORTANT */
}

.chart-panel,
.log-panel {
  display: flex;
  flex-direction: column;
}

/* ───── Run Mode UI ───── */

.run-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* ← key */
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #111;
  cursor: pointer;
  transition: border 0.2s, background 0.2s;
}

.radio-row:hover {
  border-color: var(--accent);
}

.radio-row input[type="radio"] {
  margin: 0;
}

.radio-row span {
  order: -1;              /* ← moves text to LEFT */
  font-size: 13px;
  color: #fff;
}

.run-box {
  margin-top: 12px;
}

/*New Maxrolls and Stop on Positive Alignment*/
.field-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.field-main {
  flex: 3; /* ~75% */
}

.field-side {
  flex: 1; /* ~25% */
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px; /* aligns with input */
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.field-side input {
  margin: 0;
}

/*Lua Script and Output split*/
.lua-output-grid {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 66% / 33% */
  gap: 16px;
  align-items: stretch;
}

.lua-pane,
.output-pane {
  display: flex;
  flex-direction: column;
}

.output-pane .box {
  flex: 1;
  min-height: 320px;
}

/**SUPER UPGRADE**//

/* ───── Header Row ───── */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.sim-mode-buttons {
  display: flex;
  gap: 8px;
}

.sim-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: bold;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #bbb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-btn:hover {
  border-color: var(--accent);
  color: #fff;
}

.sim-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ───── Real Simulator Session Bar ───── */
.session-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  font-size: 13px;
}

.session-bar span {
  white-space: nowrap;
}

.session-bar strong {
  color: var(--accent);
}

.session-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  border: 1px solid #2a2a2a;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

.session-btn:hover {
  border-color: var(--accent);
}

.session-btn.danger {
  color: #ff4d4d;
  border-color: #3a1a1a;
}

/* ───── Modal Overlay ───── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* ───── Modal Box ───── */
.modal-content {
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 14px;
}

.modal-content input {
  width: 100%;
}

/* ───── Modal Actions ───── */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
}

/* ───── Utility ───── */
.hidden {
  display: none !important;
}

/**RESET BUTTONS**//
.session-actions {
  display: flex;
  gap: 10px;
}

.session-actions button {
  padding: 8px 12px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
}

/* ───── FIXED STATUS BOX HEIGHT ───── */
#summary.box {
  min-height: 450px;
  max-height: 450px;
  overflow-y: auto;
}

#resumeBtn {
  background: #f1c40f;
  color: #000;
}

#resumeBtn:disabled {
  opacity: 0.5;
}

#realControlsStack {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.realResetRow,
.realWalletRow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

/* ───── Unified Speed Row ───── */

.speed-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 12px;
}

/* Max Graph */
.max-graph-wrap {
  display: flex;
  flex-direction: column;
  width: 140px; /* fits 10000000 */
}

.max-graph-wrap input {
  width: 100%;
}

/* Slider */
.slider-wrap {
  flex: 0 0 420px;
  display: flex;
  flex-direction: column;
}

.slider-wrap input[type="range"] {
  width: 100%;
}

/* Fastest */
.fastest-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#luaCode {
  height: 450px;   /* change this number */
}