:root {
    --bg: #070b14;
    --bg-2: #0c1220;
    --card: rgba(15, 23, 42, 0.85);
    --card-border: rgba(32, 201, 151, 0.2);
    --teal: #20c997;
    --teal-light: #33ffcc;
    --blue: #007bff;
    --text: #e8eef7;
    --muted: #94a3b8;
    --heading: #ffffff;
    --gradient: linear-gradient(135deg, #20c997 0%, #007bff 100%);
    --radius: 14px;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(32, 201, 151, 0.12) 0%, transparent 65%);
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.header {
    text-align: center;
    margin-bottom: 36px;
}

img.angadLogo {
    height: 85px;
    padding: 10px;
    display: inline-block;
}

.header a {
    text-decoration: none;
}

.header h1 {
    margin: 0 0 10px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--heading);
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0 auto;
    max-width: 520px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 820px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.panel-preview {
    min-width: 0;
}

.panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.panel h2 {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--heading);
}

.panel h3 {
    margin: 0 0 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
}

textarea,
select {
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    padding: 14px 16px;
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

textarea:focus,
select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.15);
}

.options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 20px 0 24px;
}

@media (max-width: 520px) {
    .options {
        grid-template-columns: 1fr;
    }
}

select {
    padding: 10px 12px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    color: #fff;
    background: var(--gradient);
    box-shadow: 0 8px 24px rgba(32, 201, 151, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 10px 28px rgba(32, 201, 151, 0.35);
}

.error-msg {
    margin: 14px 0 0;
    padding: 10px 14px;
    font-size: 0.88rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
}

.preview-area {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
}

.preview-placeholder-wrap,
.qr-frame {
    grid-area: 1 / 1;
    width: 100%;
    height: 100%;
}
.preview-placeholder-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
}
.preview-placeholder-wrap[hidden],
.qr-frame[hidden],
.qr-meta[hidden],
.download-section[hidden] {
    display: none !important;
}

.preview-hint {
    margin: 0;
    font-size: 0.95rem;
}

.preview-placeholder {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    color: rgba(32, 201, 151, 0.35);
}

.preview-placeholder svg {
    width: 100%;
    height: 100%;
}

.qr-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    line-height: 0;
    overflow: hidden;
}

#qr-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-meta {
    width: 100%;
    text-align: center;
    margin-top: 16px;
}

.qr-size-label {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: var(--teal);
    font-weight: 500;
}

.encoded-text {
    margin: 0;
    max-width: 100%;
    font-size: 0.82rem;
    color: var(--muted);
    word-break: break-all;
    text-align: center;
    line-height: 1.5;
}

.download-section {
    width: 100%;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.download-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 420px) {
    .download-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

.btn-download {
    padding: 11px 8px;
    color: var(--teal-light);
    background: rgba(32, 201, 151, 0.1);
    border: 1px solid rgba(32, 201, 151, 0.3);
}

.btn-download:hover {
    background: rgba(32, 201, 151, 0.2);
    box-shadow: 0 4px 14px rgba(32, 201, 151, 0.15);
}

.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.8;
}

.footer p {
    margin: 0;
}

.footer a {
    color: var(--teal);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}
