:root {
  --bg: #0f1114;
  --sidebar: #12151a;
  --panel: #171a1f;
  --panel-2: #101318;
  --field: #0d1014;
  --line: #2b3139;
  --line-strong: #3a424d;
  --text: #f5f7fa;
  --muted: #8f98a6;
  --accent: #ecb731;
  --accent-hover: #f3c34f;
  --danger: #ff7373;
  --ok: #80d49a;
  --warn: #f2c467;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: MontserratMedium, Arial, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, input, select { -webkit-tap-highlight-color: transparent; }
.workspace {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  align-items: start;
}
.editor {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 14px 14px 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #343b44 transparent;
  z-index: 6;
}
.editor::-webkit-scrollbar { width: 8px; }
.editor::-webkit-scrollbar-track { background: transparent; }
.editor::-webkit-scrollbar-thumb {
  background: #343b44;
  border: 2px solid var(--sidebar);
  border-radius: 999px;
}
.editor::-webkit-scrollbar-thumb:hover { background: #48515d; }
.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.eyebrow {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: .15em;
  margin-bottom: 6px;
}
h1 { font-size: 19px; line-height: 1.25; margin: 0; }
.version {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 9px;
  white-space: nowrap;
}
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 9px;
  padding: 12px;
  margin-bottom: 8px;
}
.panel-title { font-size: 12px; font-weight: 700; }
.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}
.field { display: grid; gap: 6px; min-width: 0; }
.field-span-2 { grid-column: span 2; }
.field > span { color: var(--muted); font-size: 9px; }
input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  color: var(--text);
  background-color: var(--field);
  border: 1px solid #303741;
  border-radius: 7px;
  padding: 7px 9px;
  outline: 0;
}
input[readonly] { color: #d8dde4; background: #11151a; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238f98a6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid #6b7686;
  outline-offset: 2px;
}
.toggles { display: grid; gap: 7px; margin-top: 11px; }
.toggle, .gold-toggle {
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 9px;
  line-height: 1.4;
  cursor: pointer;
}
.toggle input, .gold-toggle input { accent-color: var(--accent); }
.hint {
  color: var(--muted);
  margin: 0 0 10px;
  font-size: 9px;
  line-height: 1.5;
}
.editor-symbol-hint { margin-bottom: 8px; }
.layout-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 7px;
}
.layout-summary-item {
  min-width: 0;
  border: 1px solid #303741;
  background: #1b2026;
  border-radius: 7px;
  padding: 8px 9px;
  display: grid;
  gap: 3px;
}
.layout-summary-item span { color: var(--muted); font-size: 8px; line-height: 1.25; }
.layout-summary-item strong { color: #e4e8ed; font-size: 9px; line-height: 1.35; font-weight: 600; }
.layout-clarification {
  margin: 0 0 10px;
  padding-left: 8px;
  border-left: 2px solid #3c4652;
  color: #8f99a5;
  font-size: 8px;
  line-height: 1.45;
}
.mini-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  min-height: 34px;
  border: 1px solid #363e48;
  background: #20252c;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 9px;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}
.btn:hover { background: #282e36; border-color: #46505c; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #17120a; border-color: #e9b735; font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: #171b20; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.symbol-palette {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.symbol-choice {
  position: relative;
  height: 52px;
  border: 1px solid #303741;
  border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
}
.symbol-choice:hover { border-color: #566170; }
.symbol-choice.active { border: 2px solid var(--accent); }
.sprite-holder {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.sprite-icon { position: absolute; background-image: url('../images/2db4a6f.png'); background-repeat: no-repeat; }
.symbol-choice small {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 7px;
  color: #aab3bf;
  background: #0b0e12;
  border: 1px solid #252b33;
  border-radius: 3px;
  padding: 1px 3px;
}
.gold-toggle { margin: 9px 0; }
.reel-editor {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: var(--field);
  border: 1px solid #292f37;
  border-radius: 8px;
  min-height: 250px;
  overflow-x: auto;
}
.reel-col { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.reel-col.edge { padding-top: 27px; }
.reel-cell {
  width: 47px;
  height: 54px;
  border: 1px solid #303741;
  border-radius: 5px;
  background: #171b20;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  position: relative;
}
.reel-cell:hover { border-color: #667282; }
.reel-cell.golden::after {
  content: "G";
  position: absolute;
  right: 2px;
  top: 2px;
  font-size: 7px;
  line-height: 1;
  background: #f0bd35;
  color: #1c1404;
  border-radius: 2px;
  padding: 2px;
}
.reel-cell.winning { box-shadow: inset 0 0 0 1px #d59d27, 0 0 0 1px rgba(236,183,49,.16); }
.selected-line { color: var(--muted); font-size: 9px; margin-top: 7px; }
.selected-line span { color: #fff; }
.rule-summary { display: grid; gap: 7px; }
.rule-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #292f37;
  padding-bottom: 6px;
  font-size: 9px;
  line-height: 1.45;
}
.rule-row:last-child { border-bottom: 0; padding-bottom: 0; }
.rule-row span:first-child { color: var(--muted); }
.rule-row strong { text-align: right; overflow-wrap: anywhere; }
.rule-ok { color: var(--ok); }
.rule-warn { color: var(--warn); }
.rule-bad { color: var(--danger); }
.rule-note { margin-top: 9px; color: #7f8895; font-size: 8px; line-height: 1.5; }
.paytable-panel details { font-size: 9px; }
.paytable-panel details + details { margin-top: 10px; }
.paytable-panel summary { cursor: pointer; color: #cfd5dd; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.paytable { width: 100%; border-collapse: collapse; font-size: 8px; }
.paytable th, .paytable td { border: 1px solid #303741; padding: 5px; text-align: right; }
.paytable th:first-child, .paytable td:first-child { text-align: left; }
.paytable th { color: #adb7c4; background: #11151a; }
.rules-copy { color: #9aa4b1; font-size: 8px; line-height: 1.55; }
.rules-copy p { margin: 8px 0 0; }
.rules-copy b { color: #dce1e8; }
.smart-panel { border-color: #4d4227; background: #191914; }
.subtle { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.smart-options {
  margin-top: 10px;
  padding: 8px 9px;
  border: 1px solid #2e343d;
  border-radius: 8px;
  background: #111419;
}
.smart-bet-hint { margin-top: 5px; color: #747e8c; font-size: 7.5px; line-height: 1.45; }
.sequence-nav {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #2e343d;
  border-radius: 8px;
  background: #101318;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.sequence-nav span { text-align: center; color: var(--muted); font-size: 8px; }
.sequence-nav.active span { color: var(--text); }
.actions-sticky {
  position: sticky;
  bottom: 0;
  margin: 8px -14px 0;
  padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(18,21,26,.96), var(--sidebar) 18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 22px rgba(0,0,0,.16);
  z-index: 8;
}
.btn-download { width: 100%; min-height: 48px; display: grid; gap: 3px; line-height: 1.15; }
.btn-download span { font-size: 10px; }
.btn-download small { font-size: 8px; font-weight: 500; opacity: .72; }
.preview-area {
  min-width: 0;
  min-height: 100vh;
  padding: 14px 16px 22px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.preview-toolbar {
  width: min(100%, 720px);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid #282f37;
  border-radius: 9px;
  background: #12161a;
}

.preview-toolbar > div:first-child { display: grid; gap: 3px; }
.preview-toolbar strong { font-size: 12px; }
.preview-toolbar span { color: var(--muted); font-size: 8px; line-height: 1.4; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.preview-state {
  border: 1px solid #2f3740;
  background: #0f1317;
  border-radius: 999px;
  padding: 7px 9px;
  white-space: nowrap;
}
.canvas-stage-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  border: 1px solid #282f37;
  border-radius: 10px;
  background: #090b0e;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10px;
}
.canvas-stage {
  width: min(518px, 100%);
  min-height: 0;
  height: auto;
  background: #1d2022;
  padding: 0;
  overflow: visible;
  contain: layout paint;
}

.canvas-document {
  position: relative;
  width: 518px;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
  display: grid;
  align-items: start;
}
.sticky-header-layer {
  display: none;
}
#stickyHeaderCanvas,
#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
}
#previewCanvas {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  background: #202426;
  box-shadow: 0 12px 42px rgba(0,0,0,.28);
}
.canvas-stage.native {
  width: 518px;
  max-width: none;
}
.canvas-stage.native .canvas-document {
  width: 518px;
  max-width: none;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  background: #e8edf2;
  color: #101317;
  border: 1px solid #cbd2da;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 9px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .12s linear, transform .12s linear;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .editor {
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
    scrollbar-gutter: auto;
  }
  .preview-area { min-height: 70vh; }
  .actions-sticky {
    position: static;
    margin: 8px 0 0;
    padding: 9px 0 0;
    border-top: 0;
    box-shadow: none;
    background: transparent;
  }
}
@media (max-width: 520px) {
  .editor, .preview-area { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .panel-head-row { align-items: flex-start; }
  .symbol-palette { grid-template-columns: repeat(4, 1fr); }
  .reel-editor { justify-content: flex-start; }
  .reel-cell { width: 42px; height: 49px; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preview-actions { width: 100%; justify-content: space-between; }
  .layout-summary { grid-template-columns: 1fr; }
}
