:root {
    --primary-color: #034ea2;
    --primary-light: #0072bc;
    --accent-color: #ed1c24;
    --bg-color: #f4f7f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --muted-color: #777777;
    --border-color: #eeeeee;
    --coffee-color: #ffdd00;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 40px 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: min(100%, 590px);
    margin: 0 auto;
    padding: 20px;
}

.lang-switch {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 15px;
}

.btn-lang {
    min-width: 48px;
    border: 1px solid #dddddd;
    border-radius: 6px;
    padding: 4px 12px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: #888888;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-lang.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #ffffff;
}

.card {
    border-radius: 20px;
    background-color: var(--card-bg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    padding: 35px;
    text-align: center;
}

h1,
h2 {
    margin: 0;
}

h1 {
    color: var(--primary-color);
    font-size: 1.6rem;
    line-height: 1.25;
}

.target-date {
    margin-top: 10px;
    color: #666666;
    font-size: 0.95rem;
}

.d-day-badge {
    display: inline-block;
    margin: 8px 0 25px;
    border-radius: 20px;
    padding: 6px 18px;
    background-color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(237, 28, 36, 0.2);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
}

.loading {
    margin: 40px 0;
    color: #888888;
    font-weight: 600;
}

.main-price-box {
    margin-bottom: 25px;
    border-radius: 15px;
    padding: 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: #ffffff;
}

.price-label {
    margin-bottom: 5px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.base-price-value {
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 1.2;
}

.increase-rate {
    margin-top: 10px;
    font-size: 1.05rem;
    font-weight: 600;
}

.active-tier {
    margin-top: 8px;
    font-size: 0.82rem;
    opacity: 0.85;
}

.section-title {
    margin: 25px 0 15px;
    border-left: 4px solid var(--primary-color);
    padding-left: 8px;
    color: #444444;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
}

.formula-explainer,
.scenario-section,
.vesting-section {
    margin-top: 20px;
    text-align: left;
}

.formula-explainer {
    border: 1px solid #dfeaf7;
    border-radius: 12px;
    background-color: #fbfdff;
}

.formula-explainer summary {
    cursor: pointer;
    padding: 12px 14px;
    color: var(--primary-color);
    font-size: 0.86rem;
    font-weight: 800;
}

.formula-body {
    border-top: 1px solid #edf3fa;
    padding: 14px;
}

.formula-line {
    border-radius: 8px;
    padding: 10px 12px;
    background-color: #eef5ff;
    color: #244b7a;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.4;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.formula-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1px solid #edf0f3;
    border-radius: 8px;
    padding: 10px;
    background-color: #ffffff;
}

.formula-item span {
    color: #888888;
    font-size: 0.72rem;
    font-weight: 700;
}

.formula-item strong {
    color: #333333;
    font-size: 0.88rem;
}

.scenario-section {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    background-color: #ffffff;
}

.scenario-section .section-title {
    margin-top: 0;
}

.scenario-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 12px;
}

.scenario-value {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 800;
}

.scenario-reset {
    flex: 0 0 auto;
    border: 1px solid #d7e3f4;
    border-radius: 999px;
    padding: 6px 12px;
    background-color: #eef5ff;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 800;
}

.scenario-reset:hover {
    border-color: var(--primary-color);
    background-color: #ffffff;
}

.scenario-slider {
    width: 100%;
    accent-color: var(--primary-color);
}

.scenario-range {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: #888888;
    font-size: 0.72rem;
    font-weight: 700;
}

.scenario-help,
.vesting-help {
    margin: 10px 0 0;
    color: #666666;
    font-size: 0.8rem;
    line-height: 1.55;
}

.positions-header,
.pos-item {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) minmax(70px, 0.8fr) minmax(150px, 1.6fr);
    align-items: center;
    column-gap: 8px;
}

.positions-header {
    border-bottom: 2px solid var(--border-color);
    padding: 0 5px 10px;
    color: #888888;
    font-size: 0.85rem;
    font-weight: 700;
}

.positions-header span:first-child,
.positions-header span:nth-child(2) {
    text-align: center;
}

.positions-header span:last-child {
    text-align: right;
}

.positions-list {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.pos-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 15px 5px;
    font-size: 0.95rem;
}

.pos-name {
    color: #333333;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.pos-shares {
    color: #555555;
    text-align: center;
    white-space: nowrap;
}

.pos-reward {
    color: var(--primary-color);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.tax-estimator {
    margin-top: 24px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    background-color: #fbfcfd;
    text-align: left;
}

.tax-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tax-header .section-title {
    margin: 0;
}

.tax-help,
.tax-disclaimer {
    margin: 12px 0 0;
    color: #666666;
    font-size: 0.8rem;
    line-height: 1.55;
}

.tax-explainer {
    margin-top: 12px;
    border: 1px solid #e7edf5;
    border-radius: 10px;
    background-color: #ffffff;
}

.tax-explainer summary {
    cursor: pointer;
    padding: 10px 12px;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 800;
    list-style-position: outside;
}

.tax-explainer summary::marker {
    color: #8da9cf;
}

.tax-explainer-body {
    border-top: 1px solid #eef2f6;
    padding: 0 12px 10px;
}

.tax-explainer-body p {
    margin: 10px 0 0;
    color: #666666;
    font-size: 0.76rem;
    line-height: 1.55;
}

.tax-bracket-title {
    margin-top: 12px;
    color: #444444;
    font-size: 0.76rem;
    font-weight: 800;
}

.tax-bracket-table {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 0;
    overflow: hidden;
    margin-top: 7px;
    border: 1px solid #edf0f3;
    border-radius: 8px;
    background-color: #ffffff;
}

.tax-bracket-table strong,
.tax-bracket-table span {
    padding: 7px 9px;
    border-bottom: 1px solid #edf0f3;
    color: #666666;
    font-size: 0.72rem;
    line-height: 1.25;
}

.tax-bracket-table strong {
    background-color: #f6f8fb;
    color: #444444;
}

.tax-bracket-table strong:nth-child(2),
.tax-bracket-table span:nth-child(2n) {
    border-left: 1px solid #edf0f3;
    text-align: right;
}

.tax-bracket-table span:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.tax-rate-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 14px;
}

.tax-rate-btn {
    min-height: 34px;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    background-color: #ffffff;
    color: #555555;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
}

.tax-rate-btn.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #ffffff;
}

.tax-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.tax-result-card {
    border: 1px solid #edf0f3;
    border-radius: 10px;
    padding: 12px;
    background-color: #ffffff;
}

.tax-result-heading {
    color: #333333;
    font-size: 0.88rem;
    font-weight: 800;
}

.tax-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.tax-result-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tax-result-label {
    color: #888888;
    font-size: 0.68rem;
    font-weight: 700;
}

.tax-result-item strong {
    color: #333333;
    font-size: 0.82rem;
    line-height: 1.25;
    word-break: keep-all;
}

.tax-result-item:last-child strong {
    color: var(--primary-color);
}

.vesting-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.vesting-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background-color: #ffffff;
}

.vesting-title {
    color: #333333;
    font-size: 0.9rem;
    font-weight: 800;
}

.vesting-table {
    display: grid;
    grid-template-columns: 0.7fr 0.9fr 1.2fr 1.2fr 1.2fr;
    overflow: hidden;
    margin-top: 10px;
    border: 1px solid #edf0f3;
    border-radius: 8px;
}

.vesting-table strong,
.vesting-table span {
    padding: 7px 8px;
    border-right: 1px solid #edf0f3;
    border-bottom: 1px solid #edf0f3;
    color: #666666;
    font-size: 0.7rem;
    line-height: 1.25;
    text-align: right;
}

.vesting-table strong {
    background-color: #f6f8fb;
    color: #444444;
    font-weight: 800;
}

.vesting-table strong:nth-child(5n + 1),
.vesting-table span:nth-child(5n + 1) {
    text-align: left;
}

.vesting-table strong:nth-child(5n),
.vesting-table span:nth-child(5n) {
    border-right: 0;
}

.vesting-table span:nth-last-child(-n + 5) {
    border-bottom: 0;
}

.vesting-table span:nth-child(5n) {
    color: var(--primary-color);
    font-weight: 800;
}

.details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.secondary-panel {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #ffffff;
    text-align: left;
}

.secondary-panel summary {
    cursor: pointer;
    padding: 14px 16px;
    color: var(--primary-color);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.3;
}

.secondary-panel summary::marker {
    color: #8aa5c7;
}

.secondary-panel .section-title {
    margin-top: 4px;
    margin-bottom: 14px;
    font-size: 0.95rem;
    text-align: left;
}

.secondary-panel > section {
    margin: 0 16px 16px;
}

.secondary-panel .details {
    margin-bottom: 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    font-size: 0.9rem;
}

.detail-label {
    flex: 0 0 auto;
    color: var(--muted-color);
    white-space: nowrap;
}

.detail-value {
    color: #444444;
    font-weight: 600;
    text-align: right;
}

#chartContainer {
    height: 300px;
    margin: 0 16px 16px;
    width: calc(100% - 32px);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: #ffffff;
}

.psu-info {
    margin-top: 25px;
    border-radius: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    color: #666666;
    font-size: 0.85rem;
    line-height: 1.6;
    text-align: left;
}

.secondary-panel .psu-info {
    margin: 0 16px 14px;
}

.psu-summary {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    background-color: #ffffff;
    color: var(--muted-color);
    font-size: 0.75rem;
    text-align: left;
}

.secondary-panel .psu-summary {
    margin: 0 16px 16px;
}

.psu-summary h2 {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.psu-summary ul {
    margin: 0;
    padding-left: 18px;
    list-style-type: disc;
}

.psu-summary li {
    margin-bottom: 5px;
}

.condition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 5px;
    border-radius: 6px;
    padding: 8px;
    background: #f9f9f9;
    font-size: 0.7rem;
}

.action-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    border-top: 1px dashed #dddddd;
    padding-top: 25px;
}

.btn-share,
.btn-coffee {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    max-width: 200px;
    border-radius: 10px;
    font-weight: 700;
}

.btn-share {
    border: 1px solid #dddddd;
    padding: 10px 20px;
    background-color: #ffffff;
    color: #555555;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-share:hover {
    border-color: #bbbbbb;
    background-color: #f9f9f9;
}

.btn-coffee {
    gap: 8px;
    border: 1px solid #e5e7eb;
    padding: 10px 18px;
    background-color: #ffffff;
    box-shadow: none;
    color: #555555;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-coffee:hover {
    border-color: #c9ced6;
    background-color: #f9fafb;
    color: #222222;
}

.last-update {
    margin-top: 25px;
    color: #aaaaaa;
    font-size: 0.75rem;
}

body.lang-en h1 {
    font-size: 1.3rem;
}

body.lang-en .price-label {
    font-size: 0.8rem;
}

body.lang-en .base-price-value {
    font-size: 1.75rem;
}

body.lang-en .positions-header,
body.lang-en .pos-item {
    font-size: 0.75rem;
}

body.lang-en .detail-label {
    font-size: 0.8rem;
}

@media (max-width: 480px) {
    body {
        padding: 24px 0;
    }

    .container {
        padding: 10px;
    }

    .card {
        border-radius: 16px;
        padding: 30px 12px;
    }

    h1 {
        font-size: 1.25rem;
    }

    .base-price-value {
        font-size: 1.55rem;
    }

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

    .scenario-section {
        padding: 14px 12px;
    }

    .scenario-control-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .positions-header,
    .pos-item {
        grid-template-columns: minmax(64px, 1fr) minmax(58px, 0.75fr) minmax(128px, 1.8fr);
        font-size: 0.75rem;
    }

    .positions-header {
        display: none;
    }

    .positions-list {
        gap: 10px;
    }

    .pos-item {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 12px;
        background-color: #fbfcfd;
    }

    .pos-name {
        grid-column: 1 / -1;
        text-align: left;
    }

    .pos-shares {
        text-align: left;
    }

    .pos-reward {
        font-size: 0.82rem;
    }

    .tax-estimator {
        padding: 14px 12px;
    }

    .tax-rate-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .tax-result-grid {
        grid-template-columns: 1fr;
    }

    .tax-result-item {
        flex-direction: row;
        justify-content: space-between;
        gap: 12px;
    }

    .tax-result-item strong {
        text-align: right;
    }

    .vesting-card {
        padding: 10px;
    }

    .vesting-table {
        grid-template-columns: 0.65fr 0.8fr 1fr 1fr 1fr;
    }

    .vesting-table strong,
    .vesting-table span {
        padding: 7px 5px;
        font-size: 0.62rem;
    }

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

    body.lang-en h1 {
        font-size: 1.1rem;
    }

    body.lang-en .base-price-value {
        font-size: 1.35rem;
    }
}
