@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

body {
    background-image:
        radial-gradient(at 20% 10%, rgba(91, 141, 239, 0.08) 0, transparent 45%),
        radial-gradient(at 80% 90%, rgba(167, 139, 250, 0.08) 0, transparent 45%);
    background-attachment: fixed;
}

.chart-card {
    background: linear-gradient(145deg, rgba(18, 26, 51, 0.9), rgba(18, 26, 51, 0.6));
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 1rem;
    padding: 1.5rem 1.25rem 1rem 1.25rem;
    backdrop-filter: blur(12px);
    transition: border-color 0.2s, transform 0.2s;
}
.chart-card:hover {
    border-color: rgba(91, 141, 239, 0.4);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    padding-left: 0.25rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.freq-toggle {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.freq-toggle button {
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.freq-toggle button:hover:not(:disabled):not(.active) {
    color: #e2e8f0;
    background: rgba(71, 85, 105, 0.3);
}
.freq-toggle button.active {
    background: linear-gradient(135deg, #5b8def, #a78bfa);
    color: white;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.3);
}
.freq-toggle button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    display: inline-block;
}

.chart-body {
    width: 100%;
    height: 340px;
}

@media (min-width: 1280px) {
    .chart-body { height: 360px; }
}

/* peer table */
.peer-table {
    display: flex;
    flex-direction: column;
}
.peer-row {
    display: grid;
    grid-template-columns: 1fr 110px 90px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.55rem 0.25rem;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(71,85,105,0.15);
    transition: background 0.15s;
}
.peer-row:last-child { border-bottom: none; }
.peer-row:not(.peer-header):hover { background: rgba(91,141,239,0.06); }
.peer-header {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.4rem;
}
.peer-target {
    background: linear-gradient(90deg, rgba(91,141,239,0.12), rgba(91,141,239,0));
    border-left: 2px solid #5b8def;
    padding-left: 0.75rem;
    margin-left: -0.75rem;
    font-weight: 600;
    color: #e2e8f0;
}

/* Safety Score */
.score-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: center;
}
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.5s ease;
}
.score-inner {
    width: 95px;
    height: 95px;
    background: #0b1020;
    border-radius: 9999px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.score-item { font-size: 0.8rem; }
.score-bar {
    height: 5px;
    background: rgba(71,85,105,0.2);
    border-radius: 3px;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Risk metrics */
.risk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.risk-cell {
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(71,85,105,0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

/* Valuation rows */
.val-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(71,85,105,0.2);
    border-radius: 0.75rem;
    transition: border-color 0.2s;
}
.val-row > div:first-child { flex: 0 0 140px; }
.val-row.undervalued { border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.05); }
.val-row.overvalued { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.04); }

/* Sliders */
input[type="range"] {
    height: 6px;
    background: rgba(71,85,105,0.3);
    border-radius: 3px;
    appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #5b8def;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(91,141,239,0.4);
}

/* Navigation tabs */
[x-cloak] { display: none !important; }
.nav-tab-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.nav-tab { color: #94a3b8; }
.nav-tab:hover { color: #e2e8f0; background: rgba(71,85,105,0.1); }
.nav-tab-active {
    color: #5b8def;
    border-bottom-color: #5b8def;
    background: linear-gradient(180deg, rgba(91,141,239,0.08), transparent);
}

/* Compare page */
.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(71,85,105,0.3);
    border-radius: 9999px;
    font-size: 0.85rem;
}
.compare-chip button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
}
.compare-table-wrap { overflow-x: auto; }
.compare-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}
.compare-table th, .compare-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(71,85,105,0.15);
}
.compare-table th { font-size: 0.7rem; color: #94a3b8; font-weight: 500; }

/* Market dashboard */
.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.market-card {
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(71,85,105,0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: border-color 0.2s;
}
.market-card:hover { border-color: rgba(91,141,239,0.4); }
.market-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.market-changes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    font-size: 0.75rem;
}
.market-changes > div { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: ui-monospace, monospace; }
.spark { height: 40px; }

.market-mini-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}
.market-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: rgba(15,23,42,0.4);
    border: 1px solid rgba(71,85,105,0.15);
    border-radius: 0.5rem;
}

.event-list { display: flex; flex-direction: column; gap: 0.25rem; }
.event-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.event-row:hover { background: rgba(91,141,239,0.08); }

/* Quant score cards */
.qs-card {
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(71,85,105,0.2);
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
}

/* 52W Gauge */
.week52-bar {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #3b82f6, #fbbf24, #f87171);
    border-radius: 9999px;
    overflow: visible;
}
.week52-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: rgba(255,255,255,0.05);
    border-radius: 9999px;
}
.week52-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 18px;
    background: white;
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255,255,255,0.6);
}

/* Insider badges */
.insider-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.insider-buy { background: rgba(248,113,113,0.15); color: #fca5a5; }
.insider-sell { background: rgba(59,130,246,0.15); color: #93c5fd; }
.insider-neutral { background: rgba(71,85,105,0.2); color: #94a3b8; }

/* Market detail modal */
.market-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.market-modal {
    background: linear-gradient(145deg, rgba(18,26,51,0.98), rgba(11,16,32,0.98));
    border: 1px solid rgba(71,85,105,0.4);
    border-radius: 1rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.market-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(71,85,105,0.2);
}
.market-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.15s;
}
.market-modal-close:hover { color: #f87171; }

/* Market cards hover */
.market-card.cursor-pointer:hover,
.market-mini.cursor-pointer:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91,141,239,0.15);
}

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(91, 141, 239, 0.5); }
