:root {
    --accent: #0969da;
    --accent-dark: #0757b5;
    --text: #172033;
    --muted: #667085;
    --border: #d9e2ef;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --shadow: 0 20px 50px rgba(9, 105, 218, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: #ffffff;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.portal {
    min-height: calc(100vh - 52px);
    display: grid;
    place-items: center;
    padding: 28px 18px;
}

.panel {
    width: min(100%, 460px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 34px 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eaf3ff;
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 700;
}

h1 {
    margin: 18px 0 12px;
    font-size: 2rem;
    line-height: 1.12;
}

.plan {
    margin: 0;
    color: var(--muted);
    font-size: 1.08rem;
}

.price {
    margin: 24px 0;
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: 0;
}

.plan-list {
    display: grid;
    gap: 12px;
    margin: 24px 0 18px;
}

.plan-option {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.plan-option:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 28px rgba(9, 105, 218, 0.12);
    transform: translateY(-1px);
}

.plan-option strong,
.plan-option small {
    display: block;
}

.plan-option small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.plan-option b {
    color: var(--accent);
    font-size: 1.22rem;
    white-space: nowrap;
}

.plan-option.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.plan-option.loading {
    opacity: 0.7;
}

.buy-button,
.secondary-button {
    width: 100%;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.buy-button:hover,
.secondary-button:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.buy-button:disabled {
    cursor: not-allowed;
    background: #98a2b3;
    transform: none;
}

.secondary-button {
    margin-top: 18px;
}

.muted,
#status-message {
    color: var(--muted);
}

.voucher-code {
    margin: 22px 0 8px;
    padding: 18px;
    border: 2px dashed var(--accent);
    border-radius: 8px;
    background: #f6fbff;
    color: var(--text);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    word-break: break-word;
}

.notice {
    margin: 20px 0;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.notice.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.notice.success {
    background: #ecfdf3;
    color: #027a48;
}

.redeem-link {
    display: inline-flex;
    margin-top: 8px;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.redeem-link:hover {
    text-decoration: underline;
}

.redeem-form {
    display: grid;
    gap: 12px;
    margin-top: 22px;
    text-align: left;
}

.redeem-form label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.redeem-form input {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.redeem-form select {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 14px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.redeem-form input:focus {
    border-color: var(--accent);
    outline: 3px solid #dbeafe;
}

.code-output {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    max-height: 260px;
    overflow: auto;
    text-align: left;
}

.output-label {
    display: block;
    margin-top: 20px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    text-align: left;
}

.code-list {
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
    font: 700 1rem/1.55 Arial, Helvetica, sans-serif;
    resize: vertical;
}

.code-output code {
    display: block;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    white-space: normal;
    word-break: break-all;
}

.admin-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.secondary-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.secondary-link:hover {
    border-color: var(--accent);
    background: #f6fbff;
}

.code-table-wrap {
    margin-top: 18px;
    overflow-x: auto;
    text-align: left;
}

.code-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.code-table th,
.code-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.code-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.code-table code {
    font-weight: 800;
    word-break: normal;
}

.status-panel {
    min-height: 300px;
}

.spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto 20px;
    border: 5px solid #dbeafe;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.hidden {
    display: none;
}

footer {
    min-height: 52px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.9rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 380px) {
    .panel {
        padding: 28px 18px;
    }

    h1 {
        font-size: 1.72rem;
    }

    .price {
        font-size: 2.8rem;
    }
}
