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

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface2: #1e1e1e;
    --border: #2a2a2a;
    --text: #f5f5f5;
    --text-muted: #888;
    --blue: #4f8cff;
    --cyan: #25f4ee;
    --gradient: linear-gradient(135deg, #2563eb, #4f8cff 52%, #25d9d2);
    --radius: 16px;
}

[hidden] { display: none !important; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.tool-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.tool-logo-icon {
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--gradient);
    color: white;
    font-size: 25px;
    line-height: 1;
}

.tool-logo-text { font-size: 18px; font-weight: 700; }
.tool-logo-text span { color: var(--cyan); }

.tool-header-actions { display: flex; align-items: center; gap: 1.1rem; }

.language-switcher { display: flex; gap: 0.35rem; }

.lang-btn {
    min-width: 36px;
    padding: 0.36rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
}

.lang-btn.active { border-color: var(--blue); background: rgba(79, 140, 255, 0.14); color: #9bc0ff; }

.back-link {
    color: var(--text-muted);
    font-size: 0.83rem;
    text-decoration: none;
}

.back-link:hover, .tool-footer a:hover { color: var(--text); }

.postal-page {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 24px 40px;
    flex: 1;
}

.postal-hero { margin-bottom: 34px; text-align: center; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 18px;
    padding: 5px 12px;
    border: 1px solid rgba(79, 140, 255, 0.3);
    border-radius: 20px;
    background: rgba(79, 140, 255, 0.12);
    color: #8db5ff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.postal-hero h1 {
    margin-bottom: 14px;
    font-size: clamp(30px, 5vw, 46px);
    font-weight: 800;
    line-height: 1.15;
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.postal-hero p {
    max-width: 490px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}

.postal-card, .step, .feature {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.postal-card { margin-bottom: 32px; padding: 24px; }

.postal-label {
    display: block;
    margin-bottom: 10px;
    color: #e8e8e8;
    font-size: 14px;
    font-weight: 600;
}

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

.postal-input {
    min-width: 0;
    min-height: 52px;
    flex: 1;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.postal-input::placeholder { color: var(--text-muted); }
.postal-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12); }

.postal-submit {
    flex-shrink: 0;
    min-height: 52px;
    padding: 13px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--gradient);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15px;
    transition: opacity 0.2s, transform 0.1s;
}

.postal-submit:hover { opacity: 0.9; }
.postal-submit:active { transform: scale(0.99); }
.postal-submit:disabled, .postal-location-button:disabled { cursor: wait; opacity: 0.55; }

.postal-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 17px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.postal-divider::before, .postal-divider::after { height: 1px; flex: 1; background: var(--border); content: ""; }

.postal-location-button {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.postal-location-button > span:first-child { color: var(--cyan); font-size: 21px; line-height: 1; }
.postal-location-button:hover { border-color: var(--cyan); color: var(--cyan); }

.postal-privacy {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
    text-align: center;
}

.postal-status {
    margin-top: 14px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface2);
    color: #c7c7c7;
    font-size: 13px;
    text-align: center;
}

.postal-status[data-kind="error"] {
    border-color: rgba(254, 44, 85, 0.3);
    background: rgba(254, 44, 85, 0.08);
    color: #ff8585;
}

.postal-status[data-kind="loading"] { display: flex; align-items: center; justify-content: center; gap: 11px; color: #a7c6ff; }
.postal-status[data-kind="loading"]::before { width: 17px; height: 17px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; content: ""; }
@keyframes spin { to { transform: rotate(360deg); } }

.postal-results {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.postal-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface2);
}

.postal-result h2 { font-size: 14px; font-weight: 600; line-height: 1.4; }
.postal-result p { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.postal-result-code {
    min-width: 126px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
    text-align: right;
}

.postal-result-code span {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.postal-result-code strong { display: block; margin-top: 3px; color: var(--cyan); font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.postal-result-code.is-empty strong { color: var(--text-muted); font-size: 11px; font-weight: 500; }

.how-to { margin-bottom: 32px; }

.section-label {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { padding: 20px 16px; text-align: center; }

.step-num {
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.step h3, .feature h3 { margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.step p, .feature p { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 4px; }
.feature { display: flex; align-items: flex-start; gap: 12px; padding: 16px; }
.feature-icon { flex-shrink: 0; font-size: 21px; }
.feature h3 { margin-bottom: 4px; }

.tool-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}

.tool-footer a { color: var(--text-muted); text-decoration: none; }
.footer-separator { padding: 0 5px; }

@media (max-width: 600px) {
    .steps, .features { grid-template-columns: 1fr; }
    .tool-header { padding: 15px 18px; }
    .postal-page { padding: 38px 18px 32px; }
}

@media (max-width: 430px) {
    .tool-header-actions { gap: 0.55rem; }
    .back-link { max-width: 90px; text-align: right; }
    .postal-card { padding: 18px; }
    .postal-input-row { flex-direction: column; }
    .postal-submit { width: 100%; }
    .postal-result { grid-template-columns: 1fr; gap: 10px; }
    .postal-result-code { padding: 10px 0 0; border-top: 1px solid var(--border); border-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
