* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #f4f7fc;
    color: #0b1a33;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.calculator-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 66px;
    padding: 10px 28px;
    background: #fff;
    border-bottom: 1px solid #e7edf5;
}
.calculator-plan {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 500;
}
.calculator-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.calculator-plan.is-free { color: #16803d; background: #eaf8ef; }
.calculator-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    font-size: 1.325rem;
    font-weight: 700;
    line-height: 1.4;
}
.coin-title-icon {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    color: #006acd;
    font-size: 1rem;
    line-height: 1;
}
.calculator-open-link {
    align-items: center;
    justify-self: end;
    gap: 6px;
    color: #69798d;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
}
.calculator-open-link:hover { color: #006acd; }
.calculator-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    padding: 32px 24px 16px;
}
.calculator-wrapper { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; width: 100%; }
.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 316px);
    gap: 24px;
    width: 100%;
    max-width: 760px;
}
.calculator-card, .calculator-history { min-width: 0; padding: 24px 20px; border: 1px solid #d2dce9; border-radius: 24px; }
.calculator-card { padding: 24px 22px; border-color: #e5ebf3; background: #fff; box-shadow: 0 12px 40px rgba(18, 61, 107, .06); }
.coin-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
    margin: 0 0 12px;
    padding: 4px;
    border: 0;
    border-radius: 10px;
    background: #f0f4fa;
}
.coin-view label { position: relative; min-width: 0; }
.coin-view label span {
    display: block;
    padding: 7px 4px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #526682;
    font-size: .875rem;
    font-weight: 650;
    text-align: center;
    cursor: pointer;
}
.coin-view input:checked + span { border-color: #d2e3f7; background: #fff; color: #075fac; }
.coin-view input:focus-visible + span { outline: 3px solid #8ec7ff; outline-offset: 1px; }
.coin-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.coin-filters:has(#coinType[hidden]) { grid-template-columns: minmax(0, 1fr); }
.coin-search { position: relative; min-width: 0; }
.coin-input {
    min-width: 0;
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid #d2dce9;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: .875rem;
}
.coin-search input { width: 100%; }
.coin-search input::placeholder { color: #66758a; }
.coin-list-heading, .coin-detail-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
.coin-list-heading { margin-top: 16px; }
.coin-list-heading h2, .coin-list-heading p, .coin-detail-heading h2, .coin-english { margin: 0; }
.coin-list-heading h2 { color: #315d8d; font-size: 1rem; font-weight: 650; }
.coin-list-heading p, .coin-english { color: #526682; font-size: .875rem; }
.coin-results {
    position: relative;
    max-height: 318px;
    margin: 8px 0 0;
    padding: 2px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    list-style: none;
}
.coin-results li {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 43px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-bottom-color: #eef2f8;
    border-radius: 7px;
    cursor: pointer;
}
.coin-results li:hover { background: #f4f7fc; }
.coin-results li[aria-selected="true"] { border-color: #bfdbfa; background: #edf5ff; }
.coin-list-code, .coin-facts dd { font-variant-numeric: tabular-nums; }
.coin-list-code { color: #075fac; font-size: .875rem; font-weight: 700; }
.coin-list-name { min-width: 0; overflow: hidden; font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.coin-list-symbol { max-width: 56px; overflow: hidden; color: #526682; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.coin-list-currencies { max-width: 108px; overflow: hidden; color: #526682; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.coin-empty { margin: 12px 0 0; color: #66758a; font-size: .875rem; line-height: 1.6; }
.coin-detail-heading h2 { color: #315d8d; font-size: 1.2rem; line-height: 1.4; overflow-wrap: anywhere; }
.coin-kind { padding: 3px 7px; border-radius: 6px; background: #e8f1fc; color: #315d8d; font-size: .75rem; }
.coin-english { margin-top: 4px; overflow-wrap: anywhere; }
.coin-note { margin: 8px 0 0; color: #526682; font-size: .85rem; line-height: 1.6; }
.coin-note a { color: #315d8d; }
.coin-territory-currencies { display: grid; gap: 5px; margin: 10px 0 0; color: #315d8d; font-size: .85rem; font-weight: 650; }
.coin-territory:not([hidden]) ~ #coinDetails { margin-top: 13px; padding-top: 12px; border-top: 1px solid #d2dce9; }
.coin-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 0;
}
.coin-facts div { min-width: 0; padding: 8px 10px; border: 1px solid #e5ebf3; border-radius: 8px; background: #fff; }
.coin-facts dt { margin-bottom: 4px; color: #526682; font-size: .8rem; }
.coin-facts dd { margin: 0; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.coin-region-section { margin-top: 18px; border-top: 1px solid #d2dce9; padding-top: 12px; }
.coin-region-section h3 { margin: 0 0 8px; color: #315d8d; font-size: .9rem; }
.coin-regions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 130px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}
.coin-regions li { padding: 3px 6px; border-radius: 5px; background: #e9eff7; color: #315d8d; font-size: .8rem; overflow-wrap: anywhere; }
.calculator-open-link:focus-visible, .coin-input:focus-visible, .coin-results li:focus-visible {
    outline: 3px solid #8ec7ff;
    outline-offset: 1px;
}
.calculator-tips {
    width: 100%;
    max-width: 760px;
    padding: 18px 16px 0;
    border-top: 1px solid #eef2f8;
    color: #66758a;
    font-size: .9rem;
    line-height: 1.8;
    text-align: center;
}
.calculator-tips p { margin: 0; }
.calculator-tips a { color: #315d8d; }
@media (max-width: 767.98px) {
    .calculator-header { padding: 8px 16px; gap: 10px; }
    .calculator-plan { padding: 5px 8px; font-size: .72rem; }
    .calculator-title { gap: 7px; font-size: 1.175rem; }
    .calculator-open-link { font-size: .8rem; }
    .calculator-main { padding: 24px 16px 16px; gap: 20px; }
}
@media (max-width: 675.98px) {
    .calculator-layout { max-width: 420px; grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .coin-results { max-height: 257px; }
}
@media (max-width: 575.98px) {
    .calculator-header { grid-template-columns: minmax(0, 1fr) auto; }
    .calculator-title { grid-column: 1 / -1; grid-row: 1; }
    .calculator-plan { grid-column: 1; grid-row: 2; }
    .calculator-open-link { grid-column: 2; grid-row: 2; }
    .calculator-card, .calculator-history { padding: 16px; border-radius: 22px; }
    .calculator-tips { padding: 18px 12px 0; font-size: .8rem; }
}
