/* Gift Card Redemption - Professional, clean UI */
:root {
    --bg: #0f0f12;
    --bg-card: #18181c;
    --bg-input: #222228;
    --border: #2e2e36;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --font-sans: 'DM Sans', 'Noto Sans SC', system-ui, sans-serif;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.5;
}

body.claim-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem 2rem;
}

.page {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* Header */
.header {
    padding: 1.5rem 0;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.lang-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lang-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.lang-select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
}
.lang-select:hover,
.lang-select:focus {
    border-color: var(--primary);
    outline: none;
}

/* Main */
.main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.subtitle {
    margin: 0 0 1.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}

/* Steps indicator */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.step.active .step-num {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.step.done .step-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.step-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.step.active .step-label {
    color: var(--text);
}
.step-line {
    width: 24px;
    height: 2px;
    background: var(--border);
    margin: 0 2px;
    margin-bottom: 1.1rem;
}

/* Panels */
.panel {
    display: none;
}
.panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.field-row {
    flex-direction: row;
    align-items: stretch;
    gap: 0.5rem;
}
.field-row .input {
    flex: 1;
    min-width: 0;
}
.label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}
.input::placeholder {
    color: var(--text-muted);
}
.input:hover {
    border-color: #3f3f46;
}
.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.input-code {
    max-width: 8rem;
}

/* Stripe Element container */
.stripe-input {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.stripe-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.StripeElement {
    padding: 0;
}

.input-error {
    font-size: 0.8rem;
    color: var(--error);
    min-height: 1.2em;
}

.stripe-notice {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.stripe-notice p { margin: 0; }

/* Buttons */
.btn {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-block {
    width: 100%;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    text-decoration: none;
    margin-top: 0.5rem;
}
.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Success panel */
.success-box {
    text-align: center;
    padding: 0.5rem 0;
}
.success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}
.success-title {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
}
.success-msg {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.code-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
.code-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}
.code-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.code-value {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--primary);
    background: none;
    border: none;
    padding: 0;
    flex: 1;
    min-width: 0;
}

/* Footer */
.footer {
    margin-top: 2rem;
    text-align: center;
}
.footer p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== Portal (Amazon-style homepage) ========== */
:root {
    --portal-header-bg: #131921;
    --portal-header-text: #fff;
    --portal-hero-bg: #232f3e;
    --portal-bg: #e8eef2;
    --portal-card-bg: #fff;
    --portal-cta: #ff9900;
    --portal-cta-hover: #e88b00;
    --portal-text: #111;
    --portal-text-muted: #565959;
}

body.portal-page {
    background: var(--portal-bg);
    color: var(--portal-text);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.portal-header {
    width: 100%;
    background: var(--portal-header-bg);
    color: var(--portal-header-text);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.portal-header-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
@media (min-width: 768px) {
    .portal-header-inner { padding: 0 1.5rem; gap: 2rem; }
}

.portal-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}
.portal-logo:hover {
    color: #ffd166;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.portal-nav-item {
    padding: 0.5rem 0.75rem;
    color: rgba(255,255,255,0.92);
    font-size: 0.95rem;
    text-decoration: none;
}
.portal-nav-item.active {
    font-weight: 600;
    color: #fff;
}

.portal-header-right {
    margin-left: auto;
}
.portal-lang {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: inherit;
}
.portal-lang:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

.portal-hero {
    background: linear-gradient(145deg, #1a3a52 0%, #232f3e 40%, #131921 100%);
    color: #fff;
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
@media (min-width: 768px) {
    .portal-hero { padding: 3rem 1.5rem; }
}
.portal-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.6;
}
.portal-hero-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}
@media (min-width: 768px) {
    .portal-hero-inner { padding: 0 1.5rem; }
}
.portal-hero-title {
    margin: 0 0 0.6rem;
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.portal-hero-subtitle {
    margin: 0;
    font-size: 1.05rem;
    opacity: 0.95;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.portal-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
    flex: 1;
}
@media (min-width: 768px) {
    .portal-main { padding: 2.25rem 1.5rem 3.5rem; }
}
.portal-section-title {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--portal-text);
    letter-spacing: -0.01em;
}
@media (min-width: 768px) {
    .portal-section-title { font-size: 1.4rem; margin-bottom: 1.75rem; }
}

/* 响应式网格：手机 1 列，小屏 2 列，平板 3 列，PC 4 列 */
.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 480px) {
    .portal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}
@media (min-width: 768px) {
    .portal-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }
}
@media (min-width: 1024px) {
    .portal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.portal-card {
    background: var(--portal-card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.06);
    min-width: 0;
}
.portal-card:hover {
    box-shadow: 0 12px 28px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-4px);
}

.portal-card-image {
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #f0f0f0;
}
.portal-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 无图片时的占位 */
.portal-card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

.portal-card-body {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.portal-card-title {
    margin: 0 0 0.4rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--portal-text);
    line-height: 1.3;
}
.portal-card-desc {
    margin: 0 0 0.6rem;
    font-size: 0.875rem;
    color: var(--portal-text-muted);
    line-height: 1.45;
    flex: 1;
}
.portal-card-amount {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--portal-cta);
}
.portal-btn-claim {
    display: inline-block;
    text-align: center;
    padding: 0.7rem 1.1rem;
    background: linear-gradient(180deg, #ffb84d 0%, var(--portal-cta) 100%);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(255,153,0,0.35);
}
.portal-btn-claim:hover {
    background: linear-gradient(180deg, #ffc266 0%, var(--portal-cta-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255,153,0,0.4);
}

.portal-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--portal-text-muted);
}

.portal-footer {
    width: 100%;
    background: var(--portal-header-bg);
    color: rgba(255,255,255,0.85);
    padding: 1.25rem 1rem;
    margin-top: auto;
}
@media (min-width: 768px) {
    .portal-footer { padding: 1.5rem 1.5rem; }
}
.portal-footer-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}
.portal-footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* Claim flow on portal-style: keep compact card look when inside portal (optional) */
body.claim-page .page.claim-flow {
    max-width: 440px;
}
body.claim-page .claim-header .logo-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.35rem;
}
body.claim-page .claim-header .logo-link:hover {
    color: var(--primary);
}
