/* CFG Studio - standalone FiveM server.cfg generator */
:root {
  --bg: #0a090d;
  --side: #0d0c10;
  --card: #100f14;
  --card-2: #0c0b0f;
  --field: #0d0c11;
  --line: #1e1c24;
  --line-2: #2a2732;
  --line-3: #383442;
  --text: #efedf3;
  --text-2: #b9b4c3;
  --muted: #8a8594;
  --dim: #5f5a68;
  --accent: #a855f7;
  --accent-2: #c084fc;
  --accent-3: #7c3aed;
  --accent-soft: rgba(168, 85, 247, .09);
  --accent-ring: rgba(168, 85, 247, .55);
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  --radius: 10px;
  --radius-lg: 16px;
  --side-w: 264px;
  --font: "Satoshi", "General Sans", "Inter", "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 600px at -10% 110%, rgba(124, 58, 237, .14), transparent 60%),
    radial-gradient(700px 420px at 75% -15%, rgba(168, 85, 247, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
svg { width: 16px; height: 16px; flex: none; }
code { font-family: var(--mono); font-size: .92em; color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
::selection { background: rgba(168, 85, 247, .35); }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 14px; border-radius: 8px; background: var(--accent-3); color: #fff; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

kbd {
  font: 600 10px/1 var(--mono);
  letter-spacing: .04em;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  text-transform: uppercase;
}

/* Layout ------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 26px 18px 22px;
  background: linear-gradient(180deg, var(--side), rgba(13, 12, 16, .6));
  border-right: 1px solid var(--line);
  overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Logo --------------------------------------------------------------- */
.brand { display: flex; justify-content: center; text-decoration: none; border-radius: 50%; }
.logo { display: block; }
.logo svg, .logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-badge {
  width: 108px; height: 108px;
  filter: drop-shadow(0 0 22px rgba(168, 85, 247, .35)) drop-shadow(0 0 2px rgba(192, 132, 252, .4));
  transition: transform .4s var(--ease);
}
.brand:hover .logo-badge { transform: scale(1.03) rotate(-2deg); }
.logo-word { display: none; width: 78px; height: 36px; filter: drop-shadow(0 0 10px rgba(168, 85, 247, .35)); }

.side-label { margin: 30px 12px 10px; font-size: 10px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* Steps -------------------------------------------------------------- */
.steps { position: relative; display: grid; gap: 6px; }
.steps::before { content: ""; position: absolute; left: 27px; top: 26px; bottom: 26px; width: 1px; background: linear-gradient(var(--line-2), var(--line-2)) no-repeat; }
.step {
  position: relative; display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px; padding: 10px 12px; text-align: left;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: background-color .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.step:hover { background: rgba(255, 255, 255, .025); }
.step-no {
  position: relative; z-index: 1; display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--side);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.step-no b { font: 700 10.5px/1 var(--font); color: var(--dim); }
.step-no svg { display: none; width: 14px; height: 14px; color: var(--accent-2); }
.step-txt { display: grid; gap: 1px; min-width: 0; }
.step-txt b { font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.step-txt small { font-size: 11.5px; color: var(--dim); }
.step.is-done .step-no { border-color: rgba(168, 85, 247, .45); background: #150f20; }
.step.is-done .step-no b { display: none; }
.step.is-done .step-no svg { display: block; }
.step.is-active {
  background: linear-gradient(135deg, rgba(168, 85, 247, .16), rgba(124, 58, 237, .05));
  border-color: rgba(168, 85, 247, .55);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, .08), 0 8px 30px -12px rgba(168, 85, 247, .45);
}
.step.is-active .step-no { border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-3)); box-shadow: 0 0 14px rgba(168, 85, 247, .5); }
.step.is-active .step-no b { color: #fff; }
.step.is-active .step-txt b { color: #fff; }
.step.is-active .step-txt small { color: var(--muted); }

/* Health card -------------------------------------------------------- */
.health {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 26px; padding: 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: rgba(255, 255, 255, .015);
  transition: border-color .2s var(--ease);
}
.health svg { width: 18px; height: 18px; margin-top: 1px; color: var(--ok); }
.health b { display: block; font-size: 12.5px; font-weight: 600; }
.health small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.health[data-state="warn"] { border-color: rgba(251, 191, 36, .3); }
.health[data-state="warn"] svg { color: var(--warn); }
.health[data-state="error"] { border-color: rgba(248, 113, 113, .35); }
.health[data-state="error"] svg { color: var(--danger); }

.side-foot { margin: auto 0 0; padding: 22px 12px 0; font-size: 11.5px; line-height: 1.6; color: var(--dim); }

/* Main --------------------------------------------------------------- */
.main { display: flex; flex-direction: column; padding: 34px clamp(20px, 5vw, 88px) 28px; min-width: 0; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(168, 85, 247, .18), 0 0 10px var(--accent); }
h1 { margin: 0; font-size: clamp(30px, 4vw, 52px); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; text-wrap: balance; }
.grad { background: linear-gradient(95deg, var(--accent-2), var(--accent) 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 10px 0 0; color: var(--muted); font-size: 15px; max-width: 52ch; }
.top-actions { display: flex; gap: 8px; flex: none; }

/* Stats strip -------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 18px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(16, 15, 20, .6); overflow: hidden; }
.stats li { display: grid; gap: 4px; padding: 14px 18px; min-width: 0; }
.stats li + li { border-left: 1px solid var(--line); }
.stats small { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.stats b { font: 700 17px/1.2 var(--font); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats b.is-warn { color: var(--warn); }

/* Buttons ------------------------------------------------------------ */
.btn-icon, .btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .02);
  white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease), filter .15s var(--ease);
}
.btn-icon { width: 40px; color: var(--accent-2); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-primary { padding: 0 10px 0 14px; font-weight: 600; font-size: 13px; }
.btn-primary svg { color: var(--accent-2); }
.btn-primary kbd { margin-left: 4px; }
.btn-ghost { padding: 0 13px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.btn-ghost svg { width: 15px; height: 15px; }
.btn-ghost.sq { width: 42px; padding: 0; }
.btn-ghost.sm { height: 34px; font-size: 12px; padding: 0 10px; }
.btn-ghost.sm.sq { width: 34px; padding: 0; }
.btn-ghost.sm kbd { margin-left: 2px; }
.btn-icon:hover, .btn-primary:hover, .btn-ghost:hover { border-color: rgba(168, 85, 247, .45); background: var(--accent-soft); }
.btn-icon:active, .btn-primary:active, .btn-ghost:active { transform: translateY(1px); }
#exportBtn, .card-foot .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3)); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px -10px rgba(168, 85, 247, .7), inset 0 1px 0 rgba(255, 255, 255, .18);
}
#exportBtn svg, .card-foot .btn-primary svg { color: #fff; }
#exportBtn kbd { border-color: rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .15); color: rgba(255, 255, 255, .85); }
#exportBtn:hover, .card-foot .btn-primary:hover { filter: brightness(1.1); background: linear-gradient(135deg, var(--accent), var(--accent-3)); }
.card-foot .btn-primary { padding: 0 18px; }
.btn-ghost[disabled] { opacity: .35; pointer-events: none; }
.flip { transform: scaleX(-1); }

/* View switch (tablet & mobile only) --------------------------------- */
.view-switch { display: none; gap: 4px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.view-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: background-color .15s, color .15s; }
.view-switch button[aria-selected="true"] { background: linear-gradient(135deg, rgba(168, 85, 247, .2), rgba(124, 58, 237, .08)); color: #fff; box-shadow: inset 0 0 0 1px rgba(168, 85, 247, .45); }
.view-switch em { font: 600 10px/1 var(--mono); font-style: normal; padding: 3px 6px; border-radius: 99px; background: rgba(168, 85, 247, .15); color: var(--accent-2); }

/* Grid & cards ------------------------------------------------------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.card { background: linear-gradient(180deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: var(--radius-lg); }

.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.counter { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-head strong { font-size: 13px; font-weight: 700; white-space: nowrap; }
.progress { flex: 1; height: 3px; margin-left: clamp(12px, 5vw, 64px); background: var(--line-2); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent-3), var(--accent-2)); transform-origin: left; transform: scaleX(.25); transition: transform .35s var(--ease); }

.card-body { padding: 36px clamp(18px, 4vw, 44px) 28px; }
.panel { animation: in .28s var(--ease); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.panel-head { margin-bottom: 28px; }
.panel-head h2 { margin: 0; font-size: clamp(22px, 2.3vw, 30px); font-weight: 700; letter-spacing: -.025em; line-height: 1.2; text-wrap: balance; }
.panel-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
.foot-dots { display: flex; gap: 6px; }
.foot-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--line-3); transition: width .25s var(--ease), background-color .25s; }
.foot-dots i.is-on { width: 18px; background: var(--accent); }
.foot-dots i.is-done { background: rgba(168, 85, 247, .5); }

/* Fields ------------------------------------------------------------- */
.field { margin-bottom: 20px; min-width: 0; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field > label { display: block; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label em { font-style: normal; font-weight: 500; color: var(--dim); margin-left: 4px; }

input:not([type="checkbox"]), textarea {
  width: 100%; min-height: 42px; padding: 10px 13px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--field);
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--dim); font-weight: 400; }
input:hover, textarea:hover { border-color: var(--line-3); }
input:focus, textarea:focus { outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 3px rgba(168, 85, 247, .12); }
.field.is-error input { border-color: rgba(248, 113, 113, .6); }

.hint { margin: 7px 0 0; font-size: 12px; line-height: 1.45; color: var(--dim); }
.hint.is-error { color: var(--danger); }
.hint.is-warn { color: var(--warn); }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn-ghost { height: auto; min-height: 42px; }

.tip { display: flex; gap: 12px; margin-top: 28px; padding: 16px 18px; border: 1px solid rgba(168, 85, 247, .2); border-radius: var(--radius); background: linear-gradient(135deg, rgba(168, 85, 247, .07), rgba(168, 85, 247, .015)); }
.tip svg { width: 15px; height: 15px; color: var(--accent-2); margin-top: 2px; }
.tip b { font-size: 13px; }
.tip p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

/* Dropdown (one component for every select) -------------------------- */
.select { position: relative; }
.select-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px;
  padding: 0 13px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--field);
  transition: border-color .15s var(--ease), border-radius .1s;
}
.select-trigger:hover { border-color: var(--line-3); }
.select-trigger:focus-visible { outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 3px rgba(168, 85, 247, .12); }
.select-value { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.opt-code { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.opt-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.flag { width: 20px; height: 14px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
.chev { width: 14px; height: 14px; color: var(--muted); transition: transform .2s var(--ease), color .2s; }

.select-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40;
  display: none; padding: 6px; margin: 0; list-style: none;
  max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  background: #0f0d14;
  border: 1px solid var(--accent-ring); border-top-color: var(--line-2);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .8), 0 0 0 4px rgba(168, 85, 247, .06);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.select.is-open { z-index: 30; }
.select.is-open .select-trigger { border-color: var(--accent-ring); border-radius: 10px 10px 0 0; background: #0f0d14; box-shadow: 0 0 0 4px rgba(168, 85, 247, .06); }
.select.is-open .chev { transform: rotate(180deg); color: var(--accent-2); }
.select.is-open .select-panel { display: block; animation: drop .16s var(--ease); }
.select.is-up .select-panel { top: auto; bottom: calc(100% - 1px); border-radius: 10px 10px 0 0; border-top-color: var(--accent-ring); border-bottom-color: var(--line-2); }
.select.is-up.is-open .select-trigger { border-radius: 0 0 10px 10px; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }

.option {
  display: grid; grid-template-columns: auto minmax(56px, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 42px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
  transition: background-color .12s;
}
.option.no-flag { grid-template-columns: minmax(64px, auto) minmax(0, 1fr) auto; }
.option .opt-code { font-size: 13px; }
.option .chk { width: 15px; height: 15px; color: var(--accent-2); opacity: 0; }
.option.is-active { background: rgba(255, 255, 255, .04); }
.option[aria-selected="true"] { background: rgba(168, 85, 247, .1); }
.option[aria-selected="true"] .chk { opacity: 1; }
.option[aria-selected="true"].is-active { background: rgba(168, 85, 247, .16); }

/* Toggles ------------------------------------------------------------ */
.toggles { display: grid; gap: 8px; margin-top: 6px; }
.toggle {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 0; padding: 14px 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--field); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.toggle:hover { border-color: var(--line-3); }
.toggle:has(input:checked) { border-color: rgba(168, 85, 247, .3); background: rgba(168, 85, 247, .04); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { position: relative; width: 36px; height: 20px; flex: none; border-radius: 99px; background: var(--line-2); transition: background-color .2s var(--ease); }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #8d8898; transition: transform .2s var(--ease), background-color .2s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + i { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.toggle span { display: grid; gap: 2px; min-width: 0; }
.toggle b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.toggle small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* Resources list ----------------------------------------------------- */
.res-list { margin: 0; padding: 4px; list-style: none; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--field); counter-reset: r; max-height: 420px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.res-list:empty::before { content: attr(data-empty); display: block; padding: 22px; font-size: 13px; color: var(--dim); text-align: center; }
.res {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 6px 4px 8px; border-radius: 7px;
  counter-increment: r; font: 500 13px/1 var(--mono);
}
.res:hover { background: rgba(255, 255, 255, .025); }
.res::before { content: counter(r, decimal-leading-zero); font-size: 10.5px; color: var(--dim); width: 20px; flex: none; }
.res .grip { color: var(--dim); cursor: grab; display: flex; }
.res .grip svg { width: 15px; height: 15px; }
.res .kw { color: var(--muted); }
.res .name { flex: 1; min-width: 0; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.res .acts { display: flex; gap: 2px; opacity: .45; transition: opacity .15s; }
.res:hover .acts, .res:focus-within .acts { opacity: 1; }
.res .acts button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--text-2); }
.res .acts button:hover { background: var(--accent-soft); color: #fff; }
.res .acts button[disabled] { opacity: .25; pointer-events: none; }
.res .acts svg { width: 14px; height: 14px; }
.res .acts .down svg { transform: rotate(180deg); }
.res.is-drag { opacity: .4; }
.res.is-over { box-shadow: inset 0 2px 0 var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--accent-soft); font: 500 12px/1 var(--mono); color: var(--accent-2); max-width: 100%; }
.chips li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); }
.chips button:hover { background: rgba(255, 255, 255, .08); }
.chips svg { width: 12px; height: 12px; }

/* Output ------------------------------------------------------------- */
.out-card { display: flex; flex-direction: column; }
.out-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid var(--line); }
.out-head .eyebrow { margin-bottom: 6px; }
.out-head strong { font-size: 15px; font-weight: 700; }
.out-actions { display: flex; gap: 6px; }
.code-win { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #0b0a0e; overflow: hidden; }
.code-bar { display: flex; align-items: center; gap: 6px; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.code-bar i { width: 8px; height: 8px; border-radius: 50%; background: #2c2933; }
.code-bar span { margin-left: 10px; font-family: var(--mono); }
.code-bar em { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.code {
  margin: 0; padding: 16px 16px 24px; flex: 1 1 0; height: 0; min-height: 0; overflow: auto;
  font: 500 12px/1.65 var(--mono); color: #e8e5ee; tab-size: 2;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  contain: content;
}
.code:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent-ring); }
.code .c { color: #4b4654; }
.code .h { color: #6a6474; }
.code .k { color: #f3f0f7; font-weight: 700; }
.code .v { color: var(--accent-2); }
.code .s { color: #c9a3ff; }
.code .n { color: #d8b4fe; }

.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-top: auto; padding-top: 28px; font-size: 12px; color: var(--dim); }

/* Toast -------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100;
  max-width: calc(100vw - 32px); padding: 11px 18px; border: 1px solid rgba(168, 85, 247, .4); border-radius: 99px;
  background: rgba(20, 17, 27, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 600; text-align: center;
  opacity: 0; transform: translate(-50%, 10px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive --------------------------------------------------------- */

/* Large screens: give the preview more room */
@media (min-width: 1680px) {
  :root { --side-w: 288px; }
  .logo-badge { width: 120px; height: 120px; }
  .grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}

/* Laptops / tablets landscape: one column, editor & preview as tabs */
@media (max-width: 1180px) {
  .view-switch { display: flex; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid[data-view="edit"] .out-card,
  .grid[data-view="preview"] .form-card { display: none; }
  .out-card { position: static; max-height: none; }
  .code { height: auto; min-height: 60vh; max-height: 70vh; }
}

/* Short laptop screens */
@media (min-width: 901px) and (max-height: 760px) {
  .logo-badge { width: 88px; height: 88px; }
  .side-label { margin-top: 20px; }
  .health { margin-top: 18px; }
}

/* Tablets portrait & phones: sidebar becomes a sticky top bar */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    z-index: 50; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
    border-right: 0; border-bottom: 1px solid var(--line);
    background: rgba(13, 12, 16, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    overflow: visible;
  }
  .brand { border-radius: 8px; }
  .logo-badge { display: none; }
  .logo-word { display: block; }
  .side-label, .side-foot, .health { display: none; }
  .steps { flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; min-width: 0; }
  .steps::before { display: none; }
  .step { min-height: 44px; padding: 6px 8px; gap: 8px; justify-content: center; }
  .step-no { width: 24px; height: 24px; }
  .step-no b { font-size: 9.5px; }
  .step-txt small { display: none; }
  .step-txt b { font-size: 12.5px; }
  .main { padding: 26px 16px 24px; }
  .top { flex-direction: column; align-items: stretch; gap: 18px; }
  .top-actions .btn-primary { flex: 1; }
}

/* Phones */
@media (max-width: 640px) {
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .brand { width: 100%; justify-content: flex-start; }
  .logo-word { width: 70px; height: 32px; }
  .steps { flex-basis: 100%; }
  .step { flex-direction: column; gap: 4px; padding: 6px 2px; min-height: 52px; }
  .step-txt b { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lead { font-size: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li { padding: 12px 14px; }
  .stats li:nth-child(3) { border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats b { font-size: 15px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 26px 16px 18px; }
  .progress { margin-left: 8px; }
  .panel-head { margin-bottom: 22px; }
  .card-foot {
    position: sticky; bottom: 0; z-index: 20;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(12, 11, 15, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .card-foot .btn-ghost, .card-foot .btn-primary { height: 44px; }
  .inline.wrap { flex-wrap: wrap; }
  .inline.wrap #genRcon { flex-basis: 100%; }
  .out-head { padding: 16px 14px 14px; }
  .code-win { margin: 10px; }
  .code { font-size: 11.5px; padding: 14px 12px 20px; }
  .btn-ghost.sm { height: 38px; }
  .btn-ghost.sm.sq { width: 38px; }
  .site-foot { flex-direction: column; text-align: center; align-items: center; }
  /* 16px stops iOS from zooming into focused fields */
  input:not([type="checkbox"]), textarea { font-size: 16px; min-height: 46px; }
  .select-trigger { min-height: 46px; }
  .option { min-height: 46px; }
  kbd { display: none; }
}

@media (max-width: 380px) {
  .option { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; }
  .option.no-flag { grid-template-columns: auto minmax(0, 1fr) auto; }
  .foot-dots { display: none; }
  .stats b { font-size: 14px; }
}

/* Original PNG logo (assets/logo.png) is a round badge */
.logo-word.is-png { width: 38px; height: 38px; }

@media (hover: none) {
  .res .acts { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
