/* PvZH Vault card maker. Builds on /guides.css tokens. */
@font-face { font-family: "CafeteriaCard"; src: url("/fonts/Cafeteria-Bold.otf") format("opentype"); font-weight: 700; font-display: block; }

.cm-tool { max-width: 1040px; margin: 0 auto; padding: 24px 24px 8px; display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 32px; align-items: start; }
.cm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Preview */
.cm-preview { position: sticky; top: 14px; }
.cm-stage { display: grid; place-items: center; padding: 10px; border-radius: 16px; border: 1px dashed transparent; background: var(--surface); }
.cm-stage.is-drop { border-color: var(--accent); }
#cmCanvas { width: 100%; max-width: 420px; height: auto; aspect-ratio: 433 / 498; touch-action: none; cursor: grab; border-radius: 12px; }
#cmCanvas.is-small { aspect-ratio: 320 / 270; }
#cmCanvas:active { cursor: grabbing; }
#cmCanvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cm-under { margin: 10px 0 0; }
.cm-preview > .cm-tabs { margin: 0 0 10px; }
.cm-tabs { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.cm-tabs button { border: 0; background: none; color: var(--muted); font: 600 13.5px/1 var(--sans); padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.cm-tabs button[aria-selected="true"] { background: var(--text); color: #12181b; }
.cm-actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; }
.cm-actions button { justify-content: center; }
.cm-actions button { display: inline-flex; align-items: center; gap: 6px; font: 650 14px/1 var(--sans); padding: 9px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); }
.cm-actions button:hover { background: var(--surface-3); }
.cm-actions .cm-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #04161c; }
.cm-actions .cm-primary:hover { background: #38c9e8; }
.cm-actions svg, .cm-ghost svg, .cm-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-hint { margin: 8px 2px 0; font: 400 13px/1.4 var(--sans) !important; color: var(--muted); }
.cm-status { min-height: 18px; margin: 6px 2px 0; font: 500 13.5px var(--sans); color: var(--grade-a); }
.cm-power { display: flex; gap: 8px; align-items: baseline; margin: 2px 2px 0; font: 400 13.5px/1.45 var(--sans) !important; color: var(--muted); }
.cm-power[hidden] { display: none; }
.cm-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--grade-a); transform: translateY(-1px); }
.cm-dot.low { background: var(--grade-b); } .cm-dot.high { background: var(--gold); } .cm-dot.max { background: var(--grade-d); }

/* Editor */
.cm-editor { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.cm-start { display: flex; gap: 6px; padding: 14px; border-bottom: 1px solid var(--line); }
.cm-start input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font: 500 15px var(--sans); }
.cm-start input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.cm-ghost { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line-2); color: var(--body); border-radius: 10px; padding: 0 12px; font: 600 14px var(--sans); cursor: pointer; white-space: nowrap; }
.cm-ghost:hover { background: var(--surface-2); color: var(--text); }
.cm-paneltabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.cm-paneltabs::-webkit-scrollbar { display: none; }
.cm-paneltabs button { background: none; border: 0; box-shadow: inset 0 -2px 0 transparent; color: var(--muted); font: 600 14.5px var(--sans); padding: 12px 12px 11px; cursor: pointer; white-space: nowrap; }
.cm-paneltabs button[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-solid); }
.cm-panel { display: grid; gap: 14px; padding: 16px; }
.cm-panel[hidden] { display: none; }
.cm-field { display: grid; gap: 6px; min-width: 0; }
.cm-field > span { font: 600 13px/1.2 var(--sans); color: var(--muted); }
.cm-field > span b { color: var(--text); font-weight: 650; }
.cm-field input, .cm-field select, .cm-field textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; font: 500 15px/1.4 var(--sans); }
.cm-field textarea { resize: vertical; }
.cm-field input:focus, .cm-field select:focus, .cm-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.cm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cm-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cm-two[hidden], .cm-field[hidden], .cm-check[hidden] { display: none; }
.cm-classes { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.cm-classes button { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; cursor: pointer; padding: 3px; }
.cm-classes button img { width: 70%; height: auto; max-width: 30px; }
.cm-classes button:nth-child(6) { margin-left: 6px; }
.cm-classes button[aria-pressed="true"] { border-color: var(--text); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--text); }
.cm-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); }
.cm-seg button { border: 0; background: none; color: var(--muted); font: 600 13.5px var(--sans); padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.cm-seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.cm-insert { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -6px; }
.cm-insert button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; cursor: pointer; }
.cm-insert button:hover { border-color: var(--line-2); background: var(--surface-2); }
.cm-insert img { width: 22px; height: 22px; object-fit: contain; }
.cm-help { font: 400 13px/1.5 var(--sans) !important; color: var(--muted); margin: -4px 0 0 !important; }
.cm-help code { font: 600 12.5px var(--sans); color: var(--text); background: var(--bg); padding: 1px 5px; border-radius: 5px; }
.cm-row-inline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cm-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: 650 14px var(--sans); padding: 10px 14px; border-radius: 10px; }
.cm-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cm-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.cm-link { background: none; border: 0; color: var(--accent); font: 600 14px var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cm-range { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; font: 600 13px var(--sans); color: var(--muted); }
.cm-range input { width: 100%; accent-color: var(--accent-solid); }
.cm-check { display: inline-flex; gap: 8px; align-items: center; font: 500 14px var(--sans); color: var(--body); }

/* Article below the tool: quiet and narrow */
.cm-article { max-width: 760px; margin: 0 auto; padding: 48px 24px 20px; }
.cm-article > section { margin: 0 0 48px; }
.cm-kw img { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; object-fit: contain; }
.cm-steps { padding-left: 22px !important; }
.cm-steps li { margin: 0 0 8px !important; }

@media (max-width: 900px) {
  .cm-tool { grid-template-columns: 1fr; padding-top: 12px; gap: 14px; }
  .cm-preview { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -18px; padding: 8px 18px 8px; border-bottom: 1px solid var(--line); }
  .cm-stage { padding: 4px; background: none; }
  #cmCanvas { max-height: 34vh; width: auto; }
  .cm-under { margin-top: 6px; }
  .cm-preview > .cm-tabs { margin-bottom: 6px; }
  .cm-power, .cm-hint { display: none; }
  .cm-long { display: none; }
  .cm-status { min-height: 0; margin-top: 2px; }
}
@media (max-width: 760px) { .cm-tool, .cm-article { padding-left: 18px; padding-right: 18px; } .cm-classes { grid-template-columns: repeat(5, minmax(0, 1fr)); } .cm-classes button:nth-child(6) { margin-left: 0; } }
@media (max-width: 520px) { .cm-two { grid-template-columns: 1fr; } .cm-seg { display: flex; } .cm-seg button { flex: 1; } }
