:root {
    color-scheme: light;
    --shell-bg: #fdfdfd;
    --accent: #127475;
    --accent-soft: #d0f0ef;
    --text: #1c1c1c;
    --muted: #5c5c5c;
    --border: rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    background: radial-gradient(120% 120% at 10% 20%, #e6fbfb 0%, #f8f9fb 60%, #fefefe 100%);
    color: var(--text);
    display: flex;
    justify-content: center;
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.layout {
    width: fit-content;
    height: 100%;
    background: var(--shell-bg);
    border-radius: 24px;
    padding: 1rem;
    box-shadow: 0 25px 65px rgba(7, 27, 41, 0.08);
    border: 1px solid var(--border);
    display: flex;
    flex-flow: wrap;
}

header {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2rem;
}

header h1 {
    margin: 0 0 0.25rem;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 600;
}

header p {
    margin: 0;
    color: var(--muted);
    max-width: 640px;
}
/* 
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2rem;
    margin-top: 2rem;
} */

.grid {
    display: grid;
    gap: 1.5rem;
}

.sidebar {
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    background: white;
    box-shadow: 0 10px 30px rgba(18, 116, 117, 0.05);
}

.panel h2 {
    margin-top: 0;
    font-size: 1.3rem;
}

label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

select,
input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 1rem;
    font-family: inherit;
    background-color: #fefefe;
}

select:disabled,
input:disabled {
    background-color: #f5f5f5;
    color: var(--muted);
}

button {
    font-family: inherit;
    font-size: 1rem;
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.75rem;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

button:not(:disabled):hover {
    box-shadow: 0 10px 20px rgba(18, 116, 117, 0.25);
    transform: translateY(-2px);
}

.actions {
    margin: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ubigeo-mode {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ubigeo-mode legend {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0 0.35rem;
}

.chip-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.chip-radio input {
    margin: 0;
}

.chip-radio span {
    font-weight: 500;
}

.chip-radio input:checked + span {
    color: var(--accent);
}

.ubigeo-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.button-secondary {
    background: #e4e7eb;
    color: #1c1c1c;
    box-shadow: none;
}

.button-secondary:not(:disabled):hover {
    box-shadow: 0 4px 10px rgba(17, 27, 38, 0.1);
}

.status {
    margin: 1rem auto;
    font-size: 0.95rem;
    color: var(--muted);
}

.summary {
    min-width: 214px;
    margin-top: 1rem;
    border-radius: 12px;
    padding: 1rem;
    background: var(--accent-soft);
    color: #084142;
    border: 1px solid rgba(18, 116, 117, 0.2);
}

.summary strong {
    display: inline-block;
    min-width: 7rem;
}

.about-card,
.qr-card,
.endpoints-card {
    max-width: 90vw;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem;
    background: white;
    box-shadow: 0 10px 30px rgba(18, 116, 117, 0.05);
}

footer {
    margin: 2.5rem auto;
    text-align: center;
    width: 80vw;
}

.about-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.about-card h2 {
    margin-top: 0;
    font-size: 1.6rem;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    color: var(--muted);
}

.about-list li + li {
    margin-top: 0.5rem;
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: background 150ms ease;
}

.chip:hover {
    background: var(--accent-soft);
}

.qr-card h3 {
    margin-top: 0;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.qr-grid figure {
    margin: 0;
    text-align: center;
}

.qr-grid img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.qr-grid figcaption {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.qr-grid figure:hover img {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(18, 116, 117, 0.25);
}

.endpoints-card h3 {
    margin-top: 0;
}

.endpoint-code {
    text-align: left;
    background: #0c1c1f;
    color: #e5f4f5;
    border-radius: 14px;
    font-family: 'SFMono-Regular', 'Fira Code', 'Menlo', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.endpoints-card .endpoint-code {
    padding: 1.5rem 2rem;
}

.endpoint-code a {
    color: #5ad4ff;
    text-decoration: none;
    font-weight: 600;
}

.endpoint-code a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    main {
        padding: 1.5rem;
    }
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: column;
    }

    .qr-grid {
        justify-items: center;
    }
}
