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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 8px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 3px;
}

.header-buttons button {
    font-size: 8pt;
    width: 100%;
    color: #000000;
    background-color: #f3f3f3;
    border: none;
    border-radius: 12px;
    padding: 3px 12px;
    cursor: pointer;
}

.header-buttons button:hover {
    background-color: #efefef;
}

.header-buttons button:active {
    background-color: #dadada;
}

.container {
    max-width: 500px;
    margin: 1rem auto;
    padding: 1.5rem;
}

.title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.calculator {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.section-title,
.section-title-coin {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.platform-types, .product-types {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.type-button {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    background-color: #f0f2f5;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.type-button.active {
    background-color: #7CC0FB;
    color: white;
}

.type-description {
    font-size: 0.85rem;
    color: #666;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
    line-height: 1.4;
    transition: all 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.type-description {
    animation: fadeIn 0.2s ease;
}

.coin-product-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.product-button {
    padding: 0.6rem 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f8f8;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.product-button.active {
    background-color: #7CC0FB;
    color: white;
    border-color: #7CC0FB;
}

.coin-input {
    display: flex;
    align-items: center;
}

.coin-input input {
    flex: 1;
    min-width: 0; /* 입력 필드 축소 */
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.unit-text {
    width: 3rem;
    text-align: center;
    margin-left: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0; /* 축소 방지 */
}

.result-section {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
}

.total {
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.calc-process {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
    text-align: right;
    white-space: pre-wrap; /* 줄바꿈, 공백 모두 유지 */
}

@media (max-width: 520px) {
    body {
        margin: 0;
    }

    .container {
        max-width: 100%;
        margin: 0.5rem auto;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .type-button {
        min-width: 80px;
        font-size: 0.85rem;
    }

    .platform-types, .product-types {
        gap: 0.4rem;
    }
}

@media (max-width: 400px) {
    body {
        margin: 0;
        padding: 0;
    }

    .container {
        margin: 0;
        padding: 0.8rem;
    }
}

@media (max-width: 370px) {
    .platform-types, .product-types {
        gap: 0.3rem;
    }

    .type-button {
        padding: 0.6rem 0.4rem;
        border-radius: 6px;
    }

    .section-title, .section-title-coin {
        margin-bottom: 0.5rem;
    }

    .section {
        padding: 0.8rem 1rem;
    }

    .type-button {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 320px) {
    .type-button {
        padding: 0.5rem 0.2rem;
    }

    .platform-types, .product-types {
        gap: 0.2rem;
    }

    .container {
        padding: 0.5rem;
    }

    .section {
        padding: 0.7rem;
    }
}
