/* Self-hosted variable fonts (latin subset, SIL OFL) — no third-party requests. */
@font-face { font-family: Inter; font-style: normal; font-weight: 400 600; font-display: swap; src: url(../fonts/inter-latin.woff2) format('woff2'); }
@font-face { font-family: Sora; font-style: normal; font-weight: 600 700; font-display: swap; src: url(../fonts/sora-latin.woff2) format('woff2'); }

:root {
  --red: #D22C2B; --red-d: #B4121B; --ink: #0A0A0A; --g700: #3F3F46; --g500: #71717A;
  --g300: #D4D4D8; --g200: #E4E4E7; --g100: #F4F4F5; --wa: #25D366; --r: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: var(--g100); }
h1, h2 { font-family: Sora, system-ui, sans-serif; line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.05rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand img { display: block; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { white-space: nowrap; color: #fff; opacity: .75; text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 6px; }
.tabs a:hover { opacity: 1; }
.tabs a.on { opacity: 1; background: var(--red); }
#lang { width: auto; background: transparent; color: #fff; border: 1px solid var(--g700); border-radius: 6px; padding: 6px 8px; }
#lang option { color: var(--ink); }

.hero { background: var(--ink); color: #fff; padding: 28px 0 36px; }
.hero h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.hero p { color: #A1A1AA; margin: 0; }

main { padding: 24px 20px 8px; }
.grid { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.editor-grid { grid-template-columns: 1fr 320px; }
.card { background: #fff; border: 1px solid var(--g200); border-radius: var(--r); padding: 20px; }

label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--g700); }
label > span { display: block; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; font-weight: 400; color: var(--ink); border: 1px solid var(--g300); border-radius: 6px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
input:disabled { background: var(--g100); color: var(--g500); }
input[type=color] { padding: 2px; height: 38px; }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; }
label.check span { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px Inter, sans-serif; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--g300); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-d); border-color: var(--red-d); }
.btn.ghost { border-color: transparent; color: var(--g500); }
.btn.light { background: transparent; color: #fff; border-color: var(--g700); }
.btn.light:hover { border-color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wide { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }

.preview { text-align: center; }
.canvas-box { background: #fff; border: 1px solid var(--g200); border-radius: 8px; padding: 24px; min-height: 200px; display: grid; place-items: center; margin-bottom: 12px; }
#g-canvas { max-width: 100%; max-height: 360px; height: auto; image-rendering: pixelated; }
.btns { justify-content: center; }
.blist { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: center; max-height: 420px; overflow: auto; }
.blist img { max-width: 220px; height: auto; }
.layout { max-width: 320px; margin: 0 auto 12px; text-align: left; }
.gs1 { border: 1px solid var(--g200); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 14px; }
.gs1 legend { font: 600 13px Sora, sans-serif; padding: 0 6px; }
.gs1 .muted { margin: 0 0 10px; }
.gs1 .ai { margin-bottom: 8px; }
.gs1 .ai label { margin: 0 0 4px; font-weight: 500; }
.gs1 .ai input[data-v] { padding: 6px 8px; }
.gs1 .ai input[data-v]:disabled { display: none; }
.err { white-space: pre-line; color: var(--red-d); background: #FEF2F2; border-radius: 6px; padding: 10px; }
.muted { color: var(--g500); font-size: 13px; }
.center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--g200); margin: 16px 0; }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; padding: 14px 20px; }
.toolbar label { margin: 0; width: 140px; }
.toolbar .sp { flex: 1; }
.stage-box { background: var(--g200); display: grid; place-items: center; min-height: 360px; overflow: auto; }
#stage { position: relative; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); overflow: hidden; touch-action: none; }
.item { position: absolute; cursor: move; white-space: pre; user-select: none; outline: 1px dashed transparent; line-height: 1.15; }
.item:hover { outline-color: var(--g300); }
.item.sel { outline: 1.5px solid var(--red); }
.item.bad { color: var(--red-d); font-size: 12px; background: #FEF2F2; padding: 4px; }
.item img { display: block; image-rendering: pixelated; }
#e-props .btn { margin-top: 4px; }
#e-props .err { font-size: 13px; }

.cta { background: var(--ink); color: #fff; margin-top: 32px; padding: 44px 0; text-align: center; }
.cta p { color: #A1A1AA; max-width: 640px; margin: 0 auto 22px; }
.foot { color: var(--g500); font-size: 13px; padding: 20px; text-align: center; }

@media (max-width: 860px) {
  .grid, .editor-grid { grid-template-columns: 1fr; }
  .top-in { gap: 8px 12px; flex-wrap: wrap; height: auto; padding: 10px 20px; }
  .tabs { order: 3; flex-basis: 100%; }
  #lang { margin-left: auto; }
  .stage-box { min-height: 200px; }
  .tabs a { padding: 6px 8px; font-size: 13px; }
  .brand img { height: 24px; }
}
