/* ============================================================
   MAIN STYLES - Genshin Impact Wish Simulator
   Based on actual Genshin wish screen layout
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --genshin-dark: #0b0e1a;
    --genshin-blue: #1a1f3a;
    --genshin-purple: #2d1b4e;
    --genshin-gold: #e8a630;
    --genshin-gold-light: #ffd700;
    --genshin-text: #e8e4dc;
    --genshin-text-dim: #8b8680;
    --genshin-cream: #ece5d8;
    --star-3-color: #5c82a8;
    --star-4-color: #b487d0;
    --star-5-color: #e8a630;
    --star-6-color: #ff69b4;
    --font-display: 'Cinzel Decorative', 'Georgia', serif;
    --font-ui: 'Noto Sans', 'Segoe UI', sans-serif;
    --banner-accent: #c3a2f0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--genshin-dark);
    color: var(--genshin-text);
    font-family: var(--font-ui);
    user-select: none;
    -webkit-user-select: none;
}

.hidden { display: none !important; }

/* --- App Container --- */
.app {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- Background --- */
.wish-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.wish-bg canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.wish-bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 60% 40%, rgba(150, 180, 220, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 60%, rgba(180, 160, 230, 0.12) 0%, transparent 40%),
        linear-gradient(180deg, rgba(130, 170, 210, 0.08) 0%, rgba(11, 14, 26, 0.6) 100%);
    pointer-events: none;
}

/* ========== TOP BAR ========== */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    height: 64px;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wish-star-icon {
    font-size: 22px;
    color: var(--genshin-gold);
    filter: drop-shadow(0 0 6px rgba(232, 166, 48, 0.6));
}

.wish-title {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 600;
    color: var(--genshin-cream);
    letter-spacing: 1px;
}

/* --- Banner Tabs (portrait style like Genshin) --- */
.banner-tabs {
    display: flex;
    gap: 6px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.banner-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px 10px 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 68px;
    position: relative;
}

.banner-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.banner-tab.active {
    background: rgba(232, 166, 48, 0.12);
    border-color: var(--genshin-gold);
    box-shadow: 0 0 12px rgba(232, 166, 48, 0.2);
}

.banner-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--genshin-gold);
    border-radius: 2px;
}

.tab-portrait {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3a2570 0%, #7a50b0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tab-portrait-standard {
    background: linear-gradient(135deg, #1a4070 0%, #5090c0 100%);
}

.tab-portrait-icon {
    font-size: 24px;
}

.tab-label {
    font-size: 10px;
    color: var(--genshin-text-dim);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.banner-tab.active .tab-label {
    color: var(--genshin-gold);
}

/* --- Top Right --- */
.top-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 14px;
}

.currency-icon { font-size: 16px; }
.currency-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--genshin-cream);
}

.icon-btn {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* ========== BANNER AREA ========== */
.banner-area {
    position: absolute;
    inset: 64px 24px 80px 24px;
    z-index: 5;
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* --- Left Info Card (semi-transparent panel like Genshin) --- */
.banner-info-card {
    flex: 0 0 380px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 6;
    align-self: center;
    max-height: 420px;
    transition: all 0.4s ease;
}

.banner-type-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #a8d8a0;
    font-weight: 700;
    background: rgba(100, 200, 100, 0.12);
    padding: 3px 10px;
    border-radius: 4px;
    width: fit-content;
}

.banner-name {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--genshin-cream);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    line-height: 1.2;
}

.banner-prob-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--genshin-cream);
    margin-top: 4px;
}

.banner-highlight-box {
    background: rgba(66, 165, 245, 0.15);
    border: 1px solid rgba(66, 165, 245, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #b8d4f0;
}

.highlight-diamond {
    color: #42a5f5;
    margin-right: 4px;
}

.banner-sub-text {
    font-size: 11px;
    color: var(--genshin-text-dim);
    line-height: 1.5;
}

.banner-timer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.timer-label {
    font-size: 11px;
    color: var(--genshin-text-dim);
    font-weight: 600;
}

.timer-value {
    font-size: 12px;
    color: var(--genshin-cream);
}

/* Featured characters in info card */
.banner-featured {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.featured-5star,
.featured-4star {
    display: flex;
    align-items: center;
    gap: 8px;
}

.star-badge {
    font-size: 9px;
    letter-spacing: -1px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    white-space: nowrap;
}

.star-badge.star-5 {
    color: var(--star-5-color);
    background: rgba(232, 166, 48, 0.15);
    border: 1px solid rgba(232, 166, 48, 0.3);
}

.star-badge.star-4 {
    color: var(--star-4-color);
    background: rgba(180, 135, 208, 0.15);
    border: 1px solid rgba(180, 135, 208, 0.3);
}

.featured-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--genshin-cream);
}

.up-badge {
    font-size: 10px;
    font-weight: 700;
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.15);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.featured-names {
    font-size: 12px;
    color: var(--genshin-text-dim);
}

/* --- Banner Artwork (Center/Right) --- */
.banner-artwork {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.banner-character {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-silhouette {
    position: relative;
}

.char-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}

.char-icon-large {
    font-size: 140px;
    filter: drop-shadow(0 0 60px var(--banner-accent));
    animation: float 4s ease-in-out infinite;
    transition: filter 0.4s ease;
}

.char-name-tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.char-up-badge {
    font-size: 12px;
    font-weight: 700;
    color: #ff6b35;
    position: absolute;
    top: -4px;
    right: -40px;
    background: rgba(255, 107, 53, 0.2);
    padding: 1px 8px;
    border-radius: 4px;
}

.char-name-large {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--genshin-cream);
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
    letter-spacing: 2px;
}

.char-stars-row {
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--star-5-color);
    text-shadow: 0 0 8px rgba(232, 166, 48, 0.5);
}

.char-title {
    font-size: 13px;
    color: var(--genshin-text-dim);
    letter-spacing: 1px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========== BOTTOM BAR ========== */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: linear-gradient(0deg, rgba(11, 14, 26, 0.9) 0%, rgba(11, 14, 26, 0.5) 60%, transparent 100%);
}

.bottom-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 14px;
}

.pill-icon { font-size: 15px; color: var(--genshin-gold); }
.pill-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--genshin-cream);
}

.btn-bottom {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 16px;
    color: var(--genshin-text-dim);
    font-family: var(--font-ui);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-bottom:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--genshin-cream);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-bottom-icon {
    font-size: 10px;
    color: var(--genshin-gold);
}

.bottom-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- Pity Info --- */
.pity-info {
    display: flex;
    gap: 10px;
}

.pity-item {
    font-size: 11px;
    color: var(--genshin-text-dim);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 4px;
}

/* --- Wish Buttons --- */
.wish-buttons {
    display: flex;
    gap: 10px;
}

.btn-wish {
    background: linear-gradient(135deg, rgba(232, 166, 48, 0.1) 0%, rgba(232, 166, 48, 0.02) 100%);
    border: 2px solid rgba(232, 166, 48, 0.35);
    border-radius: 24px;
    padding: 10px 28px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-wish::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(232, 166, 48, 0.12) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-wish:hover {
    border-color: var(--genshin-gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 166, 48, 0.15);
}

.btn-wish:hover::before { opacity: 1; }

.btn-wish:active { transform: translateY(0); }

.btn-wish.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.wish-btn-label {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: var(--genshin-gold);
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.wish-btn-cost {
    font-size: 11px;
    color: var(--genshin-text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.fate-mini-icon {
    color: var(--genshin-gold);
    font-size: 13px;
}

/* ========== OVERLAYS ========== */
.result-overlay,
.modal-overlay,
.finale-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-overlay {
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.result-click-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.3);
    animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* --- Modal --- */
.modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
}

.modal-content {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1225 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--genshin-gold);
}

.btn-close {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--genshin-text-dim);
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 20px 24px;
}

/* History table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--genshin-text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-table td {
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Details modal */
.details-body { display: flex; flex-direction: column; gap: 20px; }

.details-section h3 {
    font-size: 14px;
    color: var(--genshin-gold);
    margin-bottom: 10px;
    font-weight: 600;
}

.details-items { display: flex; flex-direction: column; gap: 6px; }

.details-rates {
    list-style: none;
    font-size: 13px;
    color: var(--genshin-text-dim);
    line-height: 1.8;
}

.details-rates li::before {
    content: '•';
    color: var(--genshin-gold);
    margin-right: 8px;
}

/* Banner transition */
.banner-area.switching .banner-info-card,
.banner-area.switching .banner-artwork {
    animation: banner-switch 0.4s ease;
}

@keyframes banner-switch {
    0% { opacity: 1; transform: translateX(0); }
    50% { opacity: 0; transform: translateX(-20px); }
    51% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   STATS MODAL
   ============================================================ */
.stats-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-display);
}

.stat-value.val-5 { color: var(--star-5-color); }
.stat-value.val-4 { color: var(--star-4-color); }
.stat-value.val-3 { color: var(--star-3-color); }
.stat-value.val-total { color: var(--genshin-gold-light); }

.stat-label {
    font-size: 11px;
    color: var(--genshin-text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-section h3 {
    font-size: 14px;
    color: var(--genshin-gold);
    margin-bottom: 10px;
    font-weight: 600;
}

.stats-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.collection-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.collection-item.rarity-5 {
    background: rgba(232, 166, 48, 0.12);
    border-color: rgba(232, 166, 48, 0.3);
    color: var(--star-5-color);
}

.collection-item.rarity-4 {
    background: rgba(180, 135, 208, 0.1);
    border-color: rgba(180, 135, 208, 0.25);
    color: var(--star-4-color);
}

.collection-count {
    font-weight: 700;
    opacity: 0.7;
    font-size: 11px;
}

.stats-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 6px;
}

.stats-bar-label {
    width: 30px;
    text-align: right;
    font-weight: 600;
}

.stats-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.stats-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.stats-bar-fill.bar-5 { background: var(--star-5-color); }
.stats-bar-fill.bar-4 { background: var(--star-4-color); }
.stats-bar-fill.bar-3 { background: var(--star-3-color); }

.stats-bar-pct {
    width: 45px;
    text-align: right;
    color: var(--genshin-text-dim);
    font-size: 12px;
}

/* ============================================================
   PASSWORD LOCK SCREEN
   ============================================================ */
.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #0b0e1a 0%, #1a1040 40%, #0b0e1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.lock-screen.hidden {
    display: none;
}

.lock-screen.lock-fade-out {
    opacity: 0;
    pointer-events: none;
}

.lock-box {
    text-align: center;
    padding: 40px 50px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
    min-width: 320px;
}

.lock-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.lock-title {
    font-family: 'Cinzel Decorative', serif;
    color: #e4dcc8;
    font-size: 24px;
    margin-bottom: 6px;
}

.lock-subtitle {
    color: rgba(255,255,255,0.45);
    font-size: 14px;
    margin-bottom: 24px;
}

.lock-input-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.lock-input {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 10px 16px;
    color: #e4dcc8;
    font-size: 16px;
    width: 220px;
    outline: none;
    transition: border-color 0.2s;
}

.lock-input:focus {
    border-color: rgba(200,170,110,0.6);
}

.lock-input::placeholder {
    color: rgba(255,255,255,0.25);
}

.lock-btn {
    background: linear-gradient(135deg, #c8aa6e, #a08040);
    border: none;
    border-radius: 8px;
    color: #1a1040;
    font-size: 20px;
    font-weight: bold;
    width: 44px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.lock-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.lock-error {
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

.lock-error.shake {
    animation: lock-shake 0.4s ease;
}

@keyframes lock-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}
