:root {
    --bg-gradient: linear-gradient(135deg, #0f0f0f 0%, #232526 100%);
    --container-bg: rgba(26, 26, 26, 0.85);
    --text-main: #f0f0f0;
    --text-sub: #b2bec3;
    --input-border: #333;
    --accent: #e31837;
    --glass-border: rgba(255, 255, 255, 0.05);
    --card-shadow: rgba(0, 0, 0, 0.5);
    --transition-speed: 0.00s;
    --scale-green: #7fce9e;
    --scale-yellow: #ffdd57;
    --scale-red: #ef8f98;
    --scale-seam: #1c1c1c;
}

[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-main: #2d3436;
    --text-sub: #636e72;
    --input-border: #dfe6e9;
    --glass-border: rgba(0, 0, 0, 0.05);
    --card-shadow: rgba(0, 0, 0, 0.1);
    --scale-seam: #ffffff;
}

* {
    transition: background var(--transition-speed) ease-in-out,
                background-color var(--transition-speed) ease-in-out,
                border-color var(--transition-speed) ease-in-out,
                color var(--transition-speed) ease-in-out,
                box-shadow var(--transition-speed) ease-in-out;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    text-align: center;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--container-bg);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--card-shadow);
    z-index: 100;
    transition: background var(--transition-speed) ease;
}

.wrapper { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 480px; }

.container {
    background: var(--container-bg);
    padding: 40px;
    border-radius: 32px;
    box-shadow: 0 20px 50px var(--card-shadow);
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    transition: background var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -0.5px; }
.brand-by {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-sub);
    opacity: 0.55;
    vertical-align: super;
    margin-left: 6px;
    white-space: nowrap;
}
.subtitle { color: var(--text-sub); margin: 8px 0 25px 0; font-size: 14px; opacity: 0.8; }

/* --- PRICE KEY --- */
.price-scale { margin-bottom: 25px; }

.scale-labels { display: flex; padding: 0 2px; margin-bottom: 8px; }

.key-item { flex: 1 1 0; text-align: center; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.key-green { color: #2ecc71; }
.key-yellow { color: #f1c40f; }
.key-red { color: #e74c3c; }

.scale-bar {
    position: relative;
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(to right,
        var(--scale-green) 0%, var(--scale-green) calc(33.333% - 1.5px),
        var(--scale-seam) calc(33.333% - 1.5px), var(--scale-seam) calc(33.333% + 1.5px),
        var(--scale-yellow) calc(33.333% + 1.5px), var(--scale-yellow) calc(66.666% - 1.5px),
        var(--scale-seam) calc(66.666% - 1.5px), var(--scale-seam) calc(66.666% + 1.5px),
        var(--scale-red) calc(66.666% + 1.5px), var(--scale-red) 100%);
    overflow: visible;
}

.scale-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent);
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%);
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.input-group { 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; 
    margin-bottom: 25px; 
}

.currency-drop {
    position: relative;
    border: none;
    border-right: 2px solid var(--input-border);
    background: transparent;
    color: var(--text-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 6px 0 8px;
    height: 100%;
    align-self: center;
    flex: 0 0 auto;
    width: 44px;
    display: flex;
    align-items: center;
    user-select: none;
}

.currency-menu {
    display: none;
    position: fixed;
    background: var(--container-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 30px var(--card-shadow);
    backdrop-filter: blur(15px);
    overflow: hidden;
    z-index: 9999;
    min-width: 130px;
}

.currency-menu.open { display: block; }

.currency-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.currency-option:hover { background: rgba(227,24,55,0.12); }
.currency-option.active { color: var(--accent); }
.currency-option span { opacity: 0.9; }

.currency-symbol {
    font-size: 18px;
    font-weight: 700;
    padding-right: 6px;
    padding-left: 2px;
    user-select: none;
    flex: 0 0 auto;
    align-self: center;
}

.price-inner {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: 100%;
}



input {
    width: 100%;
    height: 100%;
    padding: 15px;
    border: 2px solid var(--input-border);
    border-radius: 18px;
    font-size: 18px;
    outline: none;
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
    box-sizing: border-box;
}

input:focus { border-color: var(--accent); }

.field-wrap { position: relative; height: 62px; width: 88%; }

.price-wrap {
    display: inline-flex;
    align-items: center;
    height: 34px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
    overflow: hidden;
    box-sizing: border-box;
    width: auto;
}

.sale-input::-webkit-input-placeholder { line-height: normal; }
.sale-input::-moz-placeholder { line-height: normal; }

.currency-symbol {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    font-weight: bold;
    font-size: 16px;
    padding-left: 10px;
    padding-right: 8px;
    height: 100%;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
}

.sale-input {
    border: none;
    outline: none;
    width: 100px;
    height: 100%;
    font-size: 18px;
    line-height: normal;
    background: transparent;
    color: var(--text-main);
    box-sizing: border-box;
    flex: 0 0 auto;
    padding: 0 15px 0 0;
    -webkit-appearance: none;
    appearance: none;
    align-self: center;
}

.label-group {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: 0.2s;
    text-align: left;
    padding-left: 28px;
}

.internal-label-main { font-size: 13px; color: var(--text-sub); white-space: nowrap; }
.internal-label-sub { font-size: 10px; color: var(--text-sub); opacity: 0.6; white-space: nowrap; margin-left: 4px; }

input:focus ~ .label-group, input:not(:placeholder-shown) ~ .label-group {
    opacity: 0; visibility: hidden;
}

.main-btn {
    width: 100%; padding: 20px; background: var(--accent); color: white;
    border: none; border-radius: 18px; cursor: pointer; font-weight: 800;
    font-size: 18px; transition: 0.2s;
}

.main-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.lucky-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.2s;
}
.lucky-btn:hover { opacity: 1; }

.price-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.currency-drop-standalone {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 10px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    box-sizing: border-box;
}
.lucky-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.site-footer {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}
.footer-social { margin-bottom: 8px; }
.footer-social a {
    display: inline-block;
    margin: 0 8px;
    color: var(--text-sub);
    opacity: 0.6;
    transition: opacity 0.2s;
}
.footer-social a:hover { opacity: 1; }
.footer-social svg { width: 18px; height: 18px; display: block; }
.footer-version { font-size: 11px; opacity: 0.35; font-weight: 600; letter-spacing: 0.5px; }

#result { margin-top: 30px; padding: 25px; border-radius: 24px; display: none; position: relative; }
#result.green { background-color: #d4edda !important; color: #155724; border: 2px solid #c3e6cb; }
#result.yellow { background-color: #fff3cd !important; color: #856404; border: 2px solid #ffeeba; }
#result.red { background-color: #f8d7da !important; color: #721c24; border: 2px solid #f5c6cb; }
#result.pending { background: var(--container-bg); border: 1px solid var(--glass-border); color: var(--text-main); }

@keyframes resultReveal {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#result.reveal { animation: resultReveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

.result-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 8px 0 2px 0;
}
.stat-chip {
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 3px 6px;
    margin: 2px;
    box-sizing: border-box;
}
.stat-value { font-size: 11px; font-weight: 700; white-space: nowrap; }
.stat-label { font-size: 7px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; opacity: 0.5; margin-top: 0px; white-space: nowrap; }

.name-search-results {
    margin-top: 14px;
    text-align: left;
}
.search-result-row {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: rgba(0,0,0,0.04);
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-row:hover { background: rgba(0,0,0,0.08); }
.search-result-row:active { background: rgba(0,0,0,0.12); }
.search-result-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255,255,255,0.6);
    margin-right: 12px;
    flex-shrink: 0;
}
.search-result-thumb-empty { background: rgba(0,0,0,0.08); }
.search-result-info { min-width: 0; }
.search-result-name {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-num { font-size: 10px; opacity: 0.55; font-weight: 600; margin-top: 2px; }

.set-img {
    width: 140px; height: auto; border-radius: 12px; margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); display: block; margin: 0 auto 15px auto;
}

.referral-actions { display: flex; gap: 8px; justify-content: center; margin-top: 15px; }
.referral-btn { flex: 1; padding: 13px 6px; border-radius: 12px; text-decoration: none; color: inherit; font-size: 12px; font-weight: 800; border: 1px solid rgba(0,0,0,0.15); background: rgba(0,0,0,0.06); white-space: nowrap; text-align: center; }

.support-link { display: inline-block; margin-top: 25px; color: var(--text-sub); text-decoration: none; font-size: 15px; font-weight: 700; opacity: 0.6; }

.leaderboard { margin-top: 40px; width: 100%; text-align: left; }
.leader-card {
    background: var(--container-bg); padding: 18px; margin-bottom: 12px; border-radius: 18px;
    display: flex; justify-content: space-between; border: 1px solid var(--glass-border);
    cursor: pointer; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background var(--transition-speed) ease;
}
.leader-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 20px var(--card-shadow);
    border-color: var(--accent);
}

.trend-badge {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #2ecc71;
    margin-right: 6px;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

.key-item { position: relative; cursor: default; }

.retired-badge {
    display: inline-block;
    line-height: 1;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.55;
    background: rgba(0,0,0,0.08);
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.key-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.key-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a1a;
}

[data-theme="light"] .key-tooltip { background: #2d3436; color: #f0f0f0; }
[data-theme="light"] .key-tooltip::after { border-top-color: #2d3436; }
.key-item:hover .key-tooltip { display: block; }
.key-item.show-tooltip .key-tooltip { display: block; }

/* --- INSTALL APP CARD --- */
.install-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(227, 24, 55, 0.06);
    border: 2px solid rgba(227, 24, 55, 0.18);
    border-radius: 20px;
    padding: 16px 18px;
    margin: 34px 0 20px 0;
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.install-icon-wrap {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-icon {
    width: 60px;
    height: 60px;
    background-color: var(--accent);
    -webkit-mask: url('/static/install_mobile.svg') no-repeat center / contain;
    mask: url('/static/install_mobile.svg') no-repeat center / contain;
}

.install-text {
    flex: 1 1 auto;
    text-align: left;
    min-width: 0;
}

.install-title {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.2px;
    color: var(--accent);
}

.install-desc {
    margin: 4px 0 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-sub);
}

.install-btn {
    flex: 0 0 auto;
    padding: 10px 20px;
    border-radius: 14px;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.2px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background 0.2s ease;
}

.install-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 20px var(--card-shadow);
    background: rgba(227, 24, 55, 0.08);
}

/* --- iOS "ADD TO HOME SCREEN" MODAL --- */
.ios-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: flex-end;
    justify-content: center;
}

.ios-modal-overlay.open { display: flex; }

.ios-modal {
    background: var(--container-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -10px 40px var(--card-shadow);
    padding: 28px 26px 30px 26px;
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
    position: relative;
    text-align: left;
    animation: iosModalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iosModalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ios-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(128, 128, 128, 0.15);
    color: var(--text-main);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ios-modal-title {
    margin: 0 30px 6px 0;
    font-size: 20px;
    font-weight: 900;
    color: var(--text-main);
}

.ios-modal-subtitle {
    margin: 0 0 22px 0;
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.5;
}

.ios-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.ios-step-num {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-step-text {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.5;
    padding-top: 2px;
}

.ios-share-icon {
    display: inline-flex;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    margin: 0 2px;
    color: var(--accent);
}

.ios-share-icon svg { width: 100%; height: 100%; }

.ios-modal-note {
    font-size: 11px;
    color: var(--text-sub);
    opacity: 0.75;
    line-height: 1.5;
    margin: 4px 0 22px 0;
    padding-top: 14px;
    border-top: 1px solid var(--glass-border);
}

.ios-modal-gotit {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 800;
    font-size: 15px;
}