:root {
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.header-brand {
    color: #6B7280;
    font-weight: 400;
}

.header-tagline {
    color: #9CA3AF;
    font-size: 0.85rem;
    font-weight: 400;
    margin-top: 4px;
    text-transform: uppercase;
}

.header-example {
    background: rgba(55, 65, 81, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 0.82rem;
    overflow-x: auto;
    white-space: nowrap;
    color: #D1D5DB;
}

.header-example-label {
    color: #6B7280;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.header-example code {
    font-family: 'Courier New', monospace;
}

.header-example ul {
    margin: 4px 0 0 18px;
    padding: 0;
    list-style: disc;
}

.grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

input, textarea {
    width: 100%;
    background: rgba(55, 65, 81, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(55, 65, 81, 0.7);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    font-family: 'Courier New', monospace;
    resize: none;
    min-height: 120px;
}

button {
    background: #10B981;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: #059669;
}

button.stop {
    background: #EF4444;
}

button.stop:hover {
    background: #DC2626;
}

#startBtnWrapper {
    display: inline-block;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #EF4444;
    color: #FCA5A5;
}

.alert-info {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3B82F6;
    color: #93C5FD;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #F59E0B;
    color: #FCD34D;
}

.trade-details h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
}

.detail-row {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.detail-label {
    color: #9CA3AF;
    display: block;
    margin-bottom: 4px;
}

.detail-value {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.divider {
    border-top: 1px solid #374151;
    margin: 16px 0;
    padding-top: 16px;
}

.pnl-large {
    font-size: 2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
}

.positive {
    color: #10B981;
}

.negative {
    color: #EF4444;
}

.chart-container {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-top: 20px;
}

.chart-container h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.chart-info {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #9CA3AF;
}

#chartCanvas {
    max-height: 400px;
}

.no-data {
    color: #6B7280;
}

.tip-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(180, 120, 60, 0.15);
    color: #c9a06c;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid rgba(180, 120, 60, 0.3);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.tip-button:hover {
    background: rgba(180, 120, 60, 0.25);
    border-color: rgba(180, 120, 60, 0.5);
    box-shadow: 0 4px 16px rgba(180, 120, 60, 0.2);
    color: #dbb88a;
}

@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.dots-animation {
    display: inline-block;
}
.dots-animation span {
    animation: dotPulse 1.4s infinite;
    opacity: 0;
}
.dots-animation span:nth-child(1) { animation-delay: 0s; }
.dots-animation span:nth-child(2) { animation-delay: 0.2s; }
.dots-animation span:nth-child(3) { animation-delay: 0.4s; }
.dots-animation span:nth-child(4) { animation-delay: 0.6s; }
.dots-animation span:nth-child(5) { animation-delay: 0.8s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .dots-animation span {
        animation: none;
        opacity: 1;
    }
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100;
    padding: 8px 16px;
    background: #1e293b;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
}
.skip-link:focus {
    top: 16px;
}

.trade-details-notes {
    margin-top: 16px;
    border-top: 1px solid #374151;
    padding-top: 16px;
}
.trade-details-notes label {
    font-size: 0.85rem;
    color: #9CA3AF;
}
.trade-details-notes input {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* Initially hidden elements — JS toggles visibility via element.style */
#stopBtn,
#errorAlert,
#warningAlert,
#statusAlert,
#debugInfo,
#chartContainer {
    display: none;
}

#debugInfo {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid #8B5CF6;
    color: #C4B5FD;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.noscript-content {
    padding: 2rem;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========================================
   COOKIE CONSENT BANNER
   ======================================== */

.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
    color: #D1D5DB;
}

.cookie-consent p {
    margin: 0;
}

.cookie-consent a {
    color: #93C5FD;
}

.cookie-consent-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.cookie-btn.accept {
    background: #10B981;
}

.cookie-btn.accept:hover {
    background: #059669;
}

.cookie-btn.decline {
    background: rgba(55, 65, 81, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #D1D5DB;
}

.cookie-btn.decline:hover {
    background: rgba(55, 65, 81, 0.9);
}

/* ========================================
   AD BANNER
   ======================================== */

.ad-banner-bottom {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px 0 8px;
    min-height: 106px;
}

@media (max-width: 768px) {
    .cookie-consent {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .ad-banner-bottom {
        min-height: 66px;
    }
}

/* ========================================
   SITE FOOTER
   ======================================== */

.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
}

.site-footer a {
    color: #6B7280;
    text-decoration: underline;
}

.site-footer a:hover {
    color: #9CA3AF;
}

.footer-sep {
    margin: 0 6px;
    color: #6B7280;
}

/* ========================================
   PRIVACY PAGE
   ======================================== */

.privacy-page h2 {
    font-size: 1.15rem;
    margin-top: 24px;
    margin-bottom: 8px;
}

.privacy-page p {
    margin-bottom: 12px;
    color: #D1D5DB;
    line-height: 1.7;
}

.privacy-page ul {
    margin: 0 0 12px 20px;
    color: #D1D5DB;
    line-height: 1.7;
}

.privacy-page a {
    color: #93C5FD;
}

.privacy-home-link {
    color: inherit;
    text-decoration: none;
}

.privacy-home-link:hover {
    color: #93C5FD;
}