:root {
    --accent: #111;
    --ink: #111;
    --muted: #6b6b6b;
    --line: #e7e7e7;
    --soft: #f5f5f4;
    --plate-blue: #1f4fbf;
    --radius: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: transparent; }
[hidden] { display: none !important; }

.pb { display: grid; gap: 14px; padding: 20px; }
.pb--popup { padding-top: 8px; }

/* Plate input */
.pb-form { display: grid; gap: 10px; }

.pb-plate {
    display: flex;
    height: 60px;
    border: 2px solid var(--ink);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .15s;
}
.pb-plate:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.pb-eu {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    width: 38px;
    flex: none;
    background: var(--plate-blue);
    color: #fff;
}
.pb-eu b { font-size: 11px; letter-spacing: .02em; }

.pb-plate input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0 14px;
    font: 700 26px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink);
    background: transparent;
}
.pb-plate input::placeholder { color: #c9c9c9; }

/* Button */
.pb-btn {
    position: relative;
    height: 50px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.pb-btn:hover { filter: brightness(1.12); }
.pb-btn:active { transform: scale(.99); }
.pb-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.pb-btn[aria-busy="true"] { cursor: progress; }
.pb-btn[aria-busy="true"] span { visibility: hidden; }

.pb-spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pb-spin .7s linear infinite;
}
.pb-btn[aria-busy="true"] .pb-spinner { display: block; }
@keyframes pb-spin { to { transform: rotate(360deg); } }

/* Slow-lookup progress */
.pb-progress { display: grid; gap: 8px; }
.pb-bar { height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.pb-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s linear; }
.pb-hint { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.pb-hint svg { flex: none; }
.pb-hint span { flex: 1; }
.pb-hint time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* Alert */
.pb-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.35;
    background: #fff4e5;
    color: #8a4b00;
}
.pb-alert svg { flex: none; }
.pb-alert[data-tone="danger"] { background: #fdecec; color: #b42318; }

/* Result */
.pb-result {
    display: grid;
    background: #fff;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    animation: pb-in .25s ease-out;
}
@keyframes pb-in { from { opacity: 0; transform: translateY(4px); } }

.pb-result-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pb-result-main > div { display: grid; gap: 2px; min-width: 0; }
.pb-result small { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pb-code { font: 800 40px/1.1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; word-break: break-word; }
.pb-name { font-size: 16px; color: var(--muted); }
.pb-name:empty { display: none; }

.pb-copy {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.pb-copy:hover { background: var(--soft); }
.pb-copy .pb-i-check { display: none; }
.pb-copy.is-copied { border-color: #16a34a; color: #16a34a; }
.pb-copy.is-copied .pb-i-copy { display: none; }
.pb-copy.is-copied .pb-i-check { display: block; }

.pb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pb-chips li { padding: 5px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 500; }
.pb-chips li.pb-chip-plate { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }

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