:root {
    --bg-card: rgba(20, 21, 26, 0.96);
    --bg-input: #17181c;
    --brand-main: #3b66f5;
    --brand-hover: #5077fa;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(59, 102, 245, 0.4);
    --text-main: #ffffff;
    --text-muted: #838a9b;
    --ok: #23ca63;
    --bad: #ff4757;
    --font: "Proxima Nova", "Montserrat", "Segoe UI", sans-serif;
    --plate-font: "Arial Narrow", "Helvetica Condensed", Impact, "Arial Black", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    background: transparent !important;
    font-family: var(--font);
    color: var(--text-main);
    overflow: hidden;
    user-select: none;
}

#cef-app {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
}

.hidden { display: none !important; }

.plate_app {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    pointer-events: none;
}

.plate_app.visible {
    display: grid;
    pointer-events: auto;
}

.plate_backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(8, 10, 18, 0.45), rgba(8, 10, 18, 0.78));
}

.plate_modal {
    position: relative;
    width: min(560px, 94vw);
    padding: 20px 20px 18px;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    animation: plateIn 0.22s ease-out;
    pointer-events: auto;
}

@keyframes plateIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.plate_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.plate_brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.plate_brand__logo {
    width: 72px;
    height: 18px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.12);
    background: #111;
}

.plate_brand__title {
    font-size: 15px;
    font-weight: 700;
}

.plate_brand__sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.plate_x {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}
.plate_x:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== real plate blank preview ===== */
.plate_stage {
    display: grid;
    place-items: center;
    padding: 8px 0 16px;
}

.plate_blank {
    position: relative;
    width: min(480px, 100%);
    aspect-ratio: 1024 / 256;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.08);
}

.plate_blank__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    pointer-events: none;
}

.plate_glyphs {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.g {
    position: absolute;
    font-family: var(--plate-font);
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1;
    text-transform: uppercase;
}

/* --- civil / pt: AA 1234 BB in white/yellow field (after blue strip ~12%) --- */
.plate_blank[data-type="civil"] .g_reg,
.plate_blank[data-type="pt"] .g_reg { display: none; }

.plate_blank[data-type="civil"] .g_main,
.plate_blank[data-type="pt"] .g_main {
    left: 13.5%;
    right: 3%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: clamp(22px, 5.4vw, 34px);
    color: #111;
}

/* --- police: region left strip, 4 digits right of star --- */
.plate_blank[data-type="police"] .g_reg {
    left: 1.8%;
    width: 8.5%;
    bottom: 14%;
    text-align: center;
    font-size: clamp(11px, 2.2vw, 15px);
    color: #fff;
    letter-spacing: 0.02em;
    /* cover baked sample digits on blank */
    background: #0a2a6e;
    padding: 2px 0 1px;
    border-radius: 1px;
}

.plate_blank[data-type="police"] .g_main {
    left: 52%;
    right: 6%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: clamp(24px, 5.8vw, 36px);
    color: #fff;
    letter-spacing: 0.12em;
}

/* --- army: DDDD · LD on black --- */
.plate_blank[data-type="army"] .g_reg { display: none; }

.plate_blank[data-type="army"] .g_main {
    left: 5%;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: clamp(22px, 5.2vw, 32px);
    color: #fff;
    letter-spacing: 0.18em;
}

/* --- transit: region near left of red, series to the right --- */
.plate_blank[data-type="transit"] .g_reg {
    left: 13.5%;
    top: 50%;
    transform: translateY(-42%);
    width: 12%;
    text-align: center;
    font-size: clamp(16px, 3.6vw, 24px);
    color: #111;
    letter-spacing: 0.02em;
}

.plate_blank[data-type="transit"] .g_main {
    left: 28%;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: clamp(20px, 4.8vw, 30px);
    color: #111;
    letter-spacing: 0.14em;
}

/* ===== type picker with real frames ===== */
.plate_types {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.ptype {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 8px 6px 9px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s ease;
}
.ptype img {
    width: 100%;
    height: 22px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.35);
    background: #111;
}
.ptype:hover { color: #fff; background: rgba(255,255,255,0.06); }
.ptype.active {
    color: #fff;
    border-color: var(--border-focus);
    background: rgba(59, 102, 245, 0.14);
    box-shadow: 0 0 0 1px rgba(59, 102, 245, 0.15);
}

.plate_form {
    display: grid;
    grid-template-columns: 1fr 96px;
    gap: 10px;
}

.plate_field { display: flex; flex-direction: column; gap: 6px; }
.plate_field__label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.plate_input {
    height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--bg-input);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    outline: none;
    font-family: var(--font);
}
.plate_input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 102, 245, 0.16);
}

.plate_hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 28px;
}

.plate_actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.plate_btn {
    height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: 0;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
}
.plate_btn--ghost {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
}
.plate_btn--ghost:hover { color: #fff; background: rgba(255,255,255,0.09); }
.plate_btn--primary {
    background: linear-gradient(180deg, var(--brand-hover), var(--brand-main));
    color: #fff;
    min-width: 128px;
    box-shadow: 0 8px 20px rgba(59, 102, 245, 0.28);
}
.plate_btn--primary:hover { filter: brightness(1.05); }

.plate_status {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.plate_status.ok { background: rgba(35, 202, 99, 0.12); color: var(--ok); }
.plate_status.bad { background: rgba(255, 71, 87, 0.12); color: var(--bad); }

@media (max-width: 520px) {
    .plate_types { grid-template-columns: repeat(3, 1fr); }
    .plate_form { grid-template-columns: 1fr; }
}
