:root {
  --bg: #0b0c0f; --surface: #15171c; --surface-2: #1c1f26; --border: #2a2d35;
  --text: #f2f2f0; --text-dim: #8b8e98; --accent: #14b8a6;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4f1; --surface: #ffffff; --surface-2: #ececea; --border: #ddd9d3;
    --text: #14151a; --text-dim: #6b6e78; --accent: #0d9488;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0f; --surface: #15171c; --surface-2: #1c1f26; --border: #2a2d35;
  --text: #f2f2f0; --text-dim: #8b8e98; --accent: #14b8a6;
}
:root[data-theme="light"] {
  --bg: #f5f4f1; --surface: #ffffff; --surface-2: #ececea; --border: #ddd9d3;
  --text: #14151a; --text-dim: #6b6e78; --accent: #0d9488;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Onest', system-ui, sans-serif; min-height: 100vh; padding: 0 16px 24px;
}
.wrap { width: 100%; max-width: 980px; margin: 0 auto; }
h1 { font-weight: 800; font-size: clamp(22px, 5vw, 30px); margin: 0 0 4px; letter-spacing: -0.02em; }
.sub { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; line-height: 1.5; max-width: 720px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 16px; }

.wc-drop {
  border: 2px dashed var(--border); border-radius: 14px; padding: 22px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.wc-drop:hover, .wc-drop.drag { border-color: var(--accent); background: var(--surface-2); }
.wc-drop-t { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.wc-drop-t b { color: var(--text); font-size: 16px; display: block; margin-bottom: 4px; }
.wc-status { font-size: 13px; color: var(--text-dim); text-align: center; margin-top: 12px; min-height: 18px; line-height: 1.45; }
.wc-status.err { color: #f87171; }

.wc-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .wc-grid { grid-template-columns: minmax(0, 1fr); } }
.wc-left { position: sticky; top: 12px; }
@media (max-width: 820px) { .wc-left { position: static; } }
#wcPreview { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; border-radius: 14px; }

.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin: 16px 0 8px; font-weight: 600; }
.panel > .section-label:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips[hidden], [hidden] { display: none !important; }
.chip {
  font-family: inherit; font-size: 13px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; line-height: 1.2;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
input[type=color] { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); padding: 0; background: none; cursor: pointer; flex: none; overflow: hidden; }

input[type=text], input[type=date], input[type=time], textarea, select {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=date], input[type=time] { min-height: 44px; display: block; }
textarea { resize: vertical; min-height: 64px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.fld { display: block; }
.fld > span { display: block; font-size: 12px; color: var(--text-dim); margin: 0 0 5px 2px; }
.stack > * + * { margin-top: 10px; }
.pair { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 8px; }
.pair + .pair { margin-top: 8px; }
.code-err { color: #f87171; font-size: 12.5px; margin-top: 6px; min-height: 1em; }
.logo-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
button.btn {
  font-family: inherit; font-weight: 700; font-size: 15px; border-radius: 12px; padding: 13px 16px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; flex: 1 1 160px;
}
button.btn.small { flex: 0 0 auto; font-size: 13px; padding: 9px 12px; }
button.btn:hover { border-color: var(--accent); }
button.btn:active { transform: scale(0.97); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.gw { background: #1f1f1f; border-color: #1f1f1f; color: #fff; }
.note { font-size: 12px; color: var(--text-dim); margin-top: 14px; line-height: 1.6; }

.wc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wc-item { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 8px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.wc-item:hover { border-color: var(--accent); }
.wc-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: rgba(127,127,127,.12); border-radius: 10px; display: block; }
.wc-item .t b { display: block; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-item .t .d { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.wc-empty { font-size: 13px; color: var(--text-dim); }

.wc-viewer { position: fixed; inset: 0; z-index: 1000; background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)); }
.wc-viewer img { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.wc-vbar { display: flex; gap: 8px; max-width: 560px; margin: 0 auto 12px; }
.wc-vbar button { font: inherit; font-size: 14px; font-weight: 700; padding: 10px 12px; border-radius: 12px; border: 1px solid #ddd9d3;
  background: #f5f4f1; color: #14151a; cursor: pointer; flex: 1; }
.wc-vbar button.x { flex: 0 0 auto; }
.wc-hint { max-width: 560px; margin: 12px auto 0; text-align: center; font-size: 12.5px; color: #6b6e78; }
html.wc-viewing, html.wc-viewing body { overflow: hidden; }
html.wc-viewing .tool-nav { display: none; }
