/* ========================================
   기본 설정
======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: #f5f6f8;
    color: #222;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans KR",
        Arial,
        sans-serif;
    line-height: 1.6;
}


/* ========================================
   전체 컨테이너
======================================== */

.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}


/* ========================================
   헤더
======================================== */

.header {
    margin-bottom: 32px;
    text-align: center;
}

.header h1 {
    margin-bottom: 12px;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: #222;
}

.subtitle {
    color: #666;
    font-size: 16px;
    line-height: 1.7;
}


/* ========================================
   공통 카드
======================================== */

.card {
    margin-bottom: 22px;
    padding: 28px;
    background: #fff;
    border: 1px solid #e7e8eb;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}


/* ========================================
   섹션 제목
======================================== */

.section-title {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.step-number {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    background: #222;
    color: #fff;

    border-radius: 50%;

    font-size: 16px;
    font-weight: 700;
}

.section-title h2 {
    margin-bottom: 3px;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -0.5px;
}

.section-title p {
    color: #888;
    font-size: 14px;
}


/* ========================================
   금액 입력 영역
======================================== */

.price-input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-box label {
    display: block;
    margin-bottom: 8px;

    color: #444;

    font-size: 14px;
    font-weight: 700;
}

.price-input {
    display: flex;
    align-items: center;

    padding: 0 14px;

    background: #f8f9fa;

    border: 1px solid #ddd;
    border-radius: 12px;

    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}

.price-input:focus-within {
    background: #fff;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}

.price-input input {
    width: 100%;
    min-width: 0;

    padding: 15px 0;

    background: transparent;

    border: none;
    outline: none;

    color: #222;

    font-size: 17px;
    font-weight: 650;
}

.price-input input::placeholder {
    color: #aaa;
    font-weight: 400;
}

.price-input span {
    flex-shrink: 0;
    margin-left: 8px;

    color: #777;

    font-size: 14px;
}


/* 숫자 입력창 화살표 제거 */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}


/* ========================================
   총 금액
======================================== */

.total-price {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 20px;
    padding: 18px 20px;

    background: #f2f3f5;

    border-radius: 14px;
}

.total-price span {
    color: #666;
    font-size: 15px;
    font-weight: 600;
}

.total-price strong {
    color: #111;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}


/* ========================================
   인원 설정
======================================== */

.people-setting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;

    padding: 12px 0;
}

.count-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;

    background: #f3f4f6;
    color: #222;

    border: 1px solid #ddd;
    border-radius: 50%;

    cursor: pointer;

    font-size: 28px;
    font-weight: 400;

    transition:
        transform 0.15s,
        background 0.2s;
}

.count-button:hover {
    background: #e9eaed;
}

.count-button:active {
    transform: scale(0.92);
}

.people-count {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;

    min-width: 90px;
}

.people-count strong {
    font-size: 38px;
    font-weight: 800;
}

.people-count span {
    color: #666;
    font-size: 16px;
}


/* ========================================
   사람 목록
======================================== */

#peopleList {
    display: flex;
    flex-direction: column;
    gap: 16px;
}


/* ========================================
   사람별 카드
======================================== */

.person-card {
    padding: 22px;

    background: #f8f9fa;

    border: 1px solid #e5e6e8;
    border-radius: 16px;
}

.person-header {
    margin-bottom: 20px;
}

.person-name {
    width: 100%;

    padding: 12px 14px;

    background: #fff;

    border: 1px solid #ddd;
    border-radius: 10px;

    outline: none;

    color: #222;

    font-size: 18px;
    font-weight: 750;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.person-name:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}


/* ========================================
   음식 / 술 선택 영역
======================================== */

.choice-section + .choice-section {
    margin-top: 18px;
}

.choice-section h3 {
    margin-bottom: 10px;

    color: #444;

    font-size: 15px;
    font-weight: 750;
}

.choice-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.choice-button {
    min-height: 44px;
    padding: 10px 6px;

    background: #fff;
    color: #666;

    border: 1px solid #ddd;
    border-radius: 10px;

    cursor: pointer;

    font-family: inherit;
    font-size: 13px;
    font-weight: 650;

    transition:
        background 0.2s,
        color 0.2s,
        border-color 0.2s,
        transform 0.1s;
}

.choice-button:hover {
    background: #f0f1f3;
    border-color: #bbb;
}

.choice-button:active {
    transform: scale(0.97);
}


/* 선택된 버튼 */

.choice-button.active {
    background: #222;
    color: #fff;

    border-color: #222;
}

.choice-button.active:hover {
    background: #111;
}


/* ========================================
   계산 버튼
======================================== */

.calculate-button {
    width: 100%;

    margin: 6px 0 22px;
    padding: 19px 20px;

    background: #222;
    color: #fff;

    border: none;
    border-radius: 16px;

    cursor: pointer;

    font-family: inherit;
    font-size: 18px;
    font-weight: 800;

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);

    transition:
        transform 0.15s,
        background 0.2s,
        box-shadow 0.2s;
}

.calculate-button:hover {
    background: #111;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.calculate-button:active {
    transform: scale(0.985);
}


/* ========================================
   결과 영역
======================================== */

.result-section {
    border: 2px solid #222;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-bottom: 24px;
}

.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    background: #f2f3f5;

    border-radius: 14px;

    font-size: 24px;
}

.result-header h2 {
    margin-bottom: 2px;
    font-size: 22px;
}

.result-header p {
    color: #777;
    font-size: 14px;
}


/* 결과 사람별 목록 */

#resultList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    background: #f7f8f9;

    border-radius: 12px;
}

.result-item span {
    color: #444;
    font-size: 16px;
    font-weight: 650;
}

.result-item strong {
    color: #111;
    font-size: 19px;
    font-weight: 800;
}


/* 결과 합계 */

.result-total {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 18px;
    padding-top: 18px;

    border-top: 1px solid #ddd;
}

.result-total span {
    color: #666;
    font-weight: 650;
}

.result-total strong {
    font-size: 22px;
    font-weight: 850;
}


/* 다시 계산 버튼 */

.reset-button {
    width: 100%;

    margin-top: 22px;
    padding: 14px;

    background: #f1f2f4;
    color: #444;

    border: none;
    border-radius: 12px;

    cursor: pointer;

    font-family: inherit;
    font-size: 15px;
    font-weight: 700;

    transition: background 0.2s;
}

.reset-button:hover {
    background: #e5e6e8;
}


/* ========================================
   계산 기준 설명
======================================== */

.info-card {
    margin-top: 28px;
    padding: 24px;

    background: #eef0f3;

    border-radius: 18px;
}

.info-card h2 {
    margin-bottom: 10px;
    font-size: 19px;
}

.info-card > p {
    color: #666;
    font-size: 14px;
}

.ratio-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;

    margin-top: 18px;
}

.ratio-info div {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 14px 8px;

    background: #fff;

    border-radius: 10px;

    text-align: center;
}

.ratio-info strong {
    color: #444;
    font-size: 12px;
}

.ratio-info span {
    margin-top: 4px;

    color: #111;

    font-size: 17px;
    font-weight: 800;
}

.info-note {
    margin-top: 16px;

    color: #888 !important;

    font-size: 12px !important;
    line-height: 1.6;
}


/* ========================================
   숨김 요소
======================================== */

[hidden] {
    display: none !important;
}


/* ========================================
   태블릿 / 작은 화면
======================================== */

@media (max-width: 650px) {

    .container {
        padding: 28px 14px 60px;
    }

    .header {
        margin-bottom: 24px;
    }

    .header h1 {
        font-size: 30px;
    }

    .subtitle {
        font-size: 14px;
    }

    .card {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .section-title {
        gap: 11px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .section-title h2 {
        font-size: 18px;
    }

    .price-input-group {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .person-card {
        padding: 18px 12px;
    }

    .choice-buttons {
        gap: 6px;
    }

    .choice-button {
        min-height: 46px;
        padding: 8px 3px;
        font-size: 12px;
    }

    .ratio-info {
        grid-template-columns: repeat(2, 1fr);
    }

}


/* ========================================
   아주 작은 모바일
======================================== */

@media (max-width: 380px) {

    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        padding-left: 12px;
        padding-right: 12px;
    }

    .header h1 {
        font-size: 27px;
    }

    .choice-button {
        font-size: 11px;
    }

    .people-setting {
        gap: 20px;
    }

}

/* =========================================================
   몰빵 룰렛
========================================================= */

.roulette-section {
    margin-top: 28px;
    padding: 28px 22px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}


/* 숨김 */
.hidden {
    display: none !important;
}


/* =========================================================
   룰렛 헤더
========================================================= */

.roulette-header {
    text-align: center;
    margin-bottom: 24px;
}

.roulette-badge {
    display: inline-block;
    padding: 7px 14px;
    margin-bottom: 10px;

    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 800;
}

.roulette-header h2 {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 900;
    color: #111827;
}

.roulette-header p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.7;
}


/* =========================================================
   룰렛 모드 선택
========================================================= */

.roulette-mode {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;

    margin-bottom: 22px;
}

.roulette-mode-btn {
    display: flex;
    align-items: center;
    gap: 12px;

    width: 100%;
    padding: 16px;

    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 16px;

    text-align: left;
    cursor: pointer;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.roulette-mode-btn:hover {
    transform: translateY(-2px);
    border-color: #f59e0b;
}

.roulette-mode-btn.active {
    background: #fffbeb;
    border-color: #f59e0b;

    box-shadow:
        0 6px 18px rgba(245, 158, 11, 0.14);
}

.mode-icon {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    background: #ffffff;
    border-radius: 13px;

    font-size: 23px;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.06);
}

.mode-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-text strong {
    color: #111827;
    font-size: 15px;
}

.mode-text small {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}


/* =========================================================
   확률 표시
========================================================= */

.roulette-probability-box {
    margin-bottom: 28px;
    padding: 18px;

    background: #f9fafb;
    border-radius: 18px;
}

.probability-title {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 16px;

    font-size: 14px;
    font-weight: 800;
    color: #374151;
}

#rouletteModeLabel {
    padding: 5px 10px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;

    color: #f59e0b;
    font-size: 12px;
}


/* JS에서 생성될 확률 한 줄 */

.probability-item {
    display: grid;
    grid-template-columns: minmax(55px, auto) 1fr 52px;
    align-items: center;
    gap: 10px;

    margin-bottom: 12px;
}

.probability-item:last-child {
    margin-bottom: 0;
}

.probability-name {
    overflow: hidden;

    color: #374151;
    font-size: 14px;
    font-weight: 800;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.probability-bar {
    position: relative;
    overflow: hidden;

    width: 100%;
    height: 10px;

    background: #e5e7eb;
    border-radius: 999px;
}

.probability-fill {
    width: 0;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #fbbf24,
            #f59e0b
        );

    border-radius: 999px;

    transition: width 0.4s ease;
}

.probability-percent {
    color: #111827;
    font-size: 13px;
    font-weight: 900;
    text-align: right;
}


/* =========================================================
   룰렛
========================================================= */

.roulette-wrapper {
    position: relative;

    display: flex;
    justify-content: center;

    padding-top: 28px;
    padding-bottom: 10px;
}

.roulette-wheel-container {
    position: relative;

    width: min(100%, 420px);
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* Canvas */

#rouletteWheel {
    display: block;

    width: 100%;
    height: 100%;

    border-radius: 50%;

    filter:
        drop-shadow(
            0 12px 22px
            rgba(0, 0, 0, 0.16)
        );
}


/* 룰렛 위 화살표 */

.roulette-pointer {
    position: absolute;
    top: 5px;
    left: 50%;
    z-index: 10;

    transform: translateX(-50%);

    color: #dc2626;
    font-size: 42px;
    line-height: 1;

    filter:
        drop-shadow(
            0 3px 3px
            rgba(0, 0, 0, 0.25)
        );
}


/* 가운데 돌리기 버튼 */

.roulette-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;

    transform: translate(-50%, -50%);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    width: 100px;
    height: 100px;

    background:
        linear-gradient(
            145deg,
            #111827,
            #1f2937
        );

    border: 6px solid #ffffff;
    border-radius: 50%;

    color: #ffffff;

    cursor: pointer;

    box-shadow:
        0 8px 20px
        rgba(0, 0, 0, 0.28);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.roulette-spin-btn:hover {
    transform:
        translate(-50%, -50%)
        scale(1.06);

    box-shadow:
        0 10px 26px
        rgba(0, 0, 0, 0.34);
}

.roulette-spin-btn:active {
    transform:
        translate(-50%, -50%)
        scale(0.96);
}

.roulette-spin-btn span {
    margin-bottom: 2px;
    font-size: 25px;
}

.roulette-spin-btn strong {
    font-size: 15px;
    font-weight: 900;
}


/* 돌리는 중 */

.roulette-spin-btn:disabled {
    cursor: not-allowed;
    opacity: 0.75;
}


/* =========================================================
   안내 문구
========================================================= */

.roulette-warning {
    margin: 22px 0 0;

    color: #9ca3af;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}


/* =========================================================
   결과 모달
========================================================= */

.roulette-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(17, 24, 39, 0.72);

    backdrop-filter: blur(5px);
}

.roulette-modal-content {
    width: min(100%, 420px);
    padding: 34px 24px 24px;

    background: #ffffff;
    border-radius: 26px;

    text-align: center;

    box-shadow:
        0 24px 60px
        rgba(0, 0, 0, 0.3);

    animation:
        rouletteModalPop
        0.35s ease;
}


/* 모달 등장 애니메이션 */

@keyframes rouletteModalPop {

    0% {
        opacity: 0;
        transform:
            scale(0.8)
            translateY(20px);
    }

    100% {
        opacity: 1;
        transform:
            scale(1)
            translateY(0);
    }

}


.winner-confetti {
    margin-bottom: 18px;

    font-size: 26px;
    letter-spacing: 4px;
}

.winner-label {
    margin: 0 0 10px;

    color: #6b7280;
    font-size: 14px;
    font-weight: 700;
}

#rouletteWinnerName {
    margin: 0 0 14px;

    color: #f59e0b;
    font-size: 42px;
    font-weight: 1000;

    word-break: break-word;
}

.winner-payment {
    margin: 0 0 26px;

    color: #374151;
    font-size: 17px;
}

.winner-payment strong {
    color: #dc2626;
    font-size: 24px;
    font-weight: 1000;
}


/* =========================================================
   결과 모달 버튼
========================================================= */

.roulette-result-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.roulette-result-actions button {
    min-height: 48px;
    padding: 12px 14px;

    border: none;
    border-radius: 14px;

    font-size: 14px;
    font-weight: 900;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}

.roulette-result-actions button:hover {
    transform: translateY(-1px);
}

.secondary-btn {
    background: #f3f4f6;
    color: #374151;
}

.primary-btn {
    background: #f59e0b;
    color: #ffffff;
}


/* =========================================================
   모바일
========================================================= */

@media (max-width: 640px) {

    .roulette-section {
        margin-top: 20px;
        padding: 22px 15px;

        border-radius: 20px;
    }


    /* 모드 선택 세로 배치 */

    .roulette-mode {
        grid-template-columns: 1fr;
    }


    .roulette-header h2 {
        font-size: 22px;
    }


    /* 룰렛 크기 */

    .roulette-wheel-container {
        width: min(100%, 340px);
    }


    /* 가운데 버튼 */

    .roulette-spin-btn {
        width: 82px;
        height: 82px;

        border-width: 5px;
    }

    .roulette-spin-btn span {
        font-size: 21px;
    }

    .roulette-spin-btn strong {
        font-size: 13px;
    }


    /* 화살표 */

    .roulette-pointer {
        top: 8px;
        font-size: 34px;
    }


    /* 확률 */

    .probability-item {
        grid-template-columns:
            minmax(45px, auto)
            1fr
            48px;

        gap: 8px;
    }


    /* 결과 모달 */

    #rouletteWinnerName {
        font-size: 36px;
    }

    .winner-payment strong {
        font-size: 21px;
    }

}


/* =========================================================
   아주 작은 모바일
========================================================= */

@media (max-width: 380px) {

    .roulette-section {
        padding-left: 12px;
        padding-right: 12px;
    }

    .roulette-wheel-container {
        width: 290px;
        max-width: 100%;
    }

    .roulette-result-actions {
        grid-template-columns: 1fr;
    }

}
/* =========================================================
   콘텐츠/가이드 섹션 (읽을거리 · EEAT용)
========================================================= */
.nb-guide{ max-width:820px; margin:50px auto 0; text-align:left; }
.nb-guide h2{ font-size:1.55rem; margin:0 0 16px; color:#222; }
.nb-guide h3{ font-size:1.15rem; margin:28px 0 10px; color:#2b3a99; }
.nb-guide p{ color:#555; margin-bottom:14px; line-height:1.85; }
.nb-guide .lead{ color:#333; font-size:1.05rem; }
.nb-guide b{ color:#222; }

.nb-story{
    background:linear-gradient(135deg,#eef3ff,#f4f0ff);
    border:1px solid #e2e8ff;
    border-radius:20px;
    padding:26px 28px;
    margin:22px 0;
    color:#333;
    line-height:1.95;
}
.nb-story strong{ color:#3a49b8; }

.nb-example{
    background:#fff;
    border:1px solid #eef1f7;
    border-left:5px solid #4f7cff;
    border-radius:14px;
    padding:22px 24px;
    margin:20px 0;
    box-shadow:0 10px 26px rgba(30,40,90,.06);
}
.nb-example .ex-title{ display:block; font-weight:800; color:#2b3a99; margin-bottom:14px; }
.nb-example .ex-row{
    display:flex; justify-content:space-between; gap:14px;
    padding:8px 0; border-bottom:1px dashed #eceff5; color:#555;
}
.nb-example .ex-row:last-child{ border-bottom:none; }
.nb-example .ex-bad{ color:#e5484d; font-weight:700; }
.nb-example .ex-good{ color:#1a9c6b; font-weight:700; }

.nb-faq{ margin-top:10px; }
.nb-faq details{
    background:#fff; border:1px solid #eef1f7; border-radius:14px;
    margin-bottom:12px; overflow:hidden; box-shadow:0 6px 16px rgba(0,0,0,.04);
}
.nb-faq summary{
    cursor:pointer; list-style:none; padding:18px 22px;
    font-weight:700; color:#222; position:relative;
}
.nb-faq summary::-webkit-details-marker{ display:none; }
.nb-faq summary::after{
    content:"+"; position:absolute; right:20px; top:50%;
    transform:translateY(-50%); color:#4f7cff; font-size:1.35rem;
}
.nb-faq details[open] summary::after{ content:"\2212"; }
.nb-faq details p{ padding:0 22px 20px; margin:0; color:#555; line-height:1.85; }

@media(max-width:600px){
    .nb-guide h2{ font-size:1.32rem; }
    .nb-example .ex-row{ flex-direction:column; gap:2px; }
}
