﻿/* ===== F0: 디자인 토큰 ===== */
:root {
    /* 컬러 (17개) */
    --color-bg:              #FFFFFF;
    --color-bg-card:         #F5F5F5;
    --color-bg-white:        #FFFFFF;
    --color-accent:          #1B7340;
    --color-accent-hover:    #145A32;
    --color-accent-light:    #E8F5EE;
    --color-text-primary:    #1A1A1A;
    --color-text-secondary:  #555555;
    --color-text-muted:      #888888;
    --color-border:          #E0E0E0;
    --color-border-light:    #EFEFEF;
    --color-border-strong:   #CCCCCC;
    --color-danger:          #EF4444;
    --color-danger-hover:    #991B1B;
    --color-warning:         #F59E0B;
    --color-warning-light:   #FFF8E1;
    --color-success:         #22C55E;

    /* 폰트 패밀리 */
    --font-family-base: 'Pretendard Variable', 'Pretendard', 'Malgun Gothic', '맑은 고딕', -apple-system, BlinkMacSystemFont, sans-serif;

    /* 폰트 크기 (h1~tiny, 6개) */
    --font-size-h1:    2rem;       /* 32px */
    --font-size-h2:    1.5rem;     /* 24px */
    --font-size-h3:    1.25rem;    /* 20px */
    --font-size-body:  1rem;       /* 16px */
    --font-size-small: 0.875rem;   /* 14px */
    --font-size-tiny:  0.75rem;    /* 12px */

    /* 폰트 굵기 (4개) */
    --font-weight-regular:  400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;
    --font-weight-bold:     700;

    /* 스페이싱 (xs~2xl, 8px 기반, 6개) */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;

    /* 라디우스 (sm~pill, 5개) */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-pill: 9999px;

    /* 섀도우 (3개) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.16);

    /* 트랜지션 (2개) */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

/* ===== 1. 기본 설정 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 2. 헤더 ===== */
header {
    text-align: center;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) 0;
}

header h1 {
    font-size: 26px;
    color: var(--color-accent);
    margin-bottom: 2px;
}

header p {
    font-size: var(--font-size-tiny);
    color: var(--color-text-muted);
    font-style: normal;
    letter-spacing: 0.05em;
    margin-top: 0;
}

/* ===== 3. 버튼 ===== */
button {
    width: 100%;
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: var(--color-accent);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin-bottom: 12px;
}

button:hover {
    background-color: var(--color-accent-hover);
}

button:disabled {
    background-color: var(--color-border-strong);
    cursor: not-allowed;
}


.btn-continue {
    background-color: var(--color-warning);
}

.btn-continue:hover {
    background-color: var(--color-warning);
}

/* 위험한 동작 (삭제 등) */
.btn-danger {
    background-color: var(--color-danger);
}

.btn-danger:hover {
    background-color: var(--color-danger-hover);
}

/* ===== 4. 섹션 카드 ===== */
section {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

section h2 {
    font-size: 18px;
    color: var(--color-accent);
    margin-bottom: 12px;
}

section h3 {
    font-size: 16px;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
    margin-top: 12px;
}

section h4 {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: 12px;
    margin-bottom: var(--space-sm);
}

section p {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.8;
}

/* ===== 5. 입력 폼 ===== */
label {
    display: block;
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: white;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

input[type="date"] {
    width: 100%;
    padding: 12px;
    font-size: var(--font-size-body);
    font-family: var(--font-family-base);
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-feature-settings: 'tnum';
    cursor: pointer;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

input[type="date"]:invalid {
    color: var(--color-text-muted);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    margin-left: var(--space-sm);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.hint {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.par-inputs {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 6px;
}

.par-inputs input {
    width: 100%;
    min-width: 0;
    padding: 8px 4px;
    text-align: center;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-bold);
    font-feature-settings: 'tnum';
}

/* ===== 6. 화면 전환 ===== */
.hidden {
    display: none !important;
}

main > .screen > h2 {
    text-align: center;
    margin-bottom: var(--space-md);
    color: var(--color-accent);
}

/* ===== 7. 메인 화면 - 전체 통계 ===== */
.overall-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    text-align: center;
}

.stat-item {
    padding: 12px var(--space-sm);
    background-color: var(--color-bg);
    border-radius: var(--radius-md);
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-accent);
}

/* ===== 8. 메인 화면 - 과거 라운드 목록 ===== */
#past-rounds-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.past-round-item {
    padding: 12px;
    background-color: var(--color-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.past-round-item:hover {
    border-color: var(--color-accent);
    background-color: #e8f0e8;
}

.past-round-item:active {
    transform: scale(0.98);
}

.past-round-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.past-round-date {
    font-size: 13px;
    color: var(--color-text-muted);
}

.past-round-course {
    font-size: 15px;
    font-weight: bold;
    color: var(--color-text-primary);
}

.past-round-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.past-round-score {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-accent);
}

.past-round-overunder {
    font-size: 14px;
    color: var(--color-text-muted);
}

.empty-message {
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 20px;
}

/* ===== 9. 홀 입력 화면 ===== */
.progress-bar {
    background-color: var(--color-accent);
    color: white;
    border-radius: var(--radius-lg);
    padding: var(--space-md) 20px;
    margin-bottom: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: var(--space-xs);
    opacity: 0.9;
}

.progress-score {
    font-size: 18px;
    font-weight: bold;
}

.hole-input-section {
    text-align: center;
    padding: 0 0 var(--space-md);
}

.hole-input-section h2 {
    font-size: 24px;
    margin-bottom: 30px;
}

.score-display {
    font-size: 96px;
    font-weight: bold;
    color: var(--color-text-primary);
    margin: 20px 0;
    line-height: 1;
}

.score-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.btn-circle {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-pill);
    font-size: 36px;
    padding: 0;
    margin: 0;
}

.hole-nav {
    display: flex;
    gap: 12px;
}

.hole-nav button {
    flex: 1;
    margin-bottom: 0;
}

/* ===== 10. 결과 화면 ===== */
.result-header {
    text-align: center;
    padding: 20px;
}

.result-course-name {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: var(--space-xs);
}

.result-date {
    font-size: 14px;
    color: var(--color-text-muted);
}

.result-total {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
    color: white;
}

.result-total-score {
    font-size: 80px;
    font-weight: bold;
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.result-over-under {
    font-size: 20px;
    opacity: 0.9;
}

.result-halves {
    display: flex;
    text-align: center;
    padding: 20px;
}

.result-half {
    flex: 1;
}

.result-half-label {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.result-half-score {
    font-size: 32px;
    font-weight: bold;
    color: var(--color-accent);
}

.result-half-divider {
    width: 1px;
    background-color: var(--color-border);
    margin: 0 20px;
}

.score-distribution {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
    text-align: center;
}

.dist-item {
    padding: 12px var(--space-xs);
    background-color: var(--color-bg);
    border-radius: var(--radius-md);
}

.dist-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.dist-count {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-accent);
}

.scorecard-wrapper {
    overflow-x: auto;
    margin-bottom: 12px;
}

.scorecard {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.scorecard td,
.scorecard th {
    border: 1px solid var(--color-border);
    padding: var(--space-sm) var(--space-xs);
    text-align: center;
    height: 36px;
}

.scorecard th {
    background-color: var(--color-bg);
    font-weight: bold;
    color: var(--color-text-secondary);
}

.scorecard .row-label {
    background-color: var(--color-bg);
    font-weight: bold;
    color: var(--color-text-secondary);
    width: 50px;
}

/* ===== 스코어 시각화 ===== */
.score-eagle,
.score-birdie,
.score-bogey,
.score-double-plus {
    position: relative;
    font-weight: bold;
}

.score-eagle span,
.score-birdie span,
.score-bogey span,
.score-double-plus span {
    position: relative;
    z-index: 2;
    display: inline-block;
}

.score-eagle::before,
.score-birdie::before,
.score-bogey::before,
.score-double-plus::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.score-eagle {
    background-color: #fef3c7;
    color: #92400e;
}

.score-eagle::before {
    width: 24px;
    height: 24px;
    border: 2px solid #92400e;
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 3px white, 0 0 0 5px #92400e;
}

.score-birdie {
    background-color: #dbeafe;
    color: #1e40af;
}

.score-birdie::before {
    width: 26px;
    height: 26px;
    border: 2px solid #1e40af;
    border-radius: var(--radius-pill);
}

.score-par {
    background-color: white;
    color: var(--color-text-primary);
}

.score-bogey {
    background-color: #fef3c7;
    color: #92400e;
}

.score-bogey::before {
    width: 24px;
    height: 24px;
    border: 2px solid #92400e;
}

.score-double-plus {
    background-color: #fee2e2;
    color: #991b1b;
}

.score-double-plus::before {
    width: 22px;
    height: 22px;
    border: 2px solid #991b1b;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #991b1b;
}
/* ===== 11. 프로필 카드 (메인 화면 상단) ★ A1 신규 ===== */
.profile-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background-color: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.profile-handicap {
    font-size: 13px;
    color: var(--color-text-muted);
}

.profile-hcp-block {
    text-align: right;
    margin-right: var(--space-md);
    flex-shrink: 0;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-accent);
    font-size: 20px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.btn-icon:hover {
    background-color: var(--color-accent-light);
}
/* ===== 12. 게임 모드 선택 (드롭다운) ★ A2 신규 ===== */
select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--color-text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* 화살표 아이콘 (CSS로 만든 삼각형) */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231B7340' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ===== 13. 정보 박스 (Net Score 안내 등) ★ A2 신규 ===== */
.info-box {
    background-color: var(--color-warning-light);
    border-left: 4px solid var(--color-warning);
    padding: 12px var(--space-md);
    border-radius: var(--radius-sm);
}

.info-box-title {
    font-size: 14px;
    font-weight: bold;
    color: #92400e;
    margin-bottom: 6px;
}

.info-box-content {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.info-box-content strong {
    color: var(--color-accent);
}

/* ===== 14. 퍼팅 수 입력 ★ A3 신규 ===== */
.putts-input-row {
    margin-top: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.putts-label {
    font-size: 14px;
    color: var(--color-text-muted);
}

.putts-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.putts-display {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-accent);
    min-width: 30px;
    text-align: center;
}

.btn-mini {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    font-size: 18px;
    padding: 0;
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-accent);
}

.btn-mini:hover {
    background-color: var(--color-accent-light);
}

.btn-mini:disabled {
    background-color: #f5f5f5;
    color: var(--color-border-strong);
}
/* ===== 15. 결과 화면 - Net Score / 퍼팅 통계 ★ A4 신규 ===== */

/* 게임 모드 배지 */
.game-mode-badge {
    display: inline-block;
    margin-top: var(--space-sm);
    padding: var(--space-xs) 12px;
    background-color: var(--color-accent);
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-mode-badge.net-mode {
    background-color: #7c3aed;
}

/* Gross/Net 라벨 (어떤 점수인지 명시) */
.result-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Net Score 섹션 - 보라 그라데이션 */
.result-net {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;
}

.result-net .result-label {
    color: rgba(255, 255, 255, 0.8);
}

.result-net .result-label span {
    color: #fef3c7;
    font-weight: bold;
}

.result-net-score {
    font-size: 80px;
    font-weight: bold;
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.result-net-over-under {
    font-size: 20px;
    opacity: 0.9;
}

/* 퍼팅 통계 */
.putts-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    text-align: center;
    margin-bottom: 12px;
}

.putts-stat-item {
    padding: 12px var(--space-xs);
    background-color: var(--color-bg);
    border-radius: var(--radius-md);
}

.putts-stat-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.putts-stat-value {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-accent);
}
/* =========================================
   라운드 모드 선택 화면 (2단계 B)
   ========================================= */

.mode-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.mode-card {
    width: 100%;
    padding: var(--space-lg) 20px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.mode-card:hover {
    border-color: var(--color-accent);
    background: #f1f8e9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mode-card:active {
    transform: translateY(0);
}

.mode-icon {
    font-size: 48px;
    margin-bottom: var(--space-sm);
}

.mode-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.mode-desc {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}
/* =========================================
   사용자 이름 입력 화면 (2단계 B)
   ========================================= */

#input-user-name {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-family: inherit;
}

#input-user-name:focus {
    border-color: var(--color-accent);
    outline: none;
}

/* =========================================
   공유 링크 표시 화면 (2단계 B)
   ========================================= */

.share-info {
    background: var(--color-bg-card);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}

.share-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.share-code {
    font-size: 36px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
    letter-spacing: 0.1em;
    background: var(--color-bg-card);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-feature-settings: 'tnum';
}

.share-link-box {
    display: flex;
    gap: var(--space-sm);
}

.share-link-box input {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-family: inherit;
    color: var(--color-text-primary);
}

#btn-copy-link,
#btn-copy-tournament-link {
    padding: 12px var(--space-md);
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

#btn-copy-link:hover,
#btn-copy-tournament-link:hover {
    background: var(--color-accent-hover);
}

.copy-feedback {
    margin-top: var(--space-sm);
    color: var(--color-accent);
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}

.share-members {
    background: var(--color-bg);
    padding: 12px;
    border-radius: var(--radius-md);
}

.share-member {
    padding: var(--space-sm) 0;
    font-size: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.share-member:last-child {
    border-bottom: none;
}
/* =========================================
   라운드 참여 확인 화면 (2단계 B - B5)
   ========================================= */

.join-info {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.join-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.join-row:last-child {
    border-bottom: none;
}

.join-label {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.join-value {
    font-size: 16px;
    color: var(--color-accent);
    font-weight: bold;
    text-align: right;
}

#join-share-code {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.join-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    font-size: 16px;
}

.join-error {
    background: #ffebee;
    border: 2px solid #c62828;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

/* G-티박스3: 성별 미설정 차단 박스 */
.gender-required-notice {
    background: var(--color-warning-light);
    border: 2px solid var(--color-warning);
    border-radius: var(--radius-lg);
    padding: 14px var(--space-md);
    margin: var(--space-md) 0;
}
.gender-required-title {
    font-size: 15px;
    font-weight: bold;
    color: #b85c00;
    margin-bottom: 6px;
}
.gender-required-body {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}
.gender-required-notice button {
    margin-bottom: 0;
}

/* G-티박스3 묶음 C: 프록시 멤버 성별 라디오 */
.gender-radio-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}
.gender-radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px var(--space-md);
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-body);
    transition: var(--transition-base);
    margin-bottom: 0;
}
.gender-radio-option:has(input:checked) {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
    font-weight: var(--font-weight-semibold);
}
.gender-radio-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.error-message {
    color: #c62828;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

/* =========================================
   ★ B6: 공유 라운드 — 실시간 동기화 UI
   ========================================= */

/* 공유 모드 배지 (홀 입력 화면 상단) */
.shared-mode-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: var(--space-sm) 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    animation: pulse-shared 2s ease-in-out infinite;
}

@keyframes pulse-shared {
    0%, 100% { box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 2px 12px rgba(59, 130, 246, 0.6); }
}

/* 멤버 미니 스트립 (가로 스크롤) */
.members-strip {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    overflow-y: hidden;
    padding: var(--space-sm) var(--space-xs) 12px var(--space-xs);
    margin-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.members-strip::-webkit-scrollbar {
    height: 4px;
}

.members-strip::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.members-strip::-webkit-scrollbar-track {
    background: transparent;
}

/* 멤버 칩 (1명) */
.member-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 0 0 auto;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-tiny);
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: transform 0.15s ease;
}

.member-chip:active {
    transform: scale(0.97);
}

/* 본인 칩 강조 */
.member-chip-me {
    border-color: var(--color-accent);
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
    background: var(--color-accent-light);
}

/* 라운드 완료된 멤버 */
.member-chip-done {
    opacity: 0.85;
}

.member-chip-done::after {
    content: "✓";
    margin-left: var(--space-xs);
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
}

.member-chip-done.member-chip-me {
    opacity: 1;
}

/* 칩 안의 이름 */
.chip-name {
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    white-space: nowrap;
}

.member-chip-me .chip-name {
    color: var(--color-accent);
}

/* 칩 안의 통계 (홀 · 스코어) */
.chip-stats {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    font-size: var(--font-size-tiny);
    color: var(--color-text-muted);
}

.chip-hole {
    background: var(--color-bg-card);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
}

.member-chip-me .chip-hole {
    background: var(--color-accent);
    color: white;
}

.chip-score {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    white-space: nowrap;
}

.chip-putts {
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* 멤버 데이터 로딩 중 */
.member-chip-loading {
    flex: 1;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
    padding: 10px;
}

/* 과거 라운드 목록의 공유 라운드 배지 */
.shared-badge-mini {
    display: inline-block;
    margin-right: var(--space-xs);
    font-size: 12px;
    opacity: 0.85;
}

/* =========================================
   정모 만들기 화면 (2단계 C)
   ========================================= */

.team-config-section {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.team-config-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.team-config-col {
    flex: 1;
}

.team-config-col label {
    display: block;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.team-config-col select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    font-family: inherit;
}

.member-count-preview {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: var(--color-accent-light);
    border-radius: 10px;
    color: var(--color-accent);
    margin-top: var(--space-sm);
}

.member-count-preview strong {
    font-size: 24px;
    font-weight: bold;
}

.member-count-label {
    font-size: 15px;
}

.member-count-preview.over-cap {
    background: #ffebee;
    color: #c62828;
}

#member-count-warning {
    color: #c62828;
    margin-top: var(--space-sm);
    font-weight: 500;
}

/* =========================================
   정모 코드/링크 화면 (2단계 C - C1-3)
   ========================================= */

.tournament-name-display {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: var(--space-xs);
}

.tournament-meta-display {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* 정모 코드 화면 - Net 정모 안내 박스 (C2-1) */
.net-notice-box {
    background: var(--color-warning-light);
    border: 2px solid #ffc107;
    border-radius: var(--radius-lg);
    padding: 14px var(--space-md);
    margin: var(--space-md) 0;
}

.net-notice-title {
    font-size: 15px;
    font-weight: bold;
    color: #b85c00;
    margin-bottom: 6px;
}

.net-notice-body {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* 정모 참여 화면 - 본인 정보 미리보기 (C2-2) */
.my-profile-preview {
    background: var(--color-accent-light);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.my-profile-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 10px;
}

/* 정모 코드 박스 (코드 + 복사 버튼 가로 배치) - C2-2 추가 */
.share-code-box {
    display: flex;
    align-items: stretch;
    gap: var(--space-sm);
}

.share-code-box .share-code {
    flex: 1;
    margin: 0;
    /* 박스 안에서 코드가 가운데 정렬되게 */
    display: flex;
    align-items: center;
    justify-content: center;
    /* 폰트 크기 살짝 줄여서 버튼과 균형 */
    font-size: 28px;
    padding: 12px var(--space-sm);
}

.btn-copy-code {
    padding: 10px var(--space-md);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
    background: var(--color-bg);
    color: var(--color-accent);
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    width: auto;
    transition: var(--transition-base);
}

.btn-copy-code:hover {
    background: var(--color-accent-light);
}

.btn-copy-code:active {
    transform: scale(0.97);
}

/* 모바일에서는 세로 배치 (코드가 워낙 큰 글자라 가로 배치는 답답할 수 있음) */
@media (max-width: 480px) {
    .share-code-box {
        flex-direction: column;
        gap: var(--space-sm);
    }
    .btn-copy-code {
        padding: 12px;
        width: 100%;
    }
}

/* =========================================
   정모 대기실 (2단계 C - C2-3)
   ========================================= */

.waiting-code-section,
.waiting-link-section {
    margin-bottom: 12px;
}

.waiting-members-section {
    margin-bottom: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
}

.waiting-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.waiting-members-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-accent);
}

.waiting-members-count {
    font-size: 14px;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    padding: var(--space-xs) 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.waiting-members-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.waiting-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    font-size: 15px;
    transition: all 0.2s;
}

.waiting-member.is-me {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
    border-width: 2px;
    font-weight: 500;
}

.waiting-member.is-host {
    background: var(--color-warning-light);
    border-color: #ffc107;
}

.waiting-member.is-host.is-me {
    background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-warning-light) 100%);
    border-color: var(--color-accent);
    border-width: 2px;
}

.waiting-member-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.waiting-member-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waiting-member-badge {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.waiting-member-badge-proxy {
    color: #1565c0;
    background: #e3f2fd;
}

.btn-delete-proxy {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 15px;
    cursor: pointer;
    padding: 2px var(--space-xs);
    opacity: 0.7;
}

.btn-delete-proxy:hover {
    opacity: 1;
}

/* D8: 프록시 입력 대상 토글 스트립 */
.proxy-targets {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 12px;
    background: #f0f4ff;
    border-bottom: 1px solid #c5cae9;
    overflow-x: auto;
}

.proxy-targets-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.proxy-targets-list {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.proxy-target-btn {
    font-size: 13px;
    padding: var(--space-xs) 10px;
    border: 1px solid #9fa8da;
    border-radius: 20px;
    background: var(--color-bg);
    cursor: pointer;
    white-space: nowrap;
    color: #3949ab;
}

.proxy-target-btn.active {
    background: #3949ab;
    color: var(--color-bg);
    border-color: #3949ab;
}

.waiting-member-handicap {
    font-size: 13px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

/* 새로 들어온 멤버 깜빡 애니메이션 */
@keyframes member-enter {
    0% { transform: scale(0.95); background: #c8e6c9; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.waiting-member.just-joined {
    animation: member-enter 0.6s ease-out;
}

/* 호스트/게스트 안내 박스 */
.waiting-host-notice {
    background: var(--color-warning-light);
    border: 2px solid #ffc107;
    border-radius: var(--radius-lg);
    padding: 14px var(--space-md);
    margin: var(--space-md) 0;
}

.waiting-guest-notice {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: var(--radius-lg);
    padding: 14px var(--space-md);
    margin: var(--space-md) 0;
}

.waiting-notice-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.waiting-host-notice .waiting-notice-title {
    color: #b85c00;
}

.waiting-guest-notice .waiting-notice-title {
    color: #1565c0;
}

.waiting-notice-body {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* 빈 상태 (멤버 0명일 때 보여줄 일은 거의 없지만 방어적으로) */
.waiting-members-list:empty::after {
    content: '아직 참여자가 없습니다';
    display: block;
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

/* =========================================
   팀 배정 화면 (2단계 C - C3)
   ========================================= */
.team-status-msg {
    text-align: center;
    padding: var(--space-md);
    color: var(--color-text-secondary);
    font-size: 14px;
}

.team-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: var(--space-md) 0;
}

@media (max-width: 360px) {
    .team-cards-grid {
        grid-template-columns: 1fr;
    }
}

.team-card {
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease;
}

.team-card-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: var(--space-xs);
}

.team-card-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.team-card-members {
    flex: 1;
}

.team-card-empty {
    font-size: 12px;
    color: #999;
    font-style: italic;
    text-align: center;
    margin: 12px 0;
}

/* =========================================
   팀 배정 화면 - 자동 배정 버튼 + 멤버 칩 (C3-3)
   ========================================= */

.auto-assign-section {
    margin-top: 20px;
}

.auto-assign-buttons {
    display: flex;
    gap: 12px;
}

.btn-auto-assign {
    flex: 1;
    min-height: 60px;
    font-size: 16px;
    font-weight: 600;
    background-color: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    padding: 12px;
}

.btn-auto-assign:hover {
    background-color: #1f4d39;
}

.btn-auto-assign:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auto-assign-hint {
    margin-top: 12px;
    text-align: center;
}

.team-member-chip {
    display: inline-block;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-xl);
    padding: var(--space-xs) 10px;
    margin: 3px 3px 0 0;
    font-size: 12px;
    color: var(--color-text-primary);
    white-space: nowrap;
}

.unassigned-members-area {
    background: #fff7ed;
    border: 2px dashed #fdba74;
    border-radius: var(--radius-lg);
    padding: 12px;
    margin: var(--space-md) 0;
}

.unassigned-header {
    font-size: 14px;
    font-weight: bold;
    color: #c2410c;
    margin-bottom: var(--space-sm);
}

.unassigned-chips {
    display: flex;
    flex-wrap: wrap;
}

.unassigned-chip {
    background: white;
    border-color: #fdba74;
}

/* =========================================
   팀 배정 화면 - 수동 클릭 배정 (C3-4)
   ========================================= */

.team-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fef3c7;
    border: 2px solid var(--color-warning);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 12px 0;
}
.selection-text {
    font-size: 14px;
    color: #92400e;
}
.selection-text strong {
    color: #78350f;
}
.btn-cancel-selection {
    min-height: 36px;
    padding: 6px 14px;
    background: white;
    color: #78350f;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
}
.btn-cancel-selection:hover {
    background: #fef9c3;
}

.team-card-unassigned {
    border-style: dashed !important;
}

.team-card.drop-target {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.team-card.drop-target:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.team-member-chip.clickable {
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.15s ease;
    user-select: none;
}
.team-member-chip.clickable:hover {
    border-color: var(--color-accent);
}

.team-member-chip.chip-selected {
    border: 2px solid var(--color-warning) !important;
    background: #fef3c7 !important;
    color: #78350f !important;
    font-weight: 600;
    animation: chip-bounce 0.6s ease-in-out infinite;
}

@keyframes chip-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.team-member-chip {
    min-height: 28px;
    line-height: 20px;
}

/* =========================================
   팀 배정 화면 - 팀 이름 편집 + 라운드 시작 (C3-5)
   ========================================= */

.team-card-header-editable {
    cursor: pointer;
}
.team-card-header-editable:hover {
    opacity: 0.75;
}
.team-card-edit-icon {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 2px;
}
.team-name-edit-input {
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    color: inherit;
    border: none;
    border-bottom: 2px solid currentColor;
    background: transparent;
    outline: none;
    width: 100%;
    padding: 0;
    min-width: 60px;
}
.round-start-section {
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin: var(--space-md) 0;
    text-align: center;
}
.round-start-status {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0 0 12px 0;
    min-height: 20px;
}
#btn-start-round-from-teams {
    min-height: 60px;
    font-size: 18px;
    font-weight: 700;
    background: var(--color-accent);
    width: 100%;
}
#btn-start-round-from-teams:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =========================================
   정모 라운드 모드 배지 (C4-1)
   ========================================= */
.tournament-badge {
    background: linear-gradient(135deg, var(--color-accent) 0%, #15803d 100%);
    color: white;
    border-color: #15803d;
}

/* =========================================
   라이브 리더보드 (C4-4)
   ========================================= */

.leaderboard-mode-badge {
    display: inline-block;
    background: var(--color-accent);
    color: var(--color-bg);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-medium);
    margin-bottom: 12px;
}

.leaderboard-list {
    margin: var(--space-md) 0;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: white;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 32px 1fr auto auto;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    font-feature-settings: 'tnum';
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row-me {
    background: var(--color-accent-light);
    border-left: 3px solid var(--color-accent);
    font-weight: var(--font-weight-semibold);
}

.leaderboard-row-completed .lb-hole {
    color: var(--color-accent);
    font-weight: var(--font-weight-semibold);
}

.lb-rank {
    text-align: center;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    font-size: var(--font-size-h3);
}

.lb-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.lb-hole {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-tiny);
    background: var(--color-bg-card);
    padding: var(--space-xs) 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.lb-score {
    text-align: right;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-h3);
    min-width: 48px;
}

.btn-leaderboard-link {
    display: block;
    width: 100%;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin: var(--space-sm) 0;
}

.btn-leaderboard-link:hover {
    background: #1f4d39;
}

/* =========================================
   리더보드 - 섹션 제목 + 팀 순위 (C4-5)
   ========================================= */

.leaderboard-section-title {
    margin-top: 20px;
    margin-bottom: var(--space-sm);
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    padding-left: var(--space-xs);
}

.leaderboard-section-title:first-of-type {
    margin-top: 0;
}

.leaderboard-team-list {
    margin-bottom: var(--space-md);
}

.leaderboard-team-row {
    grid-template-columns: 32px 1fr auto auto;
}

/* =========================================
   C5: 정모 종료 버튼
   ========================================= */

.btn-end-tournament {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    background: var(--color-danger);
    color: var(--color-bg);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.btn-end-tournament:hover { background: var(--color-danger); }
.btn-end-tournament:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-end-tournament.hidden { display: none !important; }

/* =========================================
   C5: 정모 최종 결과 화면 (화면 16)
   ========================================= */

.result-winner-card {
    background: linear-gradient(135deg, #fbbf24, var(--color-warning));
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    margin: 12px 0 20px;
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}
.winner-label {
    font-size: 13px;
    font-weight: 600;
    color: #78350f;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.winner-name {
    font-size: 26px;
    font-weight: 800;
    color: #1c1917;
    margin-bottom: var(--space-xs);
}
.winner-score {
    font-size: 16px;
    font-weight: 600;
    color: #44403c;
}
.winner-prize {
    font-size: 13px;
    font-weight: 600;
    color: #78350f;
    margin-top: var(--space-sm);
    line-height: 1.5;
}

/* E6 이벤트 결과 */
.event-result-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: var(--space-sm);
}
.event-result-header {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.event-result-body {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}
.event-result-none {
    font-weight: 500;
    color: #94a3b8;
}

/* E6 정산표 */
.settlement-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.settlement-row:last-child { border-bottom: none; }
.settlement-name {
    font-weight: 600;
    font-size: 14px;
    min-width: 60px;
    flex-shrink: 0;
}
.settlement-amount {
    font-size: 16px;
    font-weight: 800;
    min-width: 70px;
    text-align: right;
    flex-shrink: 0;
}
.settlement-positive .settlement-amount { color: #16a34a; }
.settlement-negative .settlement-amount { color: var(--color-danger); }
.settlement-breakdown {
    font-size: 12px;
    color: #94a3b8;
    flex: 1;
    text-align: right;
}
.settlement-disclaimer {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin-top: 10px;
    padding: var(--space-sm);
    background: #f8fafc;
    border-radius: var(--radius-md);
}

/* 스코어카드 */
.result-scorecard {
    margin: var(--space-sm) 0 20px;
}
.scorecard-table {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    font-size: 13px;
}
.scorecard-row {
    display: grid;
    grid-template-columns: 40px 40px 1fr 50px;
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}
.scorecard-row:last-child { border-bottom: none; }
.scorecard-header {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    font-size: 12px;
}
.scorecard-total {
    background: #f1f5f9;
    font-weight: 700;
    color: #1e293b;
}
.scorecard-net {
    background: #ecfdf5;
    font-weight: 700;
    color: #065f46;
}
.score-under  { color: #16a34a; font-weight: 700; }
.score-bogey  { color: #ea580c; }
.score-double { color: var(--color-danger); font-weight: 700; }

/* ===== D2: 골프장 등록 ===== */
.tee-box-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.tee-box-card label {
    display: block;
    margin-top: var(--space-sm);
    margin-bottom: var(--space-xs);
    font-size: 0.9em;
    font-weight: 600;
}

.tee-box-card h4 {
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.tee-box-card small {
    display: block;
    color: #6c757d;
    margin-bottom: var(--space-xs);
}

.yardage-inputs {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: var(--space-sm);
}

.yardage-inputs input {
    width: 100%;
    min-width: 0;
    padding: 12px 2px;
    text-align: center;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    font-feature-settings: 'tnum';
}

.tee-box-remove {
    margin-top: var(--space-sm);
    width: 100%;
    font-size: 0.9em;
}

/* D2: 내가 등록한 골프장 목록 */
.my-course-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.my-course-item:hover {
    border-color: var(--color-accent);
}

.my-course-info {
    flex: 1;
}

.my-course-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.my-course-meta {
    font-size: 0.85em;
    color: #6c757d;
}

@media (max-width: 480px) {
    .tee-box-card { padding: 10px; }
    .yardage-inputs input {
        font-size: 14px;
        padding: 10px 1px;
    }
}

/* =========================================
   D3: 골프장 자동완성
   ========================================= */
.course-autocomplete-wrap {
    position: relative;
}

.course-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.course-result-loading,
.course-result-error,
.course-result-empty {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
}

.course-result-empty p {
    margin: 0 0 var(--space-sm) 0;
}

.course-result-empty .hint {
    margin-top: var(--space-sm);
    font-size: 0.85em;
}

.course-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: nowrap;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f5;
}

.course-result-item:hover {
    background: #f8f9fa;
}

.course-result-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.course-result-name {
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-result-meta {
    font-size: 0.8em;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-result-select {
    padding: var(--space-xs) 12px;
    font-size: 0.85em;
    flex-shrink: 0;
    margin-left: var(--space-sm);
}

/* 자동완성 결과 안 버튼: 전역 button width:100% 오버라이드 */
.course-result-item .btn-outline,
.course-result-item .btn-ghost,
.course-result-item .course-result-select,
.course-result-item .course-result-detail,
.course-result-add-more .btn-outline,
.course-result-add-more .btn-ghost,
.course-result-add-more button {
    width: auto !important;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: var(--font-size-small);
}

.course-result-add-more {
    padding: var(--space-sm) 12px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    text-align: center;
}

.course-selected-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 12px;
    background: #d1e7dd;
    border: 1px solid #a3cfbb;
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
    font-size: 0.9em;
}

#course-selected-badge-text {
    flex: 1;
    color: #0a3622;
}

@media (max-width: 480px) {
    .course-autocomplete-results {
        max-height: 280px;
    }
    .course-result-name {
        font-size: 0.9em;
    }
    .course-result-meta {
        font-size: 0.75em;
    }
    .course-result-select {
        padding: var(--space-xs) 10px;
        font-size: 0.8em;
    }
}

/* D4: 티박스 선택 UI */
.tee-box-selector {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
}

.tee-box-selector > label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    font-size: 0.9em;
}

.tee-box-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tee-box-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-sm) 12px;
    background: var(--color-bg);
    border: 2px solid #dee2e6;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9em;
    transition: border-color 0.15s, background 0.15s;
}

.tee-box-option:hover {
    border-color: #6c757d;
}

.tee-box-option.active {
    border-color: #0d6efd;
    background: #e7f1ff;
    font-weight: 600;
}

.tee-box-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.tee-box-option-label {
    font-size: 0.9em;
}

.tee-box-option-rating {
    font-size: 0.75em;
    color: #6c757d;
    margin-left: var(--space-xs);
}

.tee-box-option.active .tee-box-option-rating {
    color: #0d6efd;
}

.tee-box-info {
    background: var(--color-bg);
    border: 1px solid #e9ecef;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.tee-box-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    font-size: 0.9em;
}

.tee-box-info-label {
    color: #6c757d;
}

.tee-box-info-row span:last-child {
    font-weight: 600;
}

.tee-box-info-handicap {
    border-top: 1px solid #e9ecef;
    margin-top: var(--space-xs);
    padding-top: var(--space-sm);
}

.tee-box-info-handicap span:last-child {
    color: #0d6efd;
    font-size: 1.05em;
}

/* G-티박스2: 남/여 그룹 분리 */
.tee-box-group {
    margin-bottom: 12px;
}
.tee-box-group:last-of-type {
    margin-bottom: 8px;
}
.tee-box-group-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    font-size: 0.9em;
    color: var(--color-text-primary);
}
.tee-box-group-hint {
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 0.8em;
}

@media (max-width: 480px) {
    .tee-box-option {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    .tee-box-option-rating {
        font-size: 0.7em;
    }
    .tee-box-info-row {
        font-size: 0.85em;
    }
}
/* ===== D7-2: 골프장 상세 화면 ===== */

.course-detail-info {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
}

.course-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: var(--font-size-small);
    border-bottom: 1px solid var(--color-border-light);
}

.course-detail-row:last-child {
    border-bottom: none;
}

.course-detail-label {
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.tee-detail-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.tee-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 10px;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid #e9ecef;
}

.tee-detail-label {
    font-weight: 600;
    font-size: 1.05em;
}

.tee-detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.tee-detail-holes {
    margin-top: var(--space-sm);
}

.tee-detail-holes > small {
    display: block;
    color: #6c757d;
    margin-bottom: var(--space-xs);
}

.tee-detail-holes-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
}

.tee-detail-hole-cell {
    background: #f8f9fa;
    padding: var(--space-xs) 2px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.7em;
}

.tee-detail-hole-cell > small {
    display: block;
    color: #6c757d;
    font-weight: 600;
}

.course-result-detail {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8em;
    margin-left: var(--space-xs);
    flex-shrink: 0;
    width: auto !important;
}

@media (max-width: 480px) {
    .tee-detail-holes-grid {
        gap: 1px;
    }
    .tee-detail-hole-cell {
        font-size: 0.65em;
        padding: 3px 1px;
    }
    .course-result-detail {
        padding: var(--space-xs) 6px;
        font-size: 0.75em;
    }
}

/* =========================================
   E3: 이벤트 홀 섹션 (화면 8)
   ========================================= */

.events-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.events-section-header label {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.hint-inline {
    font-size: 13px;
    color: #999;
    font-weight: normal;
}

.events-count {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.tournament-events-list {
    margin-bottom: var(--space-sm);
}

.event-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-accent-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--color-accent);
    font-weight: 600;
}

.btn-remove-event {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 15px;
    width: auto;
    padding: 2px 6px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.btn-remove-event:hover {
    background: #ffebee;
    color: #c62828;
}

.btn-add-event {
    font-size: 14px;
    padding: 10px;
    margin-bottom: 0;
    margin-top: var(--space-xs);
}

.add-event-form {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: var(--space-sm);
}

.add-event-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.add-event-row label {
    width: 48px;
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 600;
    flex-shrink: 0;
    margin: 0;
}

.add-event-row select,
.add-event-row input {
    flex: 1;
    padding: var(--space-sm);
    font-size: 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: white;
}

.add-event-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.add-event-buttons button {
    flex: 1;
    font-size: 14px;
    padding: 10px;
    margin: 0;
}

/* 화면 11: 이벤트 표시 박스 */
.events-display-box {
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: var(--radius-lg);
    padding: 12px var(--space-md);
    margin: 12px 0;
}

.events-display-header {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
}

.events-display-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.events-display-item {
    font-size: 14px;
    color: var(--color-text-primary);
    padding: var(--space-xs) 0;
}

/* 화면 12: 이벤트 조인 섹션 */
.events-join-section {
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: var(--radius-lg);
    padding: 12px var(--space-md);
    margin: var(--space-sm) 0 12px;
}

.events-join-header {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
}

.events-join-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.events-join-item {
    font-size: 14px;
    color: var(--color-text-primary);
    padding: 3px 0;
}

/* 토스트 알림 */
.toast, #toast-notification, .toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text-primary);
    color: var(--color-bg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-small);
    z-index: 10000;
    max-width: 320px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
}

.toast.toast-show, #toast-notification.toast-show, .toast-notification.toast-show {
    opacity: 1;
}

/* =========================================
   F4d: 이벤트 배너 (홀 입력 화면)
   ========================================= */
.event-banners {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.event-banner {
    background: linear-gradient(135deg,
        var(--color-warning-light) 0%,
        var(--color-bg) 100%);
    border: 2px solid var(--color-warning);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    text-align: center;
}

.event-banner-icon {
    font-size: 32px;
    margin-bottom: var(--space-xs);
}

.event-banner-title {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-bold);
    color: var(--color-warning);
    margin-bottom: var(--space-xs);
}

.event-banner-subtitle {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.event-banner-prize {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-small);
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
}

.event-banner-action {
    width: auto !important;
}

.event-banner[data-type="kp"] .event-banner-icon::before       { content: "🎯"; }
.event-banner[data-type="longest"] .event-banner-icon::before   { content: "🚀"; }
.event-banner[data-type="holeInOne"] .event-banner-icon::before { content: "🏆"; }

/* =========================================
   F4e: 모달 공통 기반
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.modal-content {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-title {
    font-size: var(--font-size-h2);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
    text-align: center;
}

.modal-subtitle {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--space-lg);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.modal-actions > button {
    flex: 1;
}

/* =========================================
   E4: 이벤트 위너 입력 모달 (override)
   ========================================= */

.event-modal-current-winner {
    background: #fef3c7;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    margin-bottom: var(--space-sm);
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.event-modal-current-winner-name {
    font-size: 22px;
    font-weight: 700;
    color: #92400e;
}

.event-modal-current-winner-label {
    font-size: 11px;
    color: #b45309;
    margin-top: 2px;
}

.event-modal-current-winner-none {
    font-size: 14px;
    color: #9ca3af;
}

.event-modal-prev-winners {
    margin-bottom: 12px;
}

.event-modal-prev-item {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 1px 0;
}

.event-winner-modal-actions {
    flex-direction: column;
}

.btn-event-winner-me {
    background: #15803d;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.btn-event-winner-me:active {
    background: #166534;
}

.event-winner-others-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.event-winner-select {
    flex: 1;
    padding: 10px var(--space-sm);
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    color: #374151;
}

.btn-sm {
    padding: 10px 14px !important;
    font-size: 14px !important;
    white-space: nowrap;
    width: auto !important;
    flex-shrink: 0;
}

.event-modal-holeinone-achieved {
    background: #fef3c7;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: var(--space-xs);
}

/* =========================================
   F4c: 라이브 알림 티커
   ========================================= */

.live-ticker {
    background: var(--color-bg-card);
    border-left: 3px solid var(--color-accent);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-small);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 40px;
    transition: opacity var(--transition-base);
}

.live-ticker.is-empty {
    display: none;
}

.live-ticker-icon {
    font-size: var(--font-size-h3);
    flex-shrink: 0;
}

.live-ticker-message {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-primary);
}

.live-ticker-message strong {
    color: var(--color-accent);
    font-weight: var(--font-weight-semibold);
}

.live-ticker[data-type="birdie"]    { border-left-color: var(--color-accent); }
.live-ticker[data-type="eagle"]     { border-left-color: var(--color-warning); }
.live-ticker[data-type="albatross"] { border-left-color: var(--color-warning); }
.live-ticker[data-type="ace"]       { border-left-color: var(--color-danger); }
.live-ticker[data-type="skin_win"]  { border-left-color: var(--color-accent); }
.live-ticker[data-type="event_win"] { border-left-color: var(--color-warning); }
.live-ticker[data-type="complete"]  { border-left-color: var(--color-text-muted); }

/* =========================================
   E5: 홀인원 폭죽 오버레이
   ========================================= */

.holeinone-celebration {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: holeinone-fadein 0.4s ease-out;
}

@keyframes holeinone-fadein {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.holeinone-message {
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: holeinone-bounce 0.6s ease-out;
    z-index: 1;
}

@keyframes holeinone-bounce {
    0%   { opacity: 0; transform: scale(0.5); }
    70%  { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.holeinone-icon {
    font-size: 80px;
    margin-bottom: var(--space-md);
}

.holeinone-title {
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-bold);
    color: var(--color-warning);
    margin-bottom: var(--space-sm);
}

.holeinone-name {
    font-size: var(--font-size-h3);
    color: var(--color-text-primary);
}

.holeinone-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.holeinone-confetti span {
    position: absolute;
    font-size: 22px;
    top: -40px;
    animation: confetti-fall 2.8s ease-in forwards;
}

.holeinone-confetti span:nth-child(1)  { left:  5%; animation-delay: 0.00s; }
.holeinone-confetti span:nth-child(2)  { left: 15%; animation-delay: 0.18s; }
.holeinone-confetti span:nth-child(3)  { left: 25%; animation-delay: 0.35s; }
.holeinone-confetti span:nth-child(4)  { left: 35%; animation-delay: 0.08s; }
.holeinone-confetti span:nth-child(5)  { left: 45%; animation-delay: 0.22s; }
.holeinone-confetti span:nth-child(6)  { left: 55%; animation-delay: 0.12s; }
.holeinone-confetti span:nth-child(7)  { left: 65%; animation-delay: 0.28s; }
.holeinone-confetti span:nth-child(8)  { left: 75%; animation-delay: 0.42s; }
.holeinone-confetti span:nth-child(9)  { left: 83%; animation-delay: 0.05s; }
.holeinone-confetti span:nth-child(10) { left: 91%; animation-delay: 0.38s; }
.holeinone-confetti span:nth-child(11) { left: 50%; animation-delay: 0.55s; }
.holeinone-confetti span:nth-child(12) { left: 30%; animation-delay: 0.48s; }

@keyframes confetti-fall {
    0%   { transform: translateY(0)     rotate(0deg);   opacity: 1; }
    100% { transform: translateY(105vh) rotate(380deg); opacity: 0.2; }
}

/* =========================================
   E7: 결과 공유 모달
   ========================================= */

.share-modal-overlay {
    align-items: flex-start;
    padding: var(--space-lg) var(--space-md) 40px;
    overflow-y: auto;
}

.share-modal-actions {
    flex-direction: column;
}

.share-preview {
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-preview-img {
    width: 100%;
    display: block;
}

.share-generating-hint {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: normal;
    padding: 12px 0;
    margin: 0;
}

.share-modal-actions button {
    margin-bottom: 0;
}

/* =========================================
   E1: 골프룰 이해 화면
   ========================================= */

.golf-rules-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--space-md);
}

.golf-rules-header .btn-sm {
    flex-shrink: 0;
    width: auto !important;
    padding: var(--space-sm) 14px;
    font-size: 14px;
    margin-bottom: 0;
}

.golf-rules-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    color: var(--color-text-primary);
    margin: 0;
}

.golf-rule-counter {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: normal;
    min-width: 40px;
    text-align: right;
}

.golf-rule-carousel-wrap {
    touch-action: pan-y;
    margin-bottom: 20px;
}

.golf-rule-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 28px var(--space-lg) var(--space-lg);
    box-shadow: var(--shadow-md);
    min-height: 320px;
}

.golf-rule-icon {
    font-size: 52px;
    text-align: center;
    margin-bottom: 12px;
    line-height: 1;
}

.golf-rule-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-align: center;
    margin-bottom: 20px;
}

.golf-rule-section {
    margin-bottom: var(--space-md);
}

.golf-rule-section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.golf-rule-section-body {
    font-size: 15px;
    color: var(--color-text-primary);
    line-height: 1.6;
    margin: 0;
    font-weight: normal;
}

.golf-rule-procedure {
    padding-left: 20px;
    margin: 0;
}

.golf-rule-procedure li {
    font-size: 15px;
    color: var(--color-text-primary);
    line-height: 1.6;
    margin-bottom: 6px;
}

.golf-rule-procedure li:last-child {
    margin-bottom: 0;
}

.golf-rule-exception-section {
    background: #fffbf0;
    border-left: 3px solid var(--color-warning);
    padding: 10px 12px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 0;
}

.golf-rule-exception-section .golf-rule-section-label {
    color: #b45309;
}

.golf-rule-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.golf-rule-arrow {
    width: auto !important;
    padding: 10px 18px !important;
    font-size: 16px !important;
    font-weight: bold;
    margin-bottom: 0;
    flex-shrink: 0;
    background-color: transparent !important;
    color: var(--color-accent) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    transition: var(--transition-fast) !important;
}

.golf-rule-arrow:hover:not(:disabled) {
    background-color: var(--color-accent-light) !important;
    border-color: var(--color-accent) !important;
}

.golf-rule-arrow:disabled {
    background-color: transparent !important;
    color: var(--color-border-strong) !important;
    border-color: var(--color-border-light) !important;
    cursor: not-allowed;
}

.golf-rule-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    flex: 1;
}

.golf-rule-dot {
    width: 10px !important;
    height: 10px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background-color: var(--color-border-strong) !important;
    margin-bottom: 0;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    transform: scale(0.6);
}

.golf-rule-dot.active {
    background-color: var(--color-accent) !important;
    transform: scale(1.0);
}

.golf-rule-dot:hover:not(:disabled) {
    background-color: var(--color-text-muted) !important;
    transform: scale(0.8);
}

/* =========================================
   E8: 대기방 채팅
   ========================================= */

.chat-section {
    margin-top: 20px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #f9fafb;
}

.chat-header {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.chat-messages {
    height: min(50vh, 300px);
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--color-bg);
}

.chat-empty-msg {
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    margin: auto;
    padding: 20px 0;
}

/* 메시지 행 */
.chat-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    gap: 2px;
}

.chat-msg-row.own {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg-row.other {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg-name {
    font-size: 11px;
    color: #6b7280;
    padding: 0 var(--space-xs);
    margin-bottom: 1px;
}

.chat-msg-name .chat-host-crown {
    font-size: 11px;
    margin-left: 2px;
}

/* 버블 + 시간 묶음 */
.chat-bubble-wrap {
    display: flex;
    align-items: flex-end;
    gap: var(--space-xs);
}

.chat-msg-row.own .chat-bubble-wrap {
    flex-direction: row-reverse;
}

.chat-bubble {
    padding: var(--space-sm) 12px;
    border-radius: var(--radius-xl);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-bubble.own {
    background: #FEE500;
    color: #000;
    border-bottom-right-radius: 4px;
}

.chat-bubble.other {
    background: var(--color-bg);
    color: #111;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.chat-time {
    font-size: 10px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-bottom: 2px;
}

/* 입력창 영역 */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: var(--space-sm) 10px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: var(--space-sm) 14px;
    font-size: 14px;
    line-height: 1.4;
    max-height: calc(4 * 1.4 * 14px + 16px);
    overflow-y: auto;
    background: var(--color-bg);
    outline: none;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--color-accent);
}

.chat-send-btn {
    width: auto !important;
    padding: var(--space-sm) 14px !important;
    margin-bottom: 0;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600;
    background: var(--color-accent);
    color: var(--color-bg);
    flex-shrink: 0;
    line-height: 1.4;
    transition: opacity 0.15s;
}

.chat-send-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
}

.chat-char-counter {
    font-size: 11px;
    color: #6b7280;
    text-align: right;
    padding: 0 12px 6px;
}

.chat-char-counter.warn {
    color: #6b7280;
}

.chat-char-counter.danger {
    color: var(--color-danger);
    font-weight: 600;
}

/* 컨텍스트 메뉴 */
.chat-context-menu {
    position: fixed;
    z-index: 9990;
    background: var(--color-bg);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    min-width: 140px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.chat-context-item {
    width: 100% !important;
    padding: 13px 18px !important;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    margin-bottom: 0;
    border-radius: 0 !important;
}

.chat-context-item:last-child {
    border-bottom: none;
}

.chat-context-item:hover {
    background: #f3f4f6;
}

.chat-context-delete {
    color: var(--color-danger) !important;
    font-weight: 600;
}

/* =========================================
   F2: 컴포넌트 클래스 (공통 카드 + 버튼)
   ========================================= */

.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.card-elevated { box-shadow: var(--shadow-lg); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.card-title {
    font-size: var(--font-size-h3);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.card-meta {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-semibold);
    color: var(--color-bg);
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0;
    transition: var(--transition-base);
}

.btn-primary:hover { background: var(--color-accent-hover); transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-semibold);
    color: var(--color-accent);
    background: var(--color-bg);
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0;
    transition: var(--transition-base);
}

.btn-outline:hover { background: var(--color-accent-light); transform: scale(1.02); }
.btn-outline:active { transform: scale(0.98); }

.btn-ghost {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0;
    transition: var(--transition-base);
}

.btn-ghost:hover { border-color: var(--color-border-strong); }

.metric-large {
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
    line-height: 1;
}

.label-muted {
    font-size: var(--font-size-tiny);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card > button {
    margin-bottom: 0;
}

/* =========================================
   F3: 신규 디자인 어휘
   ========================================= */

.field-group {
    margin-bottom: var(--space-md);
}

.field-group label {
    display: block;
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
    font-weight: var(--font-weight-medium);
}

.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
    font-size: 15px;
    transition: all 0.2s;
}

.member-row.is-me {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
    border-width: 2px;
    font-weight: 500;
}

.member-row.is-host {
    background: var(--color-warning-light);
    border-color: #ffc107;
}

.member-row.is-host.is-me {
    background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-warning-light) 100%);
    border-color: var(--color-accent);
    border-width: 2px;
}

.code-display {
    font-size: 36px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.1em;
    color: var(--color-text-primary);
    text-align: center;
    padding: var(--space-md);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    font-feature-settings: 'tnum';
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-pill);
}

.badge-accent {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-muted {
    background: var(--color-bg-card);
    color: var(--color-text-muted);
}

/* F3.1: 파/거리 입력 행 (라벨 + 9칸 그리드) */
.par-row, .yardage-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.par-row-label, .yardage-row-label {
    flex-shrink: 0;
    width: 36px;
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.par-row .par-inputs,
.yardage-row .yardage-inputs {
    flex: 1;
    min-width: 0;
}

/* =========================================
   F4a: 라운드 진행 화면 디자인 어휘
   ========================================= */

.card-compact {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.metric-xl {
    font-size: 64px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
}

.hole-header {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
}

.hole-header .label-muted {
    margin-bottom: var(--space-xs);
}

.hole-header-meta {
    margin-top: var(--space-sm);
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
}

.member-row-compact {
    display: flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-small);
    border-bottom: 1px solid var(--color-border);
}

.member-row-compact:last-child { border-bottom: none; }

.member-row-compact .member-status {
    margin-left: auto;
    color: var(--color-text-muted);
    font-size: var(--font-size-tiny);
}

/* =========================================
   F4b: 리더보드 + 멤버 표시 디자인 어휘
   ========================================= */

/* 점수 색 (over/under par) */
.lb-score.is-negative { color: var(--color-accent); }
.lb-score.is-positive { color: var(--color-danger); }
.lb-score.is-even     { color: var(--color-text-primary); }

/* 1위 황금색 */
.lb-rank.rank-1 { color: var(--color-warning); }

/* 개인/팀 탭 (미래 사용 대비) */
.leaderboard-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--space-md);
}

.leaderboard-tab {
    flex: 1;
    padding: var(--space-sm);
    text-align: center;
    font-size: var(--font-size-small);
    font-family: var(--font-family-base);
    color: var(--color-text-muted);
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    width: auto !important;
    transition: var(--transition-base);
}

.leaderboard-tab.is-active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: var(--font-weight-semibold);
}

/* 팀 행 + 색상 dot (미래 JS 연동 대비) */
.team-row {
    display: grid;
    grid-template-columns: 32px 12px 1fr auto;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    font-feature-settings: 'tnum';
}

.team-row:last-child { border-bottom: none; }

.team-color-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

/* =========================================
   F5: 정모 결과 화면 + Canvas 공유 모달
   ========================================= */

.result-header-card {
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.result-header-meta {
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
    margin: 0;
}

/* 우승자 카드 */
.winner-card {
    background: var(--color-warning-light);
    border: 1.5px solid var(--color-warning);
    border-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.winner-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.winner-title {
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.15em;
    color: var(--color-warning);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.winner-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.winner-score {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
}

.winner-prize {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
    color: var(--color-accent);
    margin-top: var(--space-sm);
    line-height: 1.5;
}

/* 이벤트 위너 목록 */
.event-winners-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.event-winner-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
}

.event-winner-row.is-none {
    opacity: 0.55;
}

.event-winner-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.event-winner-info {
    flex: 1;
    min-width: 0;
}

.event-winner-name {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-winner-hole {
    font-size: var(--font-size-tiny);
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* 정산 토글 */
.settlement-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    cursor: pointer;
    margin-bottom: var(--space-xs);
    text-align: left;
}

.settlement-toggle-arrow {
    font-size: 10px;
    color: var(--color-text-muted);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.settlement-toggle.is-open .settlement-toggle-arrow {
    transform: rotate(180deg);
}

/* 결과 액션 버튼 영역 */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.result-actions > button {
    margin-bottom: 0;
}

