/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background: #08090c;
    color: #f5f5f5;
    --card-bg: rgba(20, 21, 26, 0.88);
    --border-color: #292b32;
    --input-bg: #0d0e12;
    --text-muted: #8f939d;
    --text-dim: #737782;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 7px;
    --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.35),
        inset 0 1px rgba(255, 255, 255, 0.025);
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -10%, #24262d 0%, #0d0e12 40%, #08090c 70%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0 16px;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
    width: 100%;
    max-width: 720px;
    padding: 40px 0 30px;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(24px, 5vw, 28px);
    font-weight: 750;
    letter-spacing: -0.5px;
}

.logo span:first-child {
    font-size: clamp(22px, 4.5vw, 25px);
}

.subtitle {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: clamp(12px, 2.2vw, 14px);
}

/* ============================================================
   CARD
   ============================================================ */
.decoder-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: clamp(20px, 4vw, 28px);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================================
   INPUT SECTION
   ============================================================ */
.input-section label {
    display: block;
    font-size: clamp(12px, 2vw, 13px);
    font-weight: 650;
    color: #b8bbc3;
    margin-bottom: 9px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

#plateInput {
    flex: 1;
    min-width: 0;
    height: clamp(48px, 8vw, 52px);
    padding: 0 clamp(12px, 2vw, 16px);
    border-radius: var(--radius-sm);
    border: 1px solid #30323a;
    outline: none;
    background: var(--input-bg);
    color: #fff;
    font-size: clamp(14px, 2.6vw, 16px);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

#plateInput::placeholder {
    color: #555963;
}

#plateInput:focus {
    border-color: #666b78;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

#decodeBtn {
    height: clamp(48px, 8vw, 52px);
    padding: 0 clamp(18px, 3.5vw, 23px);
    border-radius: var(--radius-sm);
    background: #f2f2f2;
    color: #101114;
    font-weight: 750;
    font-size: clamp(14px, 2.4vw, 16px);
    transition: background 0.18s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

#decodeBtn:hover {
    background: #fff;
}

#decodeBtn:active {
    transform: scale(0.96);
}

/* ============================================================
   EXAMPLES
   ============================================================ */
.examples {
    margin-top: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    color: #676b75;
    font-size: clamp(11px, 2vw, 12px);
}

.examples span {
    flex-shrink: 0;
}

.examples button {
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    background: #17191e;
    color: #999da7;
    font-size: clamp(10px, 1.8vw, 11px);
    border: 1px solid #272930;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.examples button:hover {
    color: #fff;
    border-color: #444750;
}

.examples button:active {
    background: #23262e;
    transform: scale(0.96);
}

/* ============================================================
   ERROR
   ============================================================ */
.error {
    min-height: 20px;
    margin-top: 10px;
    color: #ff7070;
    font-size: clamp(12px, 2vw, 13px);
    word-break: break-word;
}

/* ============================================================
   RESULT
   ============================================================ */
.result {
    margin-top: 25px;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    animation: appear 0.25s ease;
}

.hidden {
    display: none !important;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.result-header>div:first-child {
    min-width: 0;
    flex: 1;
}

.result-label {
    font-size: clamp(9px, 1.6vw, 10px);
    color: var(--text-dim);
    font-weight: 750;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.result-header h2 {
    margin-top: 4px;
    font-size: clamp(22px, 5vw, 27px);
    letter-spacing: 0.5px;
    word-break: break-word;
}

.check {
    width: clamp(34px, 6vw, 38px);
    height: clamp(34px, 6vw, 38px);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #1d2b21;
    color: #74d693;
    font-weight: 700;
    font-size: clamp(16px, 3vw, 20px);
    flex-shrink: 0;
}

/* ============================================================
   RESULT GRID
   ============================================================ */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 1.8vw, 10px);
}

.result-item {
    padding: clamp(12px, 2.4vw, 16px);
    border-radius: var(--radius-sm);
    background: #101116;
    border: 1px solid #24262d;
    min-width: 0;
}

.result-item.full {
    grid-column: 1 / -1;
}

.result-item span {
    display: block;
    color: #747883;
    font-size: clamp(10px, 1.6vw, 11px);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.result-item strong {
    display: block;
    color: #e8e9ec;
    font-size: clamp(13px, 2.4vw, 14px);
    word-break: break-word;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    text-align: center;
    margin-top: 28px;
    color: #484b54;
    font-size: clamp(10px, 1.6vw, 11px);
    padding: 0 8px;
}

.footer-brand {
    color: #777b85;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.footer-credit strong {
    color: #999da7;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* --- Tablets & small laptops (≤ 768px) --- */
@media (max-width: 768px) {
    .container {
        padding: 32px 0 24px;
    }
    header {
        margin-bottom: 28px;
    }
    .decoder-card {
        padding: 22px;
    }
}

/* --- Large phones (≤ 550px) --- */
@media (max-width: 550px) {
    body {
        padding: 0 12px;
    }
    .container {
        padding: 24px 0 20px;
    }
    header {
        margin-bottom: 24px;
    }
    .decoder-card {
        padding: 16px;
        border-radius: 16px;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    #decodeBtn {
        width: 100%;
        justify-content: center;
        padding: 0 16px;
    }

    .result-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .result-item.full {
        grid-column: auto;
    }

    .result-header {
        margin-bottom: 16px;
    }
    .result-header h2 {
        font-size: 22px;
    }
    .check {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .examples {
        gap: 5px 6px;
    }
    .examples button {
        padding: 5px 8px;
        font-size: 10px;
    }

    footer {
        margin-top: 22px;
    }
}

/* --- Small phones (≤ 380px) --- */
@media (max-width: 380px) {
    body {
        padding: 0 8px;
    }
    .container {
        padding: 16px 0 16px;
    }
    .decoder-card {
        padding: 12px;
        border-radius: 14px;
    }
    #plateInput {
        height: 44px;
        font-size: 14px;
        padding: 0 10px;
    }
    #decodeBtn {
        height: 44px;
        font-size: 14px;
        padding: 0 12px;
    }
    .result-item {
        padding: 10px 12px;
    }
    .result-header h2 {
        font-size: 19px;
    }
    .check {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

/* --- Touch-friendly: increase tap target on touch devices --- */
@media (hover: none) and (pointer: coarse) {
    .examples button {
        padding: 8px 12px;
        min-height: 36px;
    }
    #decodeBtn {
        min-height: 52px;
    }
    #plateInput {
        min-height: 52px;
    }
}

@media (hover: none) and (pointer: coarse) and (max-width: 550px) {
    #decodeBtn {
        min-height: 48px;
    }
    #plateInput {
        min-height: 48px;
    }
    .examples button {
        padding: 6px 10px;
        min-height: 32px;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .result {
        animation: none;
    }
}

/* --- Dark mode fallback (already dark) --- */
/* --- Print styles --- */
@media print {
    body {
        background: #fff !important;
        color: #111 !important;
    }
    .decoder-card {
        background: #fff !important;
        border-color: #ccc !important;
        box-shadow: none !important;
    }
    #decodeBtn,
    .examples {
        display: none !important;
    }
    .result {
        border-top-color: #ccc !important;
    }
    .result-item {
        background: #f5f5f5 !important;
        border-color: #ddd !important;
    }
    .check {
        background: #e0f0e0 !important;
        color: #2a7a3a !important;
    }
    footer {
        color: #888 !important;
    }
    .footer-credit strong {
        color: #333 !important;
    }
}