/* Gameficate Theme Configurator */
/* ---------- Tokens and reset ---------- */
:root {
  --navy: #17324d;
  --navy-2: #214667;
  --ink: #1f2a37;
  --muted: #5b6b7c;
  --line: #dce6ef;
  --soft: #f4f8fb;
  --bg: #eef4f9;
  --orange: #ff7a3d;
  --orange-d: #e35f1e;
  --teal: #13a89e;
  --font: 'Nunito', system-ui, sans-serif;
  --display: 'Baloo 2', 'Nunito', sans-serif;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid #ffc83d;
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */
.top {
  height: 68px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  z-index: 2;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo .badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffb057, var(--orange) 55%, var(--orange-d));
}
.logo .badge.brand svg {
  width: 100%;
  height: 100%;
}
.logo .word {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.logo .word span {
  color: #ffc83d;
}
.logo .word small {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  opacity: 0.75;
  margin-left: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.95;
}
.name input {
  width: 200px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0 10px;
  font-weight: 800;
}
.spacer {
  flex: 1;
}
.tb {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  white-space: nowrap;
}
.tb:hover {
  background: rgba(255, 255, 255, 0.24);
}
.tb.primary {
  background: var(--orange);
  border-color: var(--orange);
}

/* ---------- Settings column and cards ---------- */
.wrap {
  flex: 1;
  display: flex;
  min-height: 0;
}
.controls {
  width: 440px;
  flex: 0 0 auto;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border-right: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card h3 {
  font-family: var(--display);
  font-size: 18px;
  color: var(--navy);
}
.help,
.small {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.45;
}
/* ---------- Presets and colours ---------- */
.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.preset {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--soft);
  font-weight: 800;
  font-size: 14px;
  color: var(--navy);
  text-align: left;
}
.preset:hover {
  border-color: var(--orange);
}
.preset .sw {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}
.preset .sw i {
  width: 10px;
  height: 22px;
}
.colors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.color-row {
  display: grid;
  grid-template-columns: 40px 1fr 92px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
.color-row input[type='color'] {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.hex,
.field input[type='text'],
select,
textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
}
.hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.4;
}
/* ---------- Fields, logo, buttons, switches ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}
.field input[type='range'] {
  width: 100%;
  accent-color: var(--orange);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.logo-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.logo-prev {
  width: 130px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 2px dashed var(--line);
  background: repeating-conic-gradient(#f1f4f7 0 25%, #fff 0 50%) 0 0 / 16px 16px;
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.logo-prev img {
  max-width: 100%;
  max-height: 70px;
}
.logo-ctl {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  background: var(--soft);
  border: 2px solid var(--line);
  color: var(--navy);
}
.btn.sm {
  height: 32px;
  font-size: 13px;
}
.btn:hover {
  border-color: #bfd0e0;
}
.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}
.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: var(--soft);
  border: 2px solid var(--line);
}
.seg button {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  font-weight: 900;
  font-size: 13.5px;
  color: var(--navy);
}
.seg button[aria-checked='true'] {
  background: var(--navy);
  color: #fff;
}

/* ---------- Preview frame and XML view ---------- */
.preview {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}
.pbar select {
  width: auto;
  min-width: 180px;
}
.frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #0e2236;
  box-shadow: 0 10px 30px rgba(23, 50, 77, 0.15);
}
.frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.xml {
  background: #0f2539;
  color: #d7e6f5;
  border-radius: 14px;
  padding: 14px 16px;
  font:
    12.5px/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  white-space: pre;
  overflow: auto;
  max-height: 420px;
}
.note {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.5;
  max-width: 1100px;
}
.note code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 5px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 800;
  opacity: 0;
  transition: 0.2s;
  pointer-events: none;
  z-index: 10;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1250px) {
  .top .tb {
    font-size: 0;
    padding: 0 10px;
  }
  .top .tb::first-letter {
    font-size: 16px;
  }
  .name input {
    width: 140px;
  }
  .controls {
    width: 380px;
  }
}

/* 🎵 Music & sound effects */
.card h4 {
  margin: 14px 0 6px;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted, #5b6b7c);
}
.file-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.file-field .row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.file-field input[type='text'] {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}
.sfx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sfx-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sfx-row .file-field {
  grid-column: 2;
}
.sfx-row .play {
  width: 38px;
  padding: 0;
}
.sfx-row .sfx-name {
  font-size: 14px;
  font-weight: 700;
}

/* 🧭 Game logo preview */
.game-logo-prev {
  margin: 10px 0;
  min-height: 76px;
  padding: 10px;
  border-radius: 12px;
  border: 2px dashed var(--line);
  display: grid;
  place-items: center;
  background: repeating-conic-gradient(#f1f4f7 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}
.game-logo-prev img {
  max-height: 70px;
  max-width: 100%;
  object-fit: contain;
}
.game-logo-prev .gl-word {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 900;
  color: var(--navy);
}
.game-logo-prev .gl-word em {
  font-style: normal;
  color: #ff7a3d;
}
.game-logo-prev .gl-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, #ffb057, #ff7a3d);
}

/* Opened inside Craft (?embedded=1, js/EmbedBridge.js): Craft's window has the title, so the logo makes room. */
.embedded .top .logo {
  display: none;
}

/* ---------- Layout presets ---------- */
.layouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.layout-opt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--soft);
  color: var(--navy);
  text-align: left;
}
.layout-opt:hover {
  border-color: var(--orange);
}
.layout-opt.on {
  border-color: var(--orange);
  background: #fff4ee;
  box-shadow: 0 0 0 2px rgba(255, 122, 61, 0.2);
}
.lo-sketch {
  width: 100%;
  height: auto;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.lo-sketch .lo-m {
  fill: #bfe3f2;
}
.lo-sketch .lo-p {
  fill: #fff;
  stroke: #9db3c6;
  stroke-width: 0.8;
}
.lo-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
}
.lo-txt b {
  font-size: 14px;
  font-weight: 900;
  color: var(--navy);
}
.lo-tier {
  margin-left: 6px;
  font-size: 12px;
}
.pwhat {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Licence key and premium dialogs (Licence.js, LayoutCard.offer) ---------- */
.lic-bg {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(15, 30, 45, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}
.lic-modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(10, 25, 40, 0.3);
}
.lic-modal h3 {
  margin-bottom: 8px;
  color: var(--navy);
  font-family: var(--display);
}
.lic-modal p {
  color: var(--muted);
  margin-bottom: 12px;
}
.lic-modal textarea {
  width: 100%;
  margin-top: 4px;
  font:
    13px/1.4 ui-monospace,
    Menlo,
    Consolas,
    monospace;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}
.lic-msg {
  min-height: 22px;
  margin: 8px 0;
  font-weight: 700;
}
.lic-msg.ok {
  color: #1b8a4b;
}
.lic-msg.bad {
  color: #c0392b;
}
.lic-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.btn.pri {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn.pri:hover {
  background: var(--orange-d);
}
