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

:root {
    --bg: #080b12;
    --card: #111620;
    --card2: #171d29;
    --text: #f5f7fa;
    --muted: #8e98aa;
    --border: #252c3a;
    --accent: #7c5cff;
    --green: #20c997;
    --red: #ff5c72;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

header {
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 11, 18, 0.95);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    color: var(--text);
}

nav {
    display: flex;
    gap: 8px;
}

.tab {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
}

.tab:hover,
.tab.active {
    background: var(--card2);
    color: white;
}

#themeBtn {
    border: 1px solid var(--border);
    background: var(--card);
    color: white;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
}

main {
    width: 90%;
    max-width: 1400px;
    margin: auto;
}

.page {
    display: none;
    padding: 45px 0;
}

.active-page {
    display: block;
}

.hero {
    background: linear-gradient(
        135deg,
        #15102c,
        #101826
    );
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 60px;
    margin-bottom: 25px;
}

.hero p:first-child,
.page-heading p,
.about > p:first-child {
    color: var(--accent);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.hero h1 {
    font-size: clamp(35px, 5vw, 62px);
    max-width: 800px;
    line-height: 1.05;
}

.sub {
    color: var(--muted);
    max-width: 650px;
    margin-top: 20px;
    line-height: 1.6;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    display: block;
    font-size: 23px;
    margin-top: 10px;
}

.section-title,
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.section-title button {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
}

.page-heading h1 {
    font-size: 34px;
}

#search {
    width: 300px;
    padding: 14px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--card);
    color: white;
    outline: none;
}

.coin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.coin-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.coin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coin-name {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coin-name img {
    width: 38px;
    height: 38px;
}

.symbol {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.price {
    font-size: 23px;
    font-weight: bold;
    margin-top: 20px;
}

.change {
    margin-top: 8px;
    font-weight: bold;
}

.green {
    color: var(--green);
}

.red {
    color: var(--red);
}

.watch {
    background: transparent;
    border: none;
    color: #777f91;
    font-size: 20px;
    cursor: pointer;
}

.watch.active {
    color: #ffd43b;
}

.table-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td {
    font-size: 14px;
}

.table-coin {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-coin img {
    width: 32px;
}

.action {
    background: var(--accent);
    border: none;
    color: white;
    padding: 8px 13px;
    border-radius: 7px;
    cursor: pointer;
}

.portfolio-card {
    max-width: 650px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 35px;
}

.portfolio-card span {
    color: var(--muted);
}

.portfolio-card h1 {
    font-size: 45px;
    margin: 15px 0 30px;
}

.portfolio-input {
    display: flex;
    gap: 10px;
}

.portfolio-input input {
    flex: 1;
    padding: 14px;
    background: var(--bg);
    color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.portfolio-input button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    cursor: pointer;
}

.news-grid,
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.news-grid article,
.features div {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 15px;
}

.news-image {
    height: 130px;
    border-radius: 10px;
    background: var(--card2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 55px;
    margin-bottom: 20px;
}

.news-grid h2 {
    margin-bottom: 12px;
}

.news-grid p,
.features p,
.about > p:not(:first-child) {
    color: var(--muted);
    line-height: 1.6;
}

.news-grid span {
    display: inline-block;
    color: var(--accent);
    margin-top: 15px;
    font-size: 12px;
}

.about {
    max-width: 1000px;
}

.about h1 {
    font-size: 50px;
    margin-bottom: 20px;
}

.about > p:not(:first-child) {
    font-size: 17px;
    margin-bottom: 35px;
}

.features {
    grid-template-columns: repeat(2, 1fr);
}

footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    header {
        height: auto;
        padding: 15px;
        flex-wrap: wrap;
        gap: 15px;
    }

    nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .stats,
    .coin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .news-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats,
    .coin-grid,
    .features {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 30px 20px;
    }

    .page-heading {
        align-items: flex-start;
        gap: 15px;
        flex-direction: column;
    }

    #search {
        width: 100%;
    }
}
/* =========================
   LIGHT THEME
========================= */

body.light {
    --bg: #f5f7fb;
    --card: #ffffff;
    --card2: #eef1f7;
    --text: #111827;
    --muted: #667085;
    --border: #dfe3eb;
    --accent: #6c4cff;
}

body.light header {
    background: rgba(255, 255, 255, 0.95);
}

body.light #themeBtn {
    color: #111827;
}

body.light #search {
    color: #111827;
    background: #ffffff;
}

body.light .portfolio-input input {
    color: #111827;
    background: #ffffff;
}

body.light .tab {
    color: #667085;
}

body.light .tab:hover,
body.light .tab.active {
    color: #111827;
}
/* =========================
   MOBILE RESPONSIVE DESIGN
========================= */

@media (max-width: 900px) {

    header {
        height: auto;
        padding: 15px 20px;
        flex-wrap: wrap;
        gap: 15px;
    }

    .logo {
        font-size: 20px;
    }

    nav {
        order: 3;
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    .tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    main {
        width: 94%;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .coin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* =========================
   PHONE VIEW
========================= */

@media (max-width: 600px) {

    header {
        padding: 12px 15px;
    }

    .logo {
        font-size: 18px;
    }

    #themeBtn {
        padding: 8px 10px;
    }

    main {
        width: 94%;
    }

    .page {
        padding: 25px 0;
    }

    /* Hero */

    .hero {
        padding: 30px 20px;
        border-radius: 15px;
    }

    .hero h1 {
        font-size: 34px;
        line-height: 1.1;
    }

    .hero .sub {
        font-size: 14px;
    }


    /* Statistics */

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card strong {
        font-size: 18px;
    }

    .stat-card span {
        font-size: 11px;
    }


    /* Headings */

    .section-title {
        margin-top: 30px;
    }

    .section-title h2 {
        font-size: 20px;
    }

    .page-heading {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-heading h1 {
        font-size: 28px;
    }


    /* Search */

    #search {
        width: 100%;
        font-size: 14px;
    }


    /* Crypto Cards */

    .coin-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .coin-card {
        padding: 17px;
    }

    .price {
        font-size: 21px;
    }


    /* Markets Table */

    .table-container {
        overflow-x: auto;
        width: 100%;
    }

    table {
        min-width: 750px;
    }

    th,
    td {
        padding: 14px 12px;
    }


    /* Portfolio */

    .portfolio-card {
        padding: 25px 18px;
    }

    .portfolio-card h1 {
        font-size: 35px;
    }

    .portfolio-input {
        flex-direction: column;
    }

    .portfolio-input input {
        width: 100%;
        padding: 14px;
    }

    .portfolio-input button {
        padding: 14px;
    }


    /* News */

    .news-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .news-grid article {
        padding: 20px;
    }

    .news-image {
        height: 110px;
    }


    /* About */

    .about h1 {
        font-size: 38px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 12px;
    }


    /* Footer */

    footer {
        padding: 25px 15px;
        font-size: 11px;
        line-height: 1.5;
    }
}


/* =========================
   VERY SMALL PHONES
========================= */

@media (max-width: 380px) {

    .hero h1 {
        font-size: 29px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .stat-card strong {
        margin-top: 0;
    }

    .page-heading h1 {
        font-size: 25px;
    }
}
/* =========================
   MARKET ANALYSIS
========================= */

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 35px;
}

.analysis-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px;
}

.analysis-card span {
    color: var(--muted);
    font-size: 13px;
}

.analysis-card h2 {
    margin: 12px 0;
    font-size: 27px;
}

.analysis-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.analysis-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.analysis-section h2 {
    margin-bottom: 20px;
}

.analysis-list {
    display: grid;
    gap: 10px;
}

.analysis-coin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--card2);
    border-radius: 10px;
}

.analysis-coin-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analysis-coin img {
    width: 35px;
    height: 35px;
}

.analysis-coin-name {
    font-weight: bold;
}

.analysis-coin-symbol {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

.analysis-percent {
    font-weight: bold;
}

.analysis-summary {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 30px;
    margin-top: 25px;
}

.analysis-summary h2 {
    margin-bottom: 15px;
}

.analysis-summary p {
    color: var(--muted);
    line-height: 1.8;
}


/* MOBILE */

@media (max-width: 900px) {

    .analysis-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .analysis-card {
        padding: 20px;
    }

    .analysis-section {
        padding: 18px;
    }

    .analysis-coin {
        padding: 12px;
    }
}