:root {
  --brand: #f26822;
  --brand-hover: #db5a18;
  --brand-soft: #fdeee5;
  --ink: #1b2a3a;
  --ink-2: #36404e;
  --muted: #8a94a6;
  --line: #e7eaf0;
  --panel: #f4f6f9;
  --field: #d9dee7;
  --green: #56b948;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: #eef1f5;
  color: var(--ink-2);
  font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f5; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 24px; height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; color: #2b2b2b; }
.brand b { font-weight: 700; }
.brand .ring { width: 28px; height: 28px; }
.spacer { flex: 1; }
.pill {
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 20px;
  background: var(--panel); color: var(--muted);
}
.pill.live { background: rgba(86,185,72,.14); color: #2f9e2a; }
.pill.demo { background: #fff3e6; color: var(--brand); }

.btn {
  border: none; border-radius: 9px; font-weight: 600; font-size: 14px;
  padding: 10px 18px; cursor: pointer; font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(242,104,34,.28); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: var(--panel); color: var(--ink-2); }
.btn.ghost:hover { background: #e7ebf1; }
.btn.mini { padding: 7px 12px; font-size: 13px; }

/* layout */
.layout {
  max-width: 1320px; margin: 0 auto; padding: 26px 24px 60px;
  display: grid; grid-template-columns: 1fr 380px; gap: 26px; align-items: start;
}
.h1 { font-size: 28px; font-weight: 700; color: var(--ink); margin: 0 0 6px; letter-spacing: -.4px; }
.sub { color: var(--muted); margin: 0 0 22px; max-width: 760px; line-height: 1.5; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 10px 18px; font-size: 14px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
}
.tab.active { background: var(--brand-soft); border-color: #f6cdb4; color: var(--ink); font-weight: 600; }
.panel-tab { display: none; flex-direction: column; gap: 18px; }
.panel-tab.active { display: flex; }

.auth-panel {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center;
  background: #fff7f1; border: 1px solid #f6cdb4; border-radius: 14px;
  padding: 18px 20px; margin: 0 0 18px;
}
.auth-panel[hidden] { display: none; }
.auth-panel h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.auth-panel p { margin: 0; color: var(--ink-2); line-height: 1.45; }
.auth-form { display: flex; gap: 10px; align-items: center; }
.auth-form input {
  width: 270px; height: 42px; border: 1px solid var(--field); border-radius: 9px;
  padding: 0 12px; font-size: 14px; font-family: inherit; outline: none; background: #fff;
}
.auth-form input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(242,104,34,.12);
}

/* cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.card h3 { margin: 0 0 16px; font-size: 16px; color: var(--ink); }
.card h4 { margin: 20px 0 10px; font-size: 14px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.fld { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fld em { font-weight: 500; color: var(--muted); font-style: normal; }
.fld input, .fld select, .fld textarea {
  border: 1px solid var(--field); border-radius: 9px; padding: 11px 13px;
  font-size: 14px; font-family: inherit; color: var(--ink-2); outline: none; background: #fff;
  font-weight: 400; transition: border-color .15s, box-shadow .15s;
}
.fld textarea { resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(242,104,34,.12);
}
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type=color] { width: 46px; height: 44px; padding: 2px; border-radius: 9px; border: 1px solid var(--field); cursor: pointer; background: #fff; }
.colorrow .hex { flex: 1; }
input[type=range] { accent-color: var(--brand); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 4px 0 0; }
.hint.center { text-align: center; }
.opts { color: var(--ink-2); line-height: 1.9; padding-left: 18px; margin: 0; }
#keyStatus { color: var(--green); }

/* code box */
.codebox { position: relative; background: #16181d; border-radius: 12px; padding: 16px 16px; margin-bottom: 8px; }
.codebox pre {
  margin: 0; color: #e6e9ef; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; padding-right: 90px;
}
.codebox .btn { position: absolute; top: 12px; right: 12px; }

/* preview */
.preview {
  position: sticky; top: 90px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.preview-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; color: var(--ink); }
.preview-frame {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(135deg,#f7f9fc,#eef2f7); height: 560px;
}
.preview-frame iframe { width: 100%; height: 100%; border: none; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 12px 30px rgba(20,30,50,.25); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .preview { position: static; }
  .grid2 { grid-template-columns: 1fr; }
  .auth-panel { grid-template-columns: 1fr; }
  .auth-form { flex-direction: column; align-items: stretch; }
  .auth-form input { width: 100%; }
}
