/* =========================================================
   C++ MOD STUDIO (companion tool for the C++ series)
   ========================================================= */
:root {
  --cms-blue: #00599c;
  --cms-blue-dk: #004482;
  --cms-blue-lt: rgba(0, 89, 156, .12);
  --cms-red: #e04a3f;
}

.cms-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.cms-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px;
  background: var(--beige);
  border: 1.5px solid var(--border);
  border-radius: 14px;
}
.cms-tab {
  flex: 1 1 auto;
  min-width: 130px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  font-size: .86rem;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.cms-tab:hover {
  background: var(--card);
}
.cms-tab.is-active {
  background: var(--cms-blue-dk);
  color: #fff;
  border-color: var(--cms-blue-dk);
}

.cms-panel {
  display: none;
}
.cms-panel.is-active {
  display: block;
}

.cms-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 820px) {
  .cms-grid-2 {
    grid-template-columns: 1fr;
  }
}

.cms-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.cms-card h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.cms-label {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 12px 0 4px;
}
.cms-input,
.cms-select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
}
.cms-input:focus,
.cms-select:focus {
  outline: 2px solid var(--cms-blue);
  border-color: var(--cms-blue);
}

.cms-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.cms-btn {
  font: inherit;
  font-weight: 800;
  font-size: .88rem;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.cms-btn:hover {
  border-color: var(--cms-blue);
}
.cms-btn--primary {
  background: var(--cms-blue-dk);
  border-color: var(--cms-blue-dk);
  color: #fff;
}
.cms-btn--primary:hover {
  background: var(--cms-blue);
  border-color: var(--cms-blue);
}
.cms-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.cms-msg {
  font-size: .84rem;
  font-weight: 700;
  color: var(--muted);
  min-height: 1.2em;
  margin: 10px 0 0;
}
.cms-msg.ok {
  color: var(--cms-blue-dk);
}
.cms-msg.bad {
  color: var(--cms-red);
}

.cms-board {
  display: grid;
  gap: 5px;
  padding: 8px;
  background: var(--beige);
  border: 2px solid var(--border);
  border-radius: 10px;
}
.cms-cell {
  aspect-ratio: 1 / 1;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .1s ease, transform .1s ease;
}
.cms-cell:hover {
  border-color: var(--cms-blue);
}
.cms-cell.is-filled {
  transform: scale(1.04);
  background: var(--cms-blue-lt);
}

.cms-mini {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}
.cms-mini-cell {
  aspect-ratio: 1 / 1;
  background: var(--beige);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
}

.cms-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.cms-swatch {
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cms-swatch:hover {
  border-color: var(--cms-blue);
}
.cms-swatch.is-active {
  box-shadow: 0 0 0 2px var(--cms-blue-lt);
}

.cms-pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: .76rem;
  line-height: 1.55;
  background: #0e1c2b;
  color: #cfe3f5;
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  max-height: 360px;
  white-space: pre;
  margin: 0;
}
.cms-console {
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  line-height: 1.6;
  background: #0b1620;
  color: #cfe3f5;
  border-radius: 10px;
  padding: 14px;
  min-height: 180px;
}
.cms-console .line {
  display: block;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: default;
}
.cms-console .err {
  background: rgba(224, 74, 63, .22);
  color: #ffb4ab;
  cursor: pointer;
}
.cms-console .err:hover {
  background: rgba(224, 74, 63, .38);
}

.cms-dbg-opt {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: .86rem;
  padding: 10px 12px;
  margin: 8px 0;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.cms-dbg-opt:hover {
  border-color: var(--cms-blue);
}
.cms-dbg-opt.is-correct {
  border-color: var(--cms-blue-dk);
  background: var(--cms-blue-lt);
}
.cms-dbg-opt.is-wrong {
  border-color: var(--cms-red);
  background: rgba(224, 74, 63, .1);
}

.cms-checklist {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.cms-checklist li {
  font-size: .84rem;
  padding: 6px 0 6px 26px;
  position: relative;
  color: var(--muted);
}
.cms-checklist li::before {
  content: '□';
  position: absolute;
  left: 0;
  color: var(--cms-blue-dk);
  font-weight: 800;
}
.cms-checklist li.done {
  color: var(--text);
}
.cms-checklist li.done::before {
  content: '☑';
}

.cms-tour {
  position: fixed;
  inset: 0;
  background: rgba(14, 28, 43, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.cms-tour[hidden] {
  display: none;
}
.cms-tour-box {
  max-width: 420px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.cms-tour-box h3 {
  font-family: 'Fredoka', sans-serif;
  margin: 0 0 8px;
  color: var(--cms-blue-dk);
}
.cms-tour-box p {
  font-size: .9rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.cms-tour-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.cms-tour-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.cms-tour-dots span.on {
  background: var(--cms-blue-dk);
}

/* Visual polish (matches the Defold Mod Studio) */
.cms-tab:hover { color: var(--cms-blue-dk); }
.cms-tab.is-active {
  background: linear-gradient(135deg, var(--cms-blue), var(--cms-blue-dk));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 89, 156, .38);
}
.cms-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
  border-top: 3px solid var(--cms-blue);
}
.cms-cell { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.cms-cell:hover { transform: translateY(-2px); }
.cms-cell.is-filled { transform: none; background: var(--cms-blue-lt); }
.cms-mini {
  gap: 4px;
  padding: 8px;
  background: var(--beige);
  border: 2px solid var(--border);
  border-radius: 10px;
}
.cms-mini-cell { background: var(--card); border-radius: 6px; }
.cms-btn {
  border-color: var(--cms-blue);
  background: var(--cms-blue-lt);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.cms-btn:hover { background: rgba(0, 89, 156, .2); transform: translateY(-1px); }
.cms-swatch {
  width: 68px;
  height: auto;
  min-height: 68px;
  padding: 8px 4px;
  flex-direction: column;
  gap: 4px;
  transition: transform .1s ease, border-color .1s ease, background .1s ease;
}
.cms-swatch:hover { transform: translateY(-2px); }
.cms-swatch-emoji { font-size: 1.5rem; line-height: 1; }
.cms-swatch-name { font-size: .62rem; font-weight: 800; letter-spacing: .02em; color: var(--muted); }
.cms-swatch.is-active { border-color: var(--cms-blue); background: var(--cms-blue-lt); box-shadow: 0 0 0 3px var(--cms-blue-lt); }
.cms-swatch.is-active .cms-swatch-name { color: #5b9bd5; }

@media (max-width: 480px) {
  .cms-swatch {
    width: 58px;
    min-height: 58px;
  }
  .cms-swatch-emoji {
    font-size: 1.3rem;
  }
  .cms-cell {
    font-size: 1.05rem;
  }
}

/* A1457: tabs inside the light beige tab bar keep dark text; hover always uses the dark card so text goes light. */
.cms-tabs .cms-tab:not(.is-active){color:#403B33;}
.cms-tab:hover,.cms-tab:focus-visible{color:var(--text);}
