/*  Emblem Helper — modern UI
    Dark, precise, tool-like. Single acid-green accent (a nod to GTA Online),
    hairline borders, uppercase micro-labels, mono numerals. No gradients, no gloss. */

:root {
    --bg: #0e0f11;
    --panel: #151619;
    --raised: #1b1d21;
    --line: #26282e;
    --line-strong: #34373e;
    --text: #e8eaed;
    --muted: #9aa0a8;
    --dim: #62666e;
    --accent: #a8d030;
    --accent-down: #93b829;
    --accent-ink: #101204;
    --danger: #e5484d;
    --checker-a: #22242a;
    --checker-b: #2d3037;
    --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: var(--muted); text-decoration: none; transition: color .12s ease; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ------------------------------ top bar ------------------------------ */

.topbar {
    background: #0a0b0c;
    border-top: 2px solid var(--accent);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1560px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark rect { fill: var(--accent); }
.brand-name {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.brand-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    padding: 2px 6px;
    transform: translateY(1px);
}
.topnav { display: flex; gap: 22px; }
.topnav a {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.intro {
    max-width: 1560px;
    margin: 0 auto;
    padding: 18px 20px 0;
    color: var(--muted);
    font-size: 13.5px;
}

/* ------------------------------ layout ------------------------------ */

.layout {
    max-width: 1560px;
    margin: 0 auto;
    padding: 16px 20px 8px;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr) 400px;
    gap: 16px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.panel-head-gap { margin-top: 26px; }
.step {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
}
.panel-title {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #cdd1d6;
}
.panel-head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ------------------------------ buttons ------------------------------ */

.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 5px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease, transform .06s ease;
    user-select: none;
}
.btn:active:enabled { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; }

.btn-wide { width: 100%; display: block; }
.btn-sm { padding: 7px 12px; font-size: 11.5px; }

.btn-accent {
    background: var(--accent);
    color: var(--accent-ink);
}
.btn-accent:hover:enabled { background: var(--accent-down); }
.btn-accent:disabled {
    background: var(--raised);
    color: var(--dim);
    border-color: var(--line);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line-strong);
}
.btn-ghost:hover:enabled { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { color: var(--dim); border-color: var(--line); }

.btn.is-busy { position: relative; color: var(--accent-ink); }
.btn.is-copied { background: var(--accent); color: var(--accent-ink); }

#btnCreate { margin-top: 22px; }

/* ------------------------------ dropzone ------------------------------ */

.dropzone {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .12s ease, background-color .12s ease;
}
.dropzone:hover { border-color: var(--dim); }
.dropzone.is-drag {
    border-color: var(--accent);
    background: rgba(168, 208, 48, .05);
}

.checker {
    background-image:
        linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%),
        linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%);
    background-color: var(--checker-a);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.thumbbox {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
}
.thumbbox img { display: none; max-width: 62px; max-height: 62px; }
.thumbbox img.has-image { display: block; }

.dropmeta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
}
.status {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
}
.status.is-error { color: var(--danger); }
.drophint { font-size: 12px; color: var(--dim); }

/* ------------------------------ fields ------------------------------ */

.field { margin-bottom: 16px; }
.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.seg-group {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 2px;
}
.seg {
    flex: 1;
    position: relative;
    text-align: center;
    padding: 7px 4px;
    border-radius: 3px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.seg input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    margin: 0;
    cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg:has(input:checked) {
    background: var(--accent);
    color: var(--accent-ink);
}
.seg:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ------------------------------ tooltips ------------------------------ */

.tipwrap { position: relative; display: inline-flex; }
.hint {
    appearance: none;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--dim);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    transition: color .12s ease, border-color .12s ease;
}
.hint:hover { color: var(--accent); border-color: var(--accent); }
.tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -6px;
    z-index: 100;
    width: 300px;
    max-width: 82vw;
    background: var(--raised);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.55;
    letter-spacing: 0;
    text-transform: none;
    color: #c4c8ce;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    animation: tip-in .14s ease;
}
.tipwrap:hover .tip,
.tipwrap:focus-within .tip { display: block; }
@keyframes tip-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }

/* ------------------------------ preview ------------------------------ */

.panel-preview { display: flex; flex-direction: column; }

.stage {
    position: relative;
    width: 100%;
    max-width: 512px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}
.stage-svg { position: absolute; inset: 0; }
.stage-svg svg { display: block; width: 100%; height: 100%; }
.stage-hint {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
    line-height: 1.7;
    color: var(--dim);
    letter-spacing: .04em;
    text-transform: uppercase;
    pointer-events: none;
}
.stage-hint strong { color: var(--muted); }
.stage-hint[hidden] { display: none; }

.budget {
    max-width: 512px;
    width: 100%;
    margin: 16px auto 0;
}
.budget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.budget-chip {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 3px;
    padding: 3px 8px;
}
.budget.is-over .budget-chip { background: var(--danger); color: #fff; }
.budget-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}
.budget-track {
    height: 6px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
}
.budget-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .25s ease;
}
.budget.is-over .budget-bar { background: var(--danger); }
.budget-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--dim);
}

/* ------------------------------ output ------------------------------ */

.code {
    display: block;
    width: 100%;
    height: 320px;
    resize: vertical;
    margin: 14px 0;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #b9bec6;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    word-break: break-all;
}
.code:focus { outline: none; border-color: var(--line-strong); }

.mobile-note {
    display: none;
    margin: 14px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
}

.howto {
    margin: 20px 0 0;
    padding: 16px 0 0 18px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted);
}
.howto li { margin-bottom: 6px; }
.howto li::marker { color: var(--accent); font-weight: 700; }
.howto a { color: var(--text); border-bottom: 1px solid var(--line-strong); }
.howto a:hover { color: var(--accent); border-color: var(--accent); }
.kbd {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text);
    background: var(--raised);
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

/* ------------------------------ footer ------------------------------ */

.footer {
    max-width: 1560px;
    margin: 0 auto;
    padding: 18px 20px 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dim);
}
.footer a { color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.footer a:hover { color: var(--accent); border-color: var(--accent); }
.footer-dot { color: var(--line-strong); }

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 1240px) {
    .layout { grid-template-columns: 340px minmax(0, 1fr); }
    .layout .panel:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .layout .panel:nth-child(3) { grid-column: auto; }
    .mobile-note { display: block; }
    .tip { right: auto; left: -120px; }
}

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