:root {
    --background: #fafafa;
    --surface: #ffffff;
    --surface-alt: #f4f5f7;

    --text: #111318;
    --text-muted: #69707d;

    --border: #e2e5e9;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;

    --positive: #16803c;
    --negative: #c62828;
    --warning: #a16207;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --content-width: 1120px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;

    background: var(--background);
    color: var(--text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}


header {
    position: sticky;
    top: 0;
    z-index: 10;

    border-bottom: 1px solid var(--border);

    background: rgba(250, 250, 250, 0.9);
    backdrop-filter: blur(12px);
}

nav {
    width: min(var(--content-width), calc(100% - 32px));
    min-height: 68px;
    margin: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

nav > a {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

nav div {
    display: flex;
    align-items: center;
    gap: 4px;
}

nav div a {
    padding: 7px 10px;

    color: var(--text-muted);
    border-radius: var(--radius-sm);

    font-size: 0.9rem;

    transition:
        color 0.15s ease,
        background 0.15s ease;
}

nav div a:hover {
    background: var(--surface-alt);
    color: var(--text);
}


main {
    width: min(var(--content-width), calc(100% - 32px));
    margin: auto;
}

section {
    padding: 56px 0;
}

section:first-child {
    max-width: 820px;
    padding-top: 88px;
    padding-bottom: 48px;
}

section > p:first-child {
    margin: 0 0 14px;

    color: var(--primary);

    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 780px;
    margin-bottom: 0;

    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.05em;
}

h2 {
    margin-bottom: 24px;

    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -0.035em;
}

section + section h2 {
    margin-bottom: 20px;
}

h3 {
    margin-bottom: 0;

    font-size: 1.05rem;
    line-height: 1.35;
}

section > p:not(:first-child) {
    max-width: 680px;
    margin-bottom: 0;

    color: var(--text-muted);
    font-size: 1rem;
}

section > a,
button {
    min-height: 44px;
    padding: 10px 17px;

    border: 0;
    border-radius: var(--radius-sm);

    background: var(--primary);
    color: #fff;

    font-weight: 650;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

section > a {
    display: inline-flex;
    align-items: center;

    margin-top: 28px;
}

section > a:hover,
button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

section > a:active,
button:active {
    transform: translateY(0);
}


.tools-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.tool-card {
    padding: 24px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.tool-card:hover {
    border-color: #d3d7dc;
    box-shadow: 0 8px 24px rgba(17, 19, 24, 0.06);
    transform: translateY(-2px);
}

.tool-card p {
    max-width: 34rem;
    margin: 8px 0 0;

    color: var(--text-muted);
    font-size: 0.92rem;
}

.tool-card a,
.tool-card span {
    display: inline-block;
    margin-top: 22px;

    font-size: 0.85rem;
    font-weight: 650;
}

.tool-card a {
    color: var(--primary);
}

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

#position-size-calculator > div p {
    margin: 0;

    color: var(--text-muted);
    font-size: 0.8rem;
}


#market-search {
    max-width: 760px;
}

#market-search > div:first-child > div {
    display: flex;
    gap: 8px;
}

#market-search input {
    flex: 1;
}

#market-suggestions {
    margin-top: 8px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    overflow: hidden;
}

.market-suggestion {
    width: 100%;
    display: grid;
    gap: 3px;

    padding: 12px 14px;

    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;

    background: var(--surface);
    color: var(--text);

    text-align: left;
}

.market-suggestion:last-child {
    border-bottom: 0;
}

.market-suggestion:hover {
    background: var(--surface-alt);
}

.market-suggestion strong {
    font-size: 0.95rem;
}

.market-suggestion span {
    color: var(--text-muted);
    font-size: 0.85rem;
}


form {
    max-width: 680px;

    display: grid;
    gap: 18px;
}

form > div,
#pnl-calculator > div {
    display: grid;
    gap: 6px;
}

label {
    font-size: 0.88rem;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    background: var(--surface);
    color: var(--text);

    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

form button {
    justify-self: start;
}


#pnl-calculator {
    max-width: 760px;
    padding: 26px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface-alt);
}

#pnl-calculator > div {
    margin-bottom: 16px;
}

#pnl-calculator > button,
#pnl-calculator > div > button:first-child,
#position-size-calculator > div > button:first-child {
    margin-top: 2px;
}

#pnl-results {
    margin-top: 28px;
    padding-top: 26px;

    border-top: 1px solid var(--border);
}

#pnl-results > p {
    margin: 0;
    padding: 18px;

    border-radius: var(--radius-md);

    background: var(--surface);
}

#pnl-results > p strong {
    display: block;
    margin-top: 3px;

    font-size: 1.8rem;
    line-height: 1.2;
}

#pnl-calculator > div > button + button,
#position-size-calculator > div > button + button {
    margin-left: 8px;

    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

#pnl-calculator > div > button + button:hover,
#position-size-calculator > div > button + button:hover {
    background: var(--surface-alt);
    border-color: #d3d7dc;
}

#position-size-calculator {
    max-width: 760px;
    padding: 26px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface-alt);
}

#position-size-calculator > div {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

#position-size-results {
    margin-top: 28px;
    padding-top: 26px;

    border-top: 1px solid var(--border);
}

#position-size-results > p {
    margin: 0;
    padding: 18px;

    border-radius: var(--radius-md);

    background: var(--surface);
}

#position-size-results > p strong {
    display: block;
    margin-top: 3px;

    font-size: 1.8rem;
    line-height: 1.2;
}

dl {
    margin: 12px 0 0;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

dl div {
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    background: var(--surface);
}

dt {
    color: var(--text-muted);
    font-size: 0.8rem;
}

dd {
    margin: 2px 0 0;
    font-weight: 650;
}


footer {
    width: min(var(--content-width), calc(100% - 32px));
    margin: 32px auto 0;
    padding: 28px 0;

    border-top: 1px solid var(--border);

    color: var(--text-muted);
    font-size: 0.82rem;
}

footer p {
    margin: 0;
}

footer p + p {
    margin-top: 3px;
}


@media (max-width: 760px) {
    header {
        position: static;
    }

    nav {
        min-height: auto;
        padding: 16px 0;

        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    nav div {
        width: 100%;

        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    nav div a {
        padding: 8px 4px;

        text-align: center;
        font-size: 0.82rem;

        background: var(--surface);
        border: 1px solid var(--border);
    }

    section {
        padding: 52px 0;
    }

    section:first-child {
        padding-top: 72px;
        padding-bottom: 48px;
    }

    h1 {
        font-size: clamp(2.4rem, 12vw, 3.6rem);
    }

    .tools-list {
        grid-template-columns: 1fr;
    }

    dl {
        grid-template-columns: 1fr;
    }

    #pnl-calculator {
        padding: 20px;
    }

    #position-size-calculator {
        padding: 20px;
    }

    #market-search > div:first-child > div {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    main,
    nav,
    footer {
        width: calc(100% - 24px);
    }

    nav > a {
        font-size: 0.92rem;
    }

    nav div a {
        padding: 7px 3px;
        font-size: 0.75rem;
    }
}


#market-result {
    max-width: 760px;
    padding: 26px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
}

#market-result > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

#market-name {
    margin: 0;

    font-size: 1.15rem;
    font-weight: 700;
}

#market-details {
    color: var(--text-muted);
    font-size: 0.85rem;
}

#market-result > div:nth-child(2) {
    display: flex;
    align-items: baseline;
    gap: 12px;

    margin-top: 20px;
}

#market-price {
    font-size: 2.25rem;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

#market-change {
    font-size: 0.9rem;
    font-weight: 650;
}

#market-result dl {
    margin-top: 24px;
}

#market-result dd {
    font-size: 0.9rem;
}

#market-status {
    font-weight: 650;
}

#market-status[data-status="open"] {
    color: var(--positive);
}

#market-status[data-status="closed"] {
    color: var(--text-muted);
}

#market-chart-section {
    max-width: 760px;
}

#market-chart {
    width: 100%;
    height: 320px;

    padding: 16px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
}

#market-chart-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

@media (max-width: 760px) {
    #market-result {
        padding: 20px;
    }

    #market-result > div:first-child {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    #market-result > div:nth-child(2) {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    #market-price {
        font-size: 2rem;
    }
    #market-chart {
    height: 240px;
}

    #market-timeframes {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-bottom: 12px;
}

#market-timeframes button {
    min-height: 36px;
    padding: 7px 13px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    background: var(--surface);
    color: var(--text-muted);

    font-size: 0.8rem;
    font-weight: 650;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

#market-timeframes button:hover {
    background: var(--surface-alt);
    color: var(--text);
    transform: none;
}

#market-timeframes button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

#market-timeframes button.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

@media (max-width: 480px) {
    #market-timeframes {
        width: 100%;
    }

    #market-timeframes button {
        flex: 1;
        padding: 7px 8px;
    }
}

#currency-converter {
    max-width: 760px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
}

#currency-converter > div {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

#currency-results {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

#currency-results > p {
    margin: 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
}

#currency-results > p strong {
    display: block;
    margin-top: 3px;
    font-size: 1.8rem;
    line-height: 1.2;
}

#currency-results dl {
    margin-top: 16px;
}

#currency-converter > div > button + button {
    margin-left: 8px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

#currency-converter > div > button + button:hover {
    background: var(--surface-alt);
    border-color: #d3d7dc;
}

@media (max-width: 640px) {
    #currency-converter {
        padding: 20px;
    }
}

#coin-search,
#coin-result {
    max-width: 760px;
}

#coin-search {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
}

#coin-search > div {
    display: grid;
    gap: 6px;
}

#coin-search > div > div {
    display: flex;
    gap: 8px;
}

#coin-search input {
    flex: 1;
}

#coin-result {
    margin-top: 24px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

#coin-result > div:first-child p:first-child {
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

#coin-result h2 {
    margin-bottom: 4px;
}

#coin-result > div:first-child p:last-child {
    margin: 0;
    color: var(--text-muted);
}

#coin-result > div:nth-child(2) {
    margin: 28px 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface-alt);
}

#coin-price {
    display: block;
    font-size: 1.8rem;
    line-height: 1.2;
}

#coin-change {
    margin: 5px 0 0;
    font-weight: 600;
}

@media (max-width: 640px) {
    #coin-search,
    #coin-result {
        padding: 20px;
    }

    #coin-search > div > div {
        display: grid;
    }
}

  #risk-reward-calculator {
    max-width: 760px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
}

#risk-reward-calculator > div {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

#risk-reward-results {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

#risk-reward-results > p {
    margin: 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
}

#risk-reward-results > p strong {
    display: block;
    margin-top: 3px;
    font-size: 1.8rem;
    line-height: 1.2;
}

#risk-reward-calculator > div > button + button {
    margin-left: 8px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

#risk-reward-calculator > div > button + button:hover {
    background: var(--surface-alt);
    border-color: #d3d7dc;
}

@media (max-width: 640px) {
    #risk-reward-calculator {
        padding: 20px;
    }
}

 #leverage-calculator {
    max-width: 760px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
}

#leverage-calculator > div {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

#leverage-results {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

#leverage-results > p {
    margin: 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--surface);
}

#leverage-results > p strong {
    display: block;
    margin-top: 3px;
    font-size: 1.8rem;
    line-height: 1.2;
}

#leverage-calculator > div > button + button {
    margin-left: 8px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

#leverage-calculator > div > button + button:hover {
    background: var(--surface-alt);
    border-color: #d3d7dc;
}

@media (max-width: 640px) {
    #leverage-calculator {
        padding: 20px;
    }
}




main > section:not(:first-child) > article {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

main > section:not(:first-child) > article p {
    max-width: 680px;
    margin: 7px 0 0;
    color: var(--text-muted);
}

main > section:not(:first-child) > article a {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 650;
}

main > section:not(:first-child) > article a:hover {
    color: var(--primary-hover);
}

main > section:not(:first-child) {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

main > section:not(:first-child) > h2 {
    grid-column: 1 / -1;
}

main > section:last-child {
    display: block;
    max-width: 820px;
}



main > section:nth-child(2),
main > section:nth-child(3) {
    max-width: 760px;
}

main > section:nth-child(2) {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

main > section:nth-child(2) > p:first-of-type {
    margin-bottom: 12px;
}

main > section:nth-child(2) > p:first-of-type a {
    display: inline-block;
    margin-left: 4px;
    color: var(--primary);
    font-weight: 650;
}

main > section:nth-child(2) > p:first-of-type a:hover {
    color: var(--primary-hover);
}

main > section:nth-child(3) ul {
    max-width: 680px;
    margin: 0;
    padding: 20px 24px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    display: grid;
    gap: 10px;
}

main > section:nth-child(3) li {
    color: var(--text-muted);
}

@media (max-width: 760px) {
    main > section:not(:first-child) {
        display: block;
    }

    main > section:not(:first-child) > article {
        padding: 20px 0;
        border: 0;
        border-top: 1px solid var(--border);
        border-radius: 0;
        background: transparent;
    }

    main > section:not(:first-child) > article:last-child {
        border-bottom: 1px solid var(--border);
    }

    main > section:nth-child(2) {
        padding: 20px;
    }

    main > section:nth-child(3) ul {
        padding: 18px 20px;
    }
}

    body[data-workspace-density="compact"] .workspace-card,
body[data-workspace-density="compact"] .workspace-section {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

body[data-workspace-density="compact"] .saved-calculation,
body[data-workspace-density="compact"] .watchlist-item {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}