/* =========================================================
   KENO STOCKS
   PREMIUM DARK MARKET UI
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #07080d;
    --bg-soft: #0c0e16;
    --panel: rgba(17, 19, 30, 0.78);
    --panel-strong: rgba(20, 22, 35, 0.94);

    --border: rgba(255, 255, 255, 0.075);
    --border-bright: rgba(255, 255, 255, 0.13);

    --text: #f4f5fb;
    --muted: #8c91a5;
    --muted-2: #62677b;

    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --purple-dark: #5b21b6;

    --green: #35e6a1;
    --red: #ff6578;

    --radius: 20px;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(124, 58, 237, 0.11),
            transparent 30%
        ),
        radial-gradient(
            circle at 90% 15%,
            rgba(139, 92, 246, 0.08),
            transparent 28%
        ),
        linear-gradient(
            145deg,
            #06070b,
            #090a10 45%,
            #06070b
        );

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    overflow-x: hidden;
}


/* =========================================================
   BACKGROUND
========================================================= */

.page-glow {
    position: fixed;

    width: 420px;
    height: 420px;

    border-radius: 50%;

    filter: blur(100px);

    opacity: 0.12;

    pointer-events: none;

    z-index: -1;
}

.glow-one {
    top: 180px;
    left: -240px;
    background: #7c3aed;
}

.glow-two {
    top: 700px;
    right: -250px;
    background: #4f46e5;
}


/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    width: min(1500px, calc(100% - 40px));

    margin: 0 auto;

    height: 82px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-icon {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    font-size: 21px;
    font-weight: 900;

    color: white;

    background:
        linear-gradient(
            145deg,
            #a78bfa,
            #6d28d9
        );

    box-shadow:
        0 8px 30px rgba(124, 58, 237, 0.3),
        inset 0 1px 0 rgba(255,255,255,.25);
}

.brand-name {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 9px 14px;

    border: 1px solid rgba(53, 230, 161, 0.14);
    border-radius: 999px;

    background: rgba(53, 230, 161, 0.045);

    color: #b8f8df;

    font-size: 12px;
    font-weight: 700;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 10px rgba(53, 230, 161, .7);
}

.back-button {
    text-decoration: none;

    color: #d5d7e3;

    padding: 10px 15px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: rgba(255,255,255,.025);

    font-size: 13px;
    font-weight: 700;

    transition: .2s ease;
}

.back-button:hover {
    border-color: var(--border-bright);
    background: rgba(255,255,255,.055);
    transform: translateY(-1px);
}


/* =========================================================
   CONTAINER
========================================================= */

.container {
    width: min(1500px, calc(100% - 40px));

    margin: 0 auto;

    padding: 42px 0 80px;
}


/* =========================================================
   HEADER
========================================================= */

.market-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    margin-bottom: 28px;
}

.eyebrow {
    color: var(--purple-light);

    font-size: 11px;
    font-weight: 900;

    letter-spacing: .18em;

    margin-bottom: 11px;
}

.market-header h1 {
    font-size: clamp(32px, 4vw, 54px);

    line-height: 1;

    letter-spacing: -.045em;

    margin-bottom: 15px;
}

.market-header h1 span {
    color: var(--purple-light);
}

.market-header p {
    max-width: 600px;

    color: var(--muted);

    line-height: 1.6;

    font-size: 14px;
}

.market-info {
    min-width: 190px;

    padding: 18px 20px;

    border: 1px solid var(--border);

    border-radius: 17px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.055),
            rgba(255,255,255,.018)
        );

    text-align: right;
}

.market-info-label {
    color: var(--muted);

    font-size: 11px;

    margin-bottom: 5px;
}

.next-change {
    font-size: 25px;
    font-weight: 900;

    font-variant-numeric: tabular-nums;
}


/* =========================================================
   BALANCE
========================================================= */

.balance-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 20px 23px;

    margin-bottom: 25px;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background:
        linear-gradient(
            120deg,
            rgba(139,92,246,.08),
            rgba(255,255,255,.025)
        );

    box-shadow:
        0 20px 60px rgba(0,0,0,.18);
}

.balance-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.balance-icon {
    width: 46px;
    height: 46px;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.35),
            rgba(91,33,182,.22)
        );

    color: #c4b5fd;

    font-size: 20px;
    font-weight: 900;

    border: 1px solid rgba(167,139,250,.18);
}

.balance-label {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 3px;
}

.balance-value {
    font-size: 23px;
    font-weight: 900;

    letter-spacing: -.02em;

    font-variant-numeric: tabular-nums;
}

.portfolio-mini {
    display: flex;
    gap: 45px;
}

.portfolio-mini > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portfolio-mini span {
    color: var(--muted);
    font-size: 11px;
}

.portfolio-mini strong {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}


/* =========================================================
   MAIN LAYOUT
========================================================= */

.stocks-layout {
    display: grid;

    grid-template-columns: 330px minmax(0, 1fr);

    gap: 18px;

    align-items: start;
}


/* =========================================================
   SIDEBAR
========================================================= */

.stocks-sidebar {
    position: sticky;
    top: 18px;

    overflow: hidden;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background:
        linear-gradient(
            145deg,
            rgba(19,21,33,.94),
            rgba(11,12,20,.92)
        );

    box-shadow:
        0 25px 80px rgba(0,0,0,.25);
}

.sidebar-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 21px;

    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: 17px;
    font-weight: 900;
}

.sidebar-subtitle {
    color: var(--muted);

    font-size: 11px;

    margin-top: 4px;
}

.live-badge {
    padding: 5px 8px;

    border-radius: 7px;

    background: rgba(53,230,161,.08);

    color: var(--green);

    font-size: 9px;
    font-weight: 900;

    letter-spacing: .1em;
}

.stocks-list {
    max-height: 650px;

    overflow-y: auto;

    padding: 8px;
}

.stocks-list::-webkit-scrollbar {
    width: 4px;
}

.stocks-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 20px;
}

.stock-item {
    width: 100%;

    display: grid;

    grid-template-columns: 39px 1fr auto;

    align-items: center;

    gap: 11px;

    padding: 12px;

    margin-bottom: 3px;

    border: 1px solid transparent;

    border-radius: 14px;

    background: transparent;

    color: white;

    cursor: pointer;

    text-align: left;

    transition: .18s ease;
}

.stock-item:hover {
    background: rgba(255,255,255,.035);
}

.stock-item.active {
    border-color: rgba(139,92,246,.25);

    background:
        linear-gradient(
            110deg,
            rgba(139,92,246,.15),
            rgba(139,92,246,.035)
        );

    box-shadow:
        inset 3px 0 0 var(--purple);
}

.stock-mini-logo {
    width: 39px;
    height: 39px;

    border-radius: 11px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.22),
            rgba(255,255,255,.045)
        );

    border: 1px solid var(--border);

    font-size: 11px;
    font-weight: 900;

    color: #dcd5ff;
}

.stock-item-name {
    font-size: 12px;
    font-weight: 800;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-item-code {
    color: var(--muted-2);

    font-size: 9px;

    margin-top: 3px;
}

.stock-item-shares {
    color: #a78bfa;

    font-size: 8px;
    font-weight: 800;

    margin-top: 3px;

    white-space: nowrap;
}

.stock-item-price {
    text-align: right;

    font-size: 12px;
    font-weight: 800;

    font-variant-numeric: tabular-nums;
}

.stock-item-change {
    text-align: right;

    margin-top: 3px;

    font-size: 9px;
    font-weight: 800;
}


/* =========================================================
   TERMINAL
========================================================= */

.terminal {
    min-width: 0;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    background:
        linear-gradient(
            145deg,
            rgba(18,20,31,.96),
            rgba(10,11,18,.96)
        );

    box-shadow:
        0 30px 100px rgba(0,0,0,.28);

    overflow: hidden;
}

.terminal-top {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 24px 25px;

    border-bottom: 1px solid var(--border);
}

.selected-stock {
    display: flex;
    align-items: center;

    gap: 14px;
}

.stock-logo {
    width: 54px;
    height: 54px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.33),
            rgba(91,33,182,.12)
        );

    border: 1px solid rgba(167,139,250,.2);

    color: #d9d0ff;

    font-weight: 900;
}

.stock-name {
    font-size: 18px;
    font-weight: 900;

    letter-spacing: -.02em;
}

.stock-code {
    color: var(--muted);

    font-size: 10px;

    margin-top: 4px;

    letter-spacing: .12em;
}

.price-block {
    text-align: right;
}

.stock-price {
    font-size: 30px;
    font-weight: 950;

    letter-spacing: -.04em;

    font-variant-numeric: tabular-nums;
}

.stock-change {
    margin-top: 4px;

    font-size: 12px;
    font-weight: 900;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}


/* =========================================================
   CHART
========================================================= */

.chart-wrapper {
    padding: 20px 25px 24px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 15px;
}

.chart-title {
    font-size: 13px;
    font-weight: 900;
}

.chart-range {
    display: flex;
    gap: 5px;

    padding: 4px;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: rgba(0,0,0,.15);
}

.range-button {
    border: 0;

    color: var(--muted);

    background: transparent;

    padding: 7px 10px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 800;

    cursor: pointer;

    transition: .18s ease;
}

.range-button:hover {
    color: white;
}

.range-button.active {
    color: white;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.7),
            rgba(109,40,217,.55)
        );

    box-shadow:
        0 4px 15px rgba(124,58,237,.22);
}

.chart-container {
    position: relative;

    width: 100%;
    height: 350px;

    border-radius: 16px;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.018),
            rgba(0,0,0,.08)
        );

    border: 1px solid rgba(255,255,255,.04);
}

#stockChart {
    display: block;

    width: 100%;
    height: 100%;
}

.chart-tooltip {
    position: absolute;

    display: none;

    pointer-events: none;

    min-width: 145px;

    padding: 10px 12px;

    border-radius: 11px;

    border: 1px solid rgba(255,255,255,.1);

    background:
        rgba(8,9,15,.94);

    box-shadow:
        0 15px 35px rgba(0,0,0,.4);

    backdrop-filter: blur(15px);

    z-index: 5;
}

.tooltip-time {
    color: var(--muted);

    font-size: 9px;

    margin-bottom: 4px;
}

.tooltip-price {
    font-size: 14px;
    font-weight: 900;
}

.tooltip-delta {
    margin-top: 3px;

    font-size: 9px;
}


/* =========================================================
   TRADE
========================================================= */

.trade-panel {
    padding: 23px 25px;

    border-top: 1px solid var(--border);
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;
}

.trade-title {
    font-size: 15px;
    font-weight: 900;
}

.trade-subtitle {
    color: var(--muted);

    font-size: 10px;

    margin-top: 4px;
}

.trade-current {
    text-align: right;
}

.trade-current span {
    display: block;

    color: var(--muted);

    font-size: 9px;

    margin-bottom: 3px;
}

.trade-current strong {
    font-size: 15px;

    font-variant-numeric: tabular-nums;
}

.quantity-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-bottom: 12px;
}

.quantity-box,
.order-total {
    padding: 13px;

    border: 1px solid var(--border);

    border-radius: 13px;

    background: rgba(255,255,255,.018);
}

.quantity-box label,
.order-total span {
    display: block;

    color: var(--muted);

    font-size: 9px;
    font-weight: 700;

    margin-bottom: 7px;
}


/* =========================================================
   QUANTITY CONTROL
========================================================= */

.quantity-control {
    display: grid;

    grid-template-columns:
        34px
        minmax(45px, 1fr)
        34px
        52px;

    height: 38px;

    border: 1px solid rgba(255,255,255,.07);

    border-radius: 9px;

    overflow: hidden;

    background: rgba(0,0,0,.2);
}

.quantity-control input {
    width: 100%;

    min-width: 0;

    border: 0;
    outline: 0;

    text-align: center;

    color: white;

    background: transparent;

    font-size: 14px;
    font-weight: 900;
}

.quantity-control input::-webkit-inner-spin-button,
.quantity-control input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-arrow {
    border: 0;

    color: #a9a1c9;

    background: rgba(139,92,246,.07);

    cursor: pointer;

    transition:
        .15s ease;

    font-size: 11px;
}

.quantity-arrow:hover {
    color: white;

    background: rgba(139,92,246,.2);
}


/* =========================================================
   MAX BUTTON
========================================================= */

.quantity-max {
    position: relative;

    border: 0;
    border-left: 1px solid rgba(255,255,255,.07);

    color: #cfc5ff;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.16),
            rgba(91,33,182,.09)
        );

    cursor: pointer;

    font-size: 9px;
    font-weight: 950;

    letter-spacing: .08em;

    transition:
        color .15s ease,
        background .15s ease,
        box-shadow .15s ease;
}

.quantity-max:hover {
    color: white;

    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.32),
            rgba(109,40,217,.2)
        );

    box-shadow:
        inset 0 0 18px rgba(139,92,246,.12);
}

.quantity-max:active {
    background:
        linear-gradient(
            145deg,
            rgba(139,92,246,.45),
            rgba(109,40,217,.28)
        );

    box-shadow:
        inset 0 2px 8px rgba(0,0,0,.2);
}

.order-total {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.order-total strong {
    font-size: 16px;

    font-variant-numeric: tabular-nums;
}

.trade-buttons {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

.trade-button {
    min-height: 55px;

    border: 1px solid;

    border-radius: 13px;

    color: white;

    cursor: pointer;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    transition: .18s ease;
}

.trade-button span {
    font-size: 14px;
    font-weight: 900;
}

.trade-button small {
    font-size: 8px;
    letter-spacing: .12em;

    margin-top: 2px;

    opacity: .7;
}

.trade-button.buy {
    border-color: rgba(53,230,161,.2);

    background:
        linear-gradient(
            145deg,
            rgba(53,230,161,.15),
            rgba(53,230,161,.045)
        );
}

.trade-button.sell {
    border-color: rgba(255,101,120,.2);

    background:
        linear-gradient(
            145deg,
            rgba(255,101,120,.13),
            rgba(255,101,120,.035)
        );
}

.trade-button:hover {
    transform: translateY(-2px);
}

.trade-button.buy:hover {
    border-color: rgba(53,230,161,.4);

    box-shadow:
        0 12px 30px rgba(53,230,161,.08);
}

.trade-button.sell:hover {
    border-color: rgba(255,101,120,.4);

    box-shadow:
        0 12px 30px rgba(255,101,120,.08);
}

.trade-message {
    min-height: 18px;

    text-align: center;

    color: var(--muted);

    font-size: 10px;

    margin-top: 11px;
}


/* =========================================================
   HOLDING
========================================================= */

.holding-panel {
    padding: 22px 25px 25px;

    border-top: 1px solid var(--border);
}

.holding-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 15px;
}

.holding-title {
    font-size: 14px;
    font-weight: 900;
}

.holding-subtitle {
    color: var(--muted);

    font-size: 10px;

    margin-top: 4px;
}

.holding-shares {
    padding: 7px 10px;

    border-radius: 8px;

    background: rgba(139,92,246,.08);

    border: 1px solid rgba(139,92,246,.12);

    color: #cfc5ff;

    font-size: 10px;
    font-weight: 800;
}

.holding-grid {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 10px;
}

.holding-stat {
    padding: 13px;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: rgba(255,255,255,.018);
}

.holding-stat span {
    display: block;

    color: var(--muted);

    font-size: 9px;

    margin-bottom: 6px;
}

.holding-stat strong {
    font-size: 14px;

    font-variant-numeric: tabular-nums;
}


/* =========================================================
   PORTFOLIO
========================================================= */

.portfolio-section {
    margin-top: 35px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 15px;
}

.section-eyebrow {
    color: var(--purple-light);

    font-size: 9px;
    font-weight: 900;

    letter-spacing: .15em;

    margin-bottom: 6px;
}

.section-heading h2 {
    font-size: 25px;

    letter-spacing: -.03em;
}

.total-profit {
    font-size: 17px;
    font-weight: 900;

    font-variant-numeric: tabular-nums;
}

.portfolio-list {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.portfolio-card {
    display: grid;

    grid-template-columns: 43px 1fr auto;

    align-items: center;

    gap: 12px;

    padding: 15px;

    border: 1px solid var(--border);

    border-radius: 15px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.035),
            rgba(255,255,255,.012)
        );
}

.portfolio-logo {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: rgba(139,92,246,.09);

    color: #cfc5ff;

    border: 1px solid rgba(139,92,246,.13);

    font-size: 11px;
    font-weight: 900;
}

.portfolio-name {
    font-size: 12px;
    font-weight: 900;
}

.portfolio-meta {
    color: var(--muted);

    font-size: 9px;

    margin-top: 4px;
}

.portfolio-money {
    text-align: right;
}

.portfolio-money strong {
    display: block;

    font-size: 13px;

    font-variant-numeric: tabular-nums;
}

.portfolio-money span {
    display: block;

    margin-top: 4px;

    font-size: 9px;
    font-weight: 800;
}


/* =========================================================
   TOAST
========================================================= */

.toast {
    position: fixed;

    left: 50%;
    bottom: 28px;

    transform:
        translate(-50%, 20px);

    opacity: 0;

    pointer-events: none;

    padding: 12px 17px;

    border: 1px solid rgba(255,255,255,.09);

    border-radius: 12px;

    background:
        rgba(12,13,21,.95);

    box-shadow:
        0 20px 50px rgba(0,0,0,.45);

    backdrop-filter: blur(15px);

    color: white;

    font-size: 11px;
    font-weight: 800;

    transition: .25s ease;

    z-index: 100;
}

.toast.show {
    opacity: 1;

    transform:
        translate(-50%, 0);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1050px) {

    .stocks-layout {
        grid-template-columns: 270px minmax(0, 1fr);
    }

    .portfolio-list {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 800px) {

    .topbar,
    .container {
        width: min(100% - 24px, 1500px);
    }

    .market-header {
        align-items: flex-start;
        gap: 20px;
        flex-direction: column;
    }

    .market-info {
        width: 100%;
        text-align: left;
    }

    .balance-panel {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .portfolio-mini {
        width: 100%;
        justify-content: space-between;
        gap: 15px;
    }

    .stocks-layout {
        grid-template-columns: 1fr;
    }

    .stocks-sidebar {
        position: static;
    }

    .stocks-list {
        max-height: 320px;

        display: grid;

        grid-template-columns: repeat(2, 1fr);
    }

    .terminal-top {
        gap: 15px;
    }

}

@media (max-width: 600px) {

    .topbar {
        height: 70px;
    }

    .market-status {
        display: none;
    }

    .back-button {
        padding: 8px 11px;
    }

    .container {
        padding-top: 28px;
    }

    .chart-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .chart-range {
        width: 100%;
    }

    .range-button {
        flex: 1;
    }

    .chart-container {
        height: 280px;
    }

    .quantity-row {
        grid-template-columns: 1fr;
    }

    .holding-grid {
        grid-template-columns: 1fr;
    }

    .terminal-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .price-block {
        text-align: left;
    }

    .stocks-list {
        grid-template-columns: 1fr;
    }

    .quantity-control {
        grid-template-columns:
            36px
            minmax(50px, 1fr)
            36px
            58px;
    }

}