/* ========================================================================== */
/*  App chrome (UI shell) — variables for easy theming                        */
/* ========================================================================== */
:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --bg-3: #1b1b1b;
  --line: #3a3a3a;
  --text: #f4f4f2;
  --muted: #9a9a9a;
  --accent: #ffffff;
  --accent-2: #cfcfcf;
  --danger: #d06b66;
  --radius: 4px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand__mark {
  color: var(--accent);
  font-size: 20px;
}
.brand h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.brand h1 span {
  color: var(--muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg-3);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  padding: 9px 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover {
  border-color: var(--text);
  background: var(--bg-2);
}
.btn--primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn--primary:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
}
.btn--primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn--ghost {
  background: transparent;
}
.btn--ghost:hover {
  background: var(--bg-3);
  border-color: var(--text);
}
.btn--sm {
  padding: 6px 10px;
  font-size: 12px;
}
.btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}
.btn--icon svg {
  display: block;
}
.btn--icon #lang-btn-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ========================================================================== */
/*  Layout                                                                    */
/* ========================================================================== */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

.panel {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Filters ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
.field input[type="search"]:focus {
  outline: none;
  border-color: var(--accent-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips--scroll {
  max-height: 168px;
  overflow-y: auto;
  padding: 2px;
}
.dataset-filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dataset-filters[hidden] {
  display: none;
}

/* Dataset switch (Magias / Armas) */
.dataset-switch {
  display: flex;
  width: 100%;
}
.dataset-switch button {
  flex: 1;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.chip input {
  accent-color: var(--accent-2);
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.list-toolbar__btns {
  display: flex;
  gap: 6px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}

.spell-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--bg);
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
}
.spell-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.spell-row:hover {
  background: var(--bg-3);
}
.spell-row input {
  accent-color: var(--accent-2);
}
.spell-row__info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.spell-row__name {
  font-size: 14px;
}
.spell-row__meta {
  font-size: 11px;
  color: var(--muted);
}
.list-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* ========================================================================== */
/*  Workspace: toolbar + preview                                              */
/* ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-end;
  padding: 14px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.control > label,
.control label:not(.check) {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.control select,
.control input[type="number"] {
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 10px;
}
.control select:focus,
.control input:focus {
  outline: none;
  border-color: var(--accent-2);
}
.control--inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
  cursor: pointer;
}
.check input {
  accent-color: var(--accent-2);
}
.check.is-locked,
.control--locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.lock {
  filter: grayscale(1);
}
.num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.num input {
  width: 72px;
}
.num span {
  font-size: 12px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.segmented button {
  font: inherit;
  border: 0;
  background: var(--bg);
  color: var(--muted);
  padding: 8px 14px;
  cursor: pointer;
}
.segmented button.is-active {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.font-preview {
  margin-left: auto;
  min-width: 200px;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.font-preview__title {
  font-size: 20px;
  line-height: 1.1;
  color: var(--text);
}
.font-preview__body {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Preview area ---------- */
.preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: var(--bg);
}
.preview-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}
.preview-pagecount {
  color: var(--muted);
  font-size: 12px;
}

.a4-wrap {
  position: relative;
  box-shadow: var(--shadow);
}
.a4-page {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  background: #ffffff;
  overflow: hidden;
}

/* ========================================================================== */
/*  The card (sized in mm so internals scale with the chosen size)            */
/*  Colors/fonts come from inline custom properties set by js/cards.js.       */
/* ========================================================================== */
.sd-card {
  --s: 1;
  --ts: 1;
  --bs: 1;
  --ds: 1;
  --di: 1;
  --lh: 1.28;
  --pg: 1.1;
  --bm: 0;
  --tmt: 0;
  --tmb: 0;
  --tml: 0;
  --tmr: 0;
  --ta: left;
  --ba: left;
  --just: flex-start;
  position: relative;
  background: var(--c-bg);
  color: var(--c-text);
  overflow: hidden;
  display: block;
}
.sd-card__texture {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}
.sd-card__frame {
  position: absolute;
  inset: calc(var(--bi, 1.6) * 1mm * var(--s));
  pointer-events: none;
  z-index: 1;
}
.sd-card__frame--distressed {
  color: var(--c-outline);
}
.sd-card__frame--distressed svg {
  display: block;
  width: 100%;
  height: 100%;
}
.sd-card__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: calc(2.4mm * var(--s));
  display: flex;
  flex-direction: column;
  gap: calc(1.4mm * var(--s));
  overflow: hidden;
}

.sd-card__title-block {
  flex: 0 0 auto;
  padding-bottom: calc(0.8mm * var(--s));
  text-align: var(--ta);
}
/* Dividers between title / info / body */
.sd-card--dividers .sd-card__title-block.is-top {
  border-bottom: calc(var(--dw, 0.3) * 1mm) solid var(--c-rule);
}
.sd-card--dividers .sd-card__title-block.is-bottom {
  border-top: calc(var(--dw, 0.3) * 1mm) solid var(--c-rule);
  padding-top: calc(0.8mm * var(--s));
  padding-bottom: 0;
}
.sd-card--dividers .sd-card__info.is-top {
  border-bottom: calc(var(--dw, 0.3) * 1mm) solid var(--c-rule);
  padding-bottom: calc(0.8mm * var(--s));
}
.sd-card--dividers .sd-card__info.is-bottom {
  border-top: calc(var(--dw, 0.3) * 1mm) solid var(--c-rule);
  padding-top: calc(0.8mm * var(--s));
}
.sd-card__title {
  font-family: var(--f-title);
  font-weight: 700;
  line-height: 1.05;
  font-size: calc(4.1mm * var(--s) * var(--ts));
  color: var(--c-text);
  padding:
    calc(var(--tmt) * 1mm * var(--s))
    calc(var(--tmr) * 1mm * var(--s))
    calc(var(--tmb) * 1mm * var(--s))
    calc(var(--tml) * 1mm * var(--s));
}
.sd-card__title-alt {
  font-family: var(--f-title);
  font-size: calc(2.8mm * var(--s) * var(--ts));
  color: var(--c-muted);
  line-height: 1.1;
}

.sd-card__info {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: calc(0.8mm * var(--s));
}
.sd-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.8mm * var(--s));
  justify-content: var(--ijust);
}
.sd-card__tag {
  font-family: var(--f-body);
  font-size: calc(2mm * var(--s) * var(--bs));
  line-height: 1;
  padding: calc(0.6mm * var(--s)) calc(1.2mm * var(--s));
  border: 0.25mm solid var(--c-border);
  border-radius: 0.8mm;
  color: var(--c-text);
}
.sd-card__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(0.6mm * var(--s)) calc(2mm * var(--s));
  font-family: var(--f-body);
  font-size: calc(2.1mm * var(--s) * var(--bs));
  color: var(--c-muted);
  justify-content: var(--ijust);
}
.sd-card__stat {
  display: inline-flex;
  align-items: center;
  gap: calc(0.6mm * var(--s));
}
.sd-card__stat-label {
  color: var(--c-muted);
}
.sd-card__stat-text {
  color: var(--c-text);
}

/* Range bars */
.sd-card__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: calc(0.45mm * var(--s));
  height: calc(2.6mm * var(--s));
}
.sd-card__bar {
  width: calc(0.9mm * var(--s));
  background: var(--c-border);
  border: 0.18mm solid var(--c-border);
  border-radius: 0.3mm;
}
.sd-card__bar:nth-child(1) { height: 42%; }
.sd-card__bar:nth-child(2) { height: 70%; }
.sd-card__bar:nth-child(3) { height: 100%; }
.sd-card__bar.is-on {
  background: var(--c-accent);
  border-color: var(--c-accent);
}

/* Clock icon */
.sd-card__icon {
  display: inline-flex;
  align-items: center;
  color: var(--c-accent);
  font-size: calc(2.6mm * var(--s) * var(--bs));
}
.sd-card__icon--coin {
  color: #d4af37;
  margin-right: calc(0.6mm * var(--s));
}
.sd-card__stat--cost {
  display: inline-flex;
  align-items: center;
}

.sd-card__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: var(--bvp);
  font-family: var(--f-body);
  font-size: calc(2.45mm * var(--s) * var(--bs));
  line-height: var(--lh);
  color: var(--c-text);
  text-align: var(--ba);
  padding: 0 calc(var(--bm) * 1mm * var(--s));
  overflow: hidden;
}

/* ---- Weapon-specific bits ---- */
.sd-card__damage {
  display: flex;
  align-items: baseline;
  justify-content: var(--djust, flex-start);
  gap: calc(1.4mm * var(--s));
  margin: calc(0.8mm * var(--s)) 0;
}
.sd-card__dice {
  display: inline-flex;
  align-items: center;
  gap: calc(0.6mm * var(--s));
}
.sd-card__dice-img {
  height: calc(5mm * var(--s) * var(--di));
  width: auto;
  display: block;
  filter: var(--dice-filter, none);
}
.sd-card__damage--center {
  position: absolute;
  top: 50%;
  left: calc(2.4mm * var(--s));
  right: calc(2.4mm * var(--s));
  transform: translateY(-50%);
  margin: 0;
  z-index: 3;
  pointer-events: none;
}
.sd-card__damage-label {
  font-family: var(--f-body);
  font-size: calc(2mm * var(--s));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}
.sd-card__damage-value {
  font-family: var(--f-title);
  font-weight: 700;
  font-size: calc(5.4mm * var(--s) * var(--ds));
  line-height: 1;
  color: var(--c-text);
}
.sd-card__tag--cat {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.sd-card__props-label {
  margin-top: calc(0.8mm * var(--s));
  margin-bottom: calc(0.6mm * var(--s));
  font-weight: 600;
}
.sd-card__p {
  margin: 0 0 calc(var(--pg) * 1mm * var(--s));
}
.sd-card__p:last-child {
  margin-bottom: 0;
}
.sd-card__divider {
  border: 0;
  border-top: 0.3mm dashed var(--c-rule);
  margin: calc(1.2mm * var(--s)) 0;
}
.sd-card__body-alt {
  color: var(--c-muted);
  font-style: italic;
}

/* ========================================================================== */
/*  Overflow warnings (preview)                                               */
/* ========================================================================== */
.overflow-banner {
  position: sticky;
  top: 0;
  z-index: 5;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--accent-2);
  border-radius: 8px;
  background: rgba(201, 85, 79, 0.12);
  color: var(--text);
  font-size: 13px;
}
.overflow-banner strong {
  color: var(--accent);
}
.overflow-banner .btn {
  margin-left: 4px;
}
.overflow-banner__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.card-slot {
  position: relative;
}
.card-slot.is-overflow .sd-card {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}
.card-slot__warn {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 6;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: help;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.card-slot.is-overflow .card-slot__warn {
  display: flex;
}

/* ========================================================================== */
/*  Customize modal                                                           */
/* ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.modal[hidden] {
  display: none;
}

/* Startup language picker */
.lang-modal__dialog {
  width: min(320px, 100%); max-width: 10%;
  display: block;
  padding: 20px 20px 22px;
  text-align: center;
}
.lang-modal__title {
  margin: 0 0 14px;
  font-size: 15px;
}
.lang-modal__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lang-modal__btn {
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.lang-modal__btn:hover {
  border-color: var(--accent, #ffffff);
}
.lang-modal__btn:active {
  transform: translateY(1px);
}
.lang-modal__btn.is-active {
  border-color: var(--accent, #ffffff);
  box-shadow: 0 0 0 2px var(--accent, #ffffff) inset;
  font-weight: 600;
}

/* Terms of use modal */
.terms-modal__dialog {
  width: min(560px, 100%);
  display: block;
  padding: 22px 24px 20px;
  max-height: 86vh;
  overflow-y: auto;
}
.terms-modal__title {
  margin: 0 0 12px;
  font-size: 18px;
}
.terms-modal__body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.terms-modal__body p {
  margin: 0 0 12px;
}
.terms-modal__list {
  margin: 0 0 14px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.terms-modal__list li {
  color: var(--muted);
}
.terms-modal__list strong {
  color: var(--text);
}
.terms-modal__link {
  color: var(--accent, #ffffff);
  text-decoration: none;
  font-weight: 600;
}
.terms-modal__link:hover {
  text-decoration: underline;
}
.terms-modal__disclaimer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.terms-modal__foot {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Footer ---------- */
.app-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  text-align: center;
}
.app-footer p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 720px;
}
.app-footer__link {
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
}
.app-footer__link:hover {
  text-decoration: underline;
}
.modal__dialog {
  width: min(1000px, 100%);
  max-height: 90vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 {
  margin: 0;
  font-size: 16px;
}
.modal__close {
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.modal__close:hover {
  color: var(--text);
}
.modal__body {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: 0;
  overflow: hidden;
}
.modal__controls {
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal__preview {
  border-left: 1px solid var(--line);
  background: var(--bg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  overflow: auto;
}
.cz-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cz-nav__btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cz-nav__btn:hover {
  border-color: var(--accent, #ffffff);
}
.cz-nav__label {
  min-width: 120px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal__preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__preview-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.modal__preview-note.is-warn {
  color: var(--danger);
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.cz-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg);
}
.cz-group > h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.cz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.cz-row + .cz-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.cz-row > label {
  font-size: 13px;
  color: var(--text);
  flex: 0 0 auto;
}
.cz-row__control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
}
.cz-row select,
.cz-row input[type="number"] {
  font: inherit;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
}
.cz-row input[type="range"] {
  width: 150px;
  accent-color: var(--accent-2);
}
.cz-row input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-3);
  cursor: pointer;
}
.cz-row__val {
  min-width: 38px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}
.cz-color-reset {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}
.cz-color-reset:hover {
  color: var(--text);
}

/* Image adjust sub-modal */
.cz-adjust {
  width: min(640px, 100%);
  grid-template-rows: auto auto auto;
}
.cz-adjust__body {
  display: flex;
  gap: 18px;
  padding: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.cz-adjust__box {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #0d0e12;
  cursor: grab;
  touch-action: none;
}
.cz-adjust__box:active {
  cursor: grabbing;
}
.cz-adjust__controls {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cz-adjust__slider {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cz-adjust__slider-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
}
.cz-adjust__slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
}
.cz-adjust__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .modal__body {
    grid-template-columns: 1fr;
  }
  .modal__preview {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 45vh;
  }
  .font-preview {
    margin-left: 0;
  }
}
