:root {
    --bg-deep: #05070d;
    --bg-panel: rgba(18, 22, 34, 0.65);
    --panel-strong: rgba(10, 13, 22, 0.7);
    --panel-soft: rgba(10, 13, 22, 0.55);
    --border-glass: rgba(255, 255, 255, 0.08);
    --grid-line: rgba(255, 255, 255, 0.025);
    --green: #0ecb81;
    --green-glow: rgba(14, 203, 129, 0.45);
    --red: #f6465d;
    --red-glow: rgba(246, 70, 93, 0.45);
    --gold: #f0b90b;
    --text-main: #e8ecf4;
    --text-dim: #8b97ab;
    --field-bg: rgba(255, 255, 255, 0.04);
    --radius: 18px;
}

:root[data-theme="light"] {
    --bg-deep: #eef1f6;
    --bg-panel: rgba(255, 255, 255, 0.75);
    --panel-strong: rgba(255, 255, 255, 0.75);
    --panel-soft: rgba(255, 255, 255, 0.6);
    --border-glass: rgba(15, 23, 42, 0.08);
    --grid-line: rgba(15, 23, 42, 0.04);
    --text-main: #1a2233;
    --text-dim: #66718a;
    --field-bg: rgba(15, 23, 42, 0.035);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

/* ---------- Animated background ---------- */
#chart-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.55;
    transition: opacity 0.25s ease;
}

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 20% 15%, rgba(14, 203, 129, 0.18), transparent 60%),
        radial-gradient(ellipse 55% 45% at 85% 85%, rgba(246, 70, 93, 0.15), transparent 60%),
        radial-gradient(ellipse 80% 80% at 50% 50%, rgba(240, 185, 11, 0.05), transparent 70%);
    transition: opacity 0.25s ease;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 40%, transparent 100%);
}

:root[data-theme="light"] #chart-bg {
    opacity: 0.22;
}

:root[data-theme="light"] .bg-glow {
    opacity: 0.6;
}

/* ---------- Top ticker bar ---------- */
.ticker-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.85rem 2rem;
    background: var(--panel-strong);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.ticker-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.brand .coin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #fcd535);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #1a1a1a;
    box-shadow: 0 0 18px rgba(240, 185, 11, 0.55);
    flex-shrink: 0;
}

.brand .name span {
    color: var(--green);
}

.price-ticker {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.price-ticker .pair {
    color: var(--text-dim);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.price-ticker .price {
    font-size: 1.25rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.price-ticker .price.up { color: var(--green); }
.price-ticker .price.down { color: var(--red); }

.price-ticker .change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
}

.change.up { color: var(--green); background: rgba(14, 203, 129, 0.12); }
.change.down { color: var(--red); background: rgba(246, 70, 93, 0.12); }

/* ---------- Layout ---------- */
.page {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.02) inset;
    padding: 2.5rem;
    animation: rise 0.6s ease both;
}

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

.auth-card h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-card h1 .accent {
    background: linear-gradient(135deg, var(--green), #4dffb4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-card .subtitle {
    color: var(--text-dim);
    font-size: 0.92rem;
    margin-bottom: 2rem;
}

.field {
    margin-bottom: 1.2rem;
}

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 0.45rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .icon {
    position: absolute;
    left: 14px;
    color: var(--text-dim);
    font-size: 1rem;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.6rem;
    background: var(--field-bg);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap input::placeholder {
    color: var(--text-dim);
    opacity: 0.8;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--green);
    background: rgba(14, 203, 129, 0.06);
    box-shadow: 0 0 0 4px var(--green-glow);
}

.toggle-pass {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    letter-spacing: 0.5px;
}

.toggle-pass:hover { color: var(--text-main); }

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.4rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-wrap input {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
}

.row-between a {
    color: var(--green);
    text-decoration: none;
}

.row-between a:hover { text-decoration: underline; }

.btn-primary {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--green), #0aa86b);
    color: #06140d;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 24px var(--green-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px var(--green-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.6rem 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.footer-link {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.footer-link a {
    color: var(--green);
    font-weight: 600;
    text-decoration: none;
}

.footer-link a:hover { text-decoration: underline; }

.alert {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 1.2rem;
    border: 1px solid transparent;
}

.alert.show { display: block; animation: rise 0.3s ease both; }

.alert.error {
    background: rgba(246, 70, 93, 0.1);
    border-color: rgba(246, 70, 93, 0.35);
    color: #ff8c98;
}

.alert.success {
    background: rgba(14, 203, 129, 0.1);
    border-color: rgba(14, 203, 129, 0.35);
    color: #6ff0bb;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .two-col { grid-template-columns: 1fr; }
    .auth-card { padding: 1.8rem; }
    .ticker-bar { padding: 0.75rem 1rem; }
    .brand .name { font-size: 0.95rem; }
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(6, 20, 13, 0.3);
    border-top-color: #06140d;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    animation: spin 0.7s linear infinite;
}

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

/* ---------- Theme toggle ---------- */
.theme-toggle {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: var(--field-bg);
    color: var(--text-main);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.3s ease, background 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--green);
    transform: rotate(18deg);
}

/* ============ Footer ============ */
.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border-glass);
    background: var(--panel-soft);
    backdrop-filter: blur(14px);
    padding: 3rem 2rem 1.5rem;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.footer-brand .brand { margin-bottom: 0.9rem; }

.footer-brand p {
    color: var(--text-dim);
    font-size: 0.88rem;
    line-height: 1.7;
    max-width: 340px;
    margin-bottom: 1.2rem;
}

.footer-social {
    display: flex;
    gap: 0.6rem;
}

.footer-social a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.05rem;
    color: var(--text-main);
    transition: border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.footer-social a:hover {
    border-color: var(--green);
    color: var(--green);
    transform: translateY(-3px);
}

.footer-col h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--text-main);
    margin-bottom: 1.1rem;
    font-weight: 800;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.footer-col a, .footer-col span.soon, .footer-col button {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    text-align: left;
}

.footer-col a:hover, .footer-col button:hover { color: var(--green); }

.footer-col span.soon {
    cursor: default;
    opacity: 0.6;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.footer-bottom .footer-disclaimer {
    max-width: 600px;
    text-align: right;
}

@media (max-width: 900px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: span 2; }
}

@media (max-width: 560px) {
    .footer-top { grid-template-columns: 1fr; }
    .footer-brand { grid-column: span 1; }
    .footer-bottom { flex-direction: column; align-items: flex-start; text-align: left; }
    .footer-bottom .footer-disclaimer { text-align: left; }
}
