/* ==========================================
   여행 계산기 공통 CSS - 골드 샴페인 테마
   ========================================== */

@charset "UTF-8";

:root {
    /* 골드 샴페인 테마 (Premium Dark) */
    --bg-body: #0a0c10;       
    --bg-deep: #0f1115;       
    --bg-gradient: radial-gradient(circle at 50% -10%, #1f232d 0%, #0f1115 80%);
    --bg-card: #12151c;
    
    /* 호환성 변수 (expenses.css 등에서 사용) */
    --bg-primary: #0a0c10;
    --bg-secondary: #0f1115;
    --bg-tertiary: #1a1d26;
    
    --primary: #e2c068;       
    --primary-dim: rgba(226, 192, 104, 0.1);
    --primary-hover: #d4af37;
    --secondary: #848b9c;     
    --danger: #ff6b6b;
    --success: #4ade80;
    --warning: #fbbf24;
    
    /* 텍스트 색상 */
    --text-main: #ffffff;
    --text-sub: #848b9c;
    
    /* 호환성 변수 (expenses.css 등에서 사용) */
    --text-primary: #ffffff;
    --text-secondary: #848b9c;
    
    /* 키패드 */
    --key-bg: rgba(255, 255, 255, 0.03);
    --key-active: rgba(255, 255, 255, 0.08);
    
    /* 테두리 */
    --border-primary: rgba(255,255,255,0.08);
    --border-secondary: rgba(255,255,255,0.05);
    
    /* 그림자 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.4);
    
    /* 트랜지션 */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Safe Area */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    touch-action: manipulation;  /* 더블탭 줌 비활성화 */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    min-height: 100vh;
}

button, a, select, input {
    touch-action: manipulation;
}

/* ==========================================
   데스크탑 공통 요소 (1024px 이상)
   ========================================== */
.desktop-elements { display: none; }

@media (min-width: 1024px) {
    .desktop-elements { display: block; }
}

/* ==========================================
   글로벌 네비게이션
   ========================================== */
.global-nav {
    background: #050505;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0;
}

.global-nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    letter-spacing: 1px;
    text-decoration: none;
    margin-right: 2rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--text-sub);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 1rem 1.25rem;
    display: block;
    transition: all var(--transition-base);
    border-left: 1px solid rgba(255,255,255,0.1);
}

.nav-menu li:first-child a {
    border-left: none;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.nav-menu .active > a {
    background: rgba(255,255,255,0.15);
    font-weight: 600;
    color: var(--primary);
}

/* 드롭다운 */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: #12151c;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1001;
    display: none;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    color: var(--text-main);
    padding: 0.625rem 0.875rem;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8125rem;
}

.nav-dropdown-content a:hover {
    background: rgba(255,255,255,0.05);
}

.nav-dropdown-content a:last-child {
    border-bottom: none;
}

/* 모바일 메뉴 버튼 (데스크탑에서 숨김) */
.mobile-menu-btn {
    display: none;
}

/* ==========================================
   브레드크럼
   ========================================== */
.breadcrumb {
    background: #080808;
    padding: 12px 0;
    font-size: 0.8rem;
    color: var(--text-sub);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.breadcrumb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb a {
    color: var(--text-sub);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-sub);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--text-main);
}

/* ==========================================
   메인 타이틀
   ========================================== */
.main-title-section {
    padding: 60px 0 40px;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, #1a1d26 0%, var(--bg-body) 100%);
}

.main-title-section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.title-icon {
    font-size: 2.5rem;
}

.main-subtitle {
    color: var(--text-sub);
    font-size: 1.1rem;
    margin: 0;
}

/* ==========================================
   레이아웃
   ========================================== */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 1.75rem;
    padding: 1.75rem 1.5rem;
}

.calculator-wrapper {
    width: 100%;  /* ✅ 모바일: 화면에 맞춤 */
    min-width: 360px;  /* ✅ 최소 360px (Galaxy 기준) */
    max-width: none;  /* ✅ 모바일: 제한 없음 */
    flex-shrink: 0;
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 90px);
}

.calculator-card {
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    height: calc(100vh - 90px - 64px);  /* 🔥 하단 네비 64px 감안 */
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-primary);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary);
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-fallback {
    color: #0f1115;
    font-weight: 700;
    font-size: 0.8rem;
}

.author-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.update-badge {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.3125rem 0.625rem;
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    font-weight: 500;
    white-space: nowrap;
}

.calculator-body {
    background: var(--bg-secondary);
    padding: 0.875rem 0.875rem 0.5rem 0.875rem;  /* ✅ 아래 여백 줄임 */
    overflow: hidden;
    flex: 1;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 0.9rem;  /* ✅ 0.75rem → 0.9rem (크림색 아래 여백 증가) */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* ==========================================
   탭 스타일
   ========================================== */
.calculator-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    background: var(--bg-primary);
    padding: 3px;
    border-radius: 8px;
}

.tab-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 0.5rem;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-base);
    font-size: 1.1rem;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tab-link:hover {
    background: var(--bg-card);
}

.tab-link.active {
    background: var(--travel-primary);
    color: white;
}

/* ==========================================
   변환 영역
   ========================================== */
.convert-area {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;  /* ✅ 0.5rem → 0.25rem (여백 축소) */
    padding: 0.75rem;  /* ✅ 패딩 추가 */
    background: #FFF9F0;  /* ✅ 크림색 배경 */
    border-radius: 12px;  /* ✅ 둥근 모서리 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);  /* ✅ 부드러운 그림자 */
}

.rate-info {
    font-size: 0.625rem;
    color: #555;  /* ✅ 어두운 텍스트 */
    text-align: center;
    padding: 0.375rem 0.5rem;
    background: rgba(0,0,0,0.03);  /* ✅ 연한 회색 */
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.05);  /* ✅ 연한 테두리 */
    line-height: 1.4;
    margin-bottom: 0.75rem;  /* ✅ 입력창과의 여백 추가 */
}

.rate-display {
    font-size: 0.75rem;
    color: var(--calc-blue);
    font-weight: 600;
    text-align: center;
    padding: 0.375rem 0.625rem;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.operation-display {
    font-size: 10px;  /* ✅ 0.6875rem(11px) → 10px */
    color: #666;
    text-align: right;
    padding: 0.25rem 0.5rem;
    min-height: 0;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.05);
    display: none;
    line-height: 1.3;  /* ✅ 줄 높이 */
    max-height: 26px;  /* ✅ 2줄 제한 (10px × 1.3 × 2 = 26px) */
    overflow: hidden;  /* ✅ 넘치면 숨김 */
    word-break: break-all;  /* ✅ 숫자도 줄바꿈 */
    
    /* ⚡ 성능 최적화 */
    will-change: contents;
    transform: translateZ(0);
}

.operation-display:not(:empty) {
    display: block;
}

.convert-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0.5rem;
    align-items: start;  /* ✅ 위에서부터 정렬 */
}

/* ✅ 2줄 레이아웃 - 통화 섹션 */
.currency-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ✅ 2줄 레이아웃 - 금액 섹션 */
.amount-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;  /* ✅ 오른쪽 정렬 */
    width: 100%;  /* ✅ 그리드 셀 전체 너비 */
    min-width: 0;  /* ✅ overflow 방지 */
}

/* ✅ 통화 코드 (VND, KRW 등) */
.currency-code {
    font-size: 0.6875rem;  /* 11px */
    color: #999;
    font-weight: 600;
    padding-left: 0.125rem;
}

/* ✅ 금액 숫자 영역 */
.amount-number {
    display: flex;
    flex-direction: row-reverse;  /* ✅ 기호를 앞으로 */
    align-items: center;
    justify-content: flex-start;  /* ✅ row-reverse에서 오른쪽 정렬 */
    gap: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    text-align: right;
    border-bottom: 2px solid rgba(0,0,0,0.2);  /* ✅ 밑줄 항상 표시 */
    padding: 0.5rem 0.25rem;
    width: 100%;  /* ✅ 전체 너비 */
    min-width: 100%;  /* ✅ 최소 너비 보장 */
    max-width: 100%;  /* ✅ 부모 너비 초과 방지 */
    box-sizing: border-box;  /* ✅ padding 포함 */
    
    /* ⚡ 성능 최적화 */
    will-change: contents;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ✅ 한글 표시 영역 */
.amount-korean {
    font-size: 0.75rem;  /* 12px */
    color: #666;
    font-weight: 500;
    text-align: right;
    padding: 0.125rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* ⚡ 성능 최적화 */
    will-change: contents;
    transform: translateZ(0);
}
    max-width: 100%;
    min-height: 1.2em;  /* ✅ 항상 공간 차지 */
    display: block;  /* ✅ 항상 표시 */
}

/* ✅ 스왑 + 연산 행 - 2열 그리드 */
.swap-operation-row {
    display: grid;
    grid-template-columns: 40px 1fr;  /* 스왑 버튼 | 연산창 */
    gap: 0.5rem;
    align-items: center;
    padding: 0.15rem 0;  /* ✅ 0.25rem → 0.15rem (여백 축소 -2~3px) */
}

.currency-select {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;  /* ✅ 테두리 제거 */
    border-bottom: 2px solid rgba(0,0,0,0.15);  /* ✅ 밑줄만 */
    border-radius: 0;  /* ✅ 둥글기 제거 */
    background: transparent;  /* ✅ 투명 배경 */
    color: #1a1a1a;  /* ✅ 검은색 텍스트 */
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.currency-select:focus {
    outline: none;
    border-color: var(--travel-primary);  /* ✅ 초록색 포커스 */
}

.amount-display {
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    text-align: right;  /* ✅ 오른쪽 정렬 */
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.2);  /* ✅ 밑줄 */
    border-radius: 0;
    background: transparent;  /* ✅ 투명 배경 */
    color: #1a1a1a;  /* ✅ 검은색 텍스트 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;  /* ✅ 부모 너비 초과 방지 */
    display: flex;  /* ✅ flex 사용 */
    flex-direction: row-reverse;  /* ✅ 기호를 앞으로 */
    align-items: center;
    justify-content: flex-start;
}

.swap-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #1a5e3f;  /* ✅ 초록색 (travel-primary) */
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;  /* ✅ auto 제거! 왼쪽 정렬! */
}

.swap-btn:hover {
    color: #145232;  /* ✅ 더 어두운 초록 */
    transform: scale(1.15);
}

.swap-btn:active {
    transform: scale(0.9);
}

/* ==========================================
   액션 버튼 (4개) - E안 2줄 스타일
   ========================================== */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);  /* ✅ 4등분 */
    gap: 0;
    padding: 0;
    margin: 0;
    background: #0f172a;  /* ✅ 검은색 (패드와 동일) */
    border-radius: 0;
    border-top: 1px solid rgba(255,255,255,0.08);  /* ✅ 상단 구분선 */
}

/* 버튼/링크 공통 스타일 */
.btn-tag {
    display: flex;
    flex-direction: column;  /* ✅ 세로 배치 */
    align-items: center;
    justify-content: center;
    gap: 3px;  /* ✅ 아이콘-텍스트 간격 */
    padding: 6px 4px;
    border: none;
    border-radius: 0;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    color: #94a3b8;  /* ✅ 밝은 회색 텍스트 */
    border-right: 1px solid rgba(255,255,255,0.05);  /* ✅ 구분선 */
    text-decoration: none;  /* ✅ 링크 밑줄 제거 */
    -webkit-tap-highlight-color: transparent;
}

/* 아이콘 스타일 */
.btn-icon {
    font-size: 20px;  /* ✅ 아이콘 크기 */
    line-height: 1;
    color: #94a3b8;
}

/* 텍스트 스타일 */
.btn-text {
    display: flex;
    flex-direction: column;  /* ✅ 2줄 배치 */
    align-items: center;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    color: #94a3b8;
}

.btn-text span {
    display: block;
}

/* 마지막 버튼은 구분선 제거 */
.btn-tag:last-child {
    border-right: none;
}

.btn-tag:hover {
    background: rgba(255,255,255,0.05);  /* ✅ 호버 시 약간 밝게 */
    color: #0ea5e9;  /* ✅ 파란색 */
}

.btn-tag:hover .btn-icon,
.btn-tag:hover .btn-text {
    color: #0ea5e9;  /* ✅ 호버 시 아이콘/텍스트도 파란색 */
}

.btn-tag:active {
    background: rgba(255,255,255,0.08);
    transform: scale(0.98);
}

/* 기존 버튼 스타일 (하위 호환) */
.btn-add-currency {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-add-currency:hover {
    background: var(--bg-card);
}

/* 추가된 통화 */
.added-currency {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.btn-remove-currency {
    width: 38px;
    height: 38px;
    background: var(--danger-color);
    border: 1px solid #dc2626;
    border-radius: 6px;
    color: white;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-currency:hover {
    background: #dc2626;
}

/* ==========================================
   숫자패드
   ========================================== */
.calculator-pad {
    background: var(--bg-primary);
    padding: 0.375rem;
    border-radius: 10px;
    position: relative;
}

.pad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.pad-btn {
    height: var(--pad-btn-h, 62px);  /* ✅ 높이 증가 */
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 1.25rem;  /* ✅ 1.125rem → 1.25rem (20px) */
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.05s ease;  /* ⚡ all → transform만 */
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;  /* ✅ 300ms 지연 제거! */
    will-change: transform;  /* ⚡ GPU 가속 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.pad-btn:hover {
    background: var(--bg-tertiary);
}

.pad-btn:active {
    transform: scale(0.95);
    background: var(--border-primary);  /* ✅ 즉시 시각적 피드백! */
}

.pad-btn-op {
    background: var(--bg-tertiary);
    color: var(--calc-blue);
    font-weight: 700;
}

.pad-btn-op:hover {
    background: var(--border-secondary);
}

/* K 버튼 (000 입력) - 숫자처럼 하얀 배경 */
.pad-btn-k {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
}

.pad-btn-k:hover {
    background: var(--bg-tertiary);
}

/* ✅ K버튼 내부 레이아웃 (인라인 제거) */
.pad-btn-k > div {
    line-height: 1.1;
}

.pad-btn-k .k-number {
    font-size: 1rem;
    font-weight: 700;
}

.pad-btn-k .k-label {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 400;
}

/* % 버튼 (퍼센트) - 파란색 연산자 */
.pad-btn-percent {
    background: var(--bg-tertiary);
    color: var(--calc-blue);  /* ✅ 파란색! */
    font-weight: 700;
    font-size: 1rem;
}

.pad-btn-percent:hover {
    background: var(--bg-tertiary);
}

.pad-btn-percent > div {
    line-height: 1.1;
}

.pad-btn-percent .percent-symbol {
    font-size: 1rem;
    font-weight: 700;
}

.pad-btn-percent .percent-label {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 400;
}

/* 비교 드롭다운 */
.compare-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0.5rem;
    right: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.compare-dropdown.show {
    display: block;
}

.compare-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.compare-item:hover {
    background: var(--bg-tertiary);
}

.compare-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.compare-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ==========================================
   저장 버튼
   ========================================== */
.btn-save {
    width: 100%;
    padding: 0.875rem;
    background: var(--travel-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-save:hover {
    background: #145232;
}

/* ==========================================
   가이드 영역
   ========================================== */
.guide-wrapper {
    flex: 1;
    min-width: 0;
}

.guide-content {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    min-height: 360px;
    border: 1px solid var(--border-primary);
}

.guide-content > h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.guide-section {
    margin-bottom: 2rem;
}

.guide-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 48px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-primary);
    line-height: 1.3;
}

.guide-section h4 {
    font-size: 1.25rem;
    margin: 1.25rem 0 1rem;
    color: var(--text-tertiary);
    font-weight: 600;
    line-height: 1.3;
}

.guide-section p {
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.guide-section ul {
    padding-left: 1.5rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.guide-section ul li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* ==========================================
   통화 모달
   ========================================== */
.currency-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 999;
}

.currency-modal-overlay.show {
    display: block;
}

.currency-modal {
    position: fixed;
    bottom: -100%;
    left: 0;  /* ✅ 모바일: 왼쪽 0 */
    right: 0;  /* ✅ 모바일: 오른쪽 0 */
    width: 100%;  /* ✅ 모바일: 100% */
    max-width: none;  /* ✅ 모바일: max-width 없음 */
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 54vh;  /* ✅ 모바일: 패드+액션 전체 */
    transition: bottom var(--transition-base);
    border: 1px solid var(--border-primary);
}

.currency-modal.show {
    bottom: 0;
}

.currency-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.currency-modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.currency-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.currency-modal-body {
    padding: 1rem;
    max-height: calc(54vh - 60px);  /* ✅ 56vh → 54vh (패드 42%로 조정) */
    overflow-y: auto;
}

.currency-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.currency-item:hover {
    background: var(--bg-tertiary);
}

.currency-item.active {
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--travel-primary);
}

.currency-flag {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.currency-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.currency-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.currency-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--calc-blue);
}

.currency-arrow {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.currency-code {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 700;
}

/* 즐겨찾기 버튼 */
.favorite-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0.25rem;
    flex-shrink: 0;
}

.favorite-btn:hover {
    transform: scale(1.2);
}

.favorite-btn.active {
    color: #fbbf24;  /* 노란색 */
}

/* ==========================================
   여행지출저장 모달
   ========================================== */
.save-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 999;
}

.save-modal-overlay.show {
    display: block;
}

.save-modal {
    position: fixed;
    bottom: -100%;
    left: 0;  /* ✅ 모바일: 왼쪽 0 */
    right: 0;  /* ✅ 모바일: 오른쪽 0 */
    width: 100%;  /* ✅ 모바일: 100% */
    max-width: none;  /* ✅ 모바일: max-width 없음 */
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 54vh;  /* ✅ 모바일: 패드+액션 전체 */
    transition: bottom var(--transition-base);
    border: 1px solid var(--border-primary);
}

.save-modal.show {
    bottom: 0;
}

.save-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.save-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.save-modal-body {
    padding: 1rem;
    max-height: calc(70vh - 60px);
    overflow-y: auto;
}

.sheet-section {
    margin-bottom: 1.25rem;
}

.sheet-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.sheet-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.sheet-amount-krw {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.cat-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0.625rem 0.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
}

.cat-btn:hover {
    background: var(--bg-tertiary);
}

.cat-btn.selected {
    background: var(--travel-primary);
    color: white;
    border-color: var(--travel-primary);
}

.memo-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.memo-input:focus {
    outline: none;
    border-color: var(--calc-blue);
}

.sheet-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    flex: 1;
}

.btn-cancel:hover {
    background: var(--border-secondary);
}

.btn-save-confirm {
    background: var(--travel-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    flex: 1;
}

.btn-save-confirm:hover {
    background: #145232;
}

/* ==========================================
   토스트
   ========================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    z-index: 9999;
    opacity: 0;
    transition: all var(--transition-base);
    pointer-events: none;
    border: 1px solid var(--border-primary);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   모바일 메뉴
   ========================================== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--global-nav-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.25rem;
    min-width: 40px;
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    transition: left var(--transition-base);
    overflow-y: auto;
    border-right: 1px solid var(--border-primary);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1050;
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-menu-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
}

.mobile-menu-header h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
}

.mobile-menu-nav ul {
    list-style: none;
}

.mobile-menu-nav > ul > li {
    border-bottom: 1px solid var(--border-primary);
}

.mobile-menu-nav > ul > li > a {
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    font-weight: 600;
    transition: background var(--transition-fast);
}

.mobile-menu-nav > ul > li > a:hover {
    background: var(--bg-tertiary);
}

.mobile-menu-nav ul ul {
    background: var(--bg-primary);
}

.mobile-menu-nav ul ul li a {
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-primary);
    transition: background var(--transition-fast);
}

.mobile-menu-nav ul ul li:last-child a {
    border-bottom: none;
}

.mobile-menu-nav ul ul li a:hover {
    background: var(--bg-tertiary);
}

/* 드롭다운 메뉴 */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    display: none;
    z-index: 100;
    padding: 0.5rem 0;
    border: 1px solid var(--border-primary);
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    border: none;
    transition: background var(--transition-fast);
}

.nav-dropdown-content a:hover {
    background: var(--bg-tertiary);
}

/* 페이지 타이틀 */
.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;  /* ✅ 중앙정렬 */
}

/* ==========================================
   통화 선택 (데스크탑/모바일 공통)
   ========================================== */
.currency-dropdown-simple {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.15);
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    padding: 8px 24px 8px 4px;  /* ✅ 오른쪽 패딩 추가 (화살표 공간) */
    cursor: pointer;
    border-radius: 0;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* ✅ 너비를 내용물에 맞춤 */
    width: auto;
    min-width: 120px;
    max-width: 200px;
    /* ✅ 화살표 추가 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
}

.currency-dropdown-simple:hover,
.currency-dropdown-simple:focus {
    border-bottom-color: var(--travel-primary);
    outline: none;
}

/* ==========================================
   반응형
   ========================================== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-menu {
        display: none;
    }
    
    /* ✅ 브레드크럼 숨기기 */
    .breadcrumb {
        display: none;
    }
    
    /* ✅ 메인 타이틀 숨기기 */
    .main-title-section {
        display: none;
    }
    
    .main-wrapper {
        flex-direction: column;
        padding: 0;  /* padding 제거 */
        gap: 0;
    }
    
    .calculator-wrapper {
        width: 100%;
        min-width: 0;  /* ✅ 모바일: min-width 제거 */
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .calculator-card {
        height: calc(100dvh - 52px - 64px);  /* 🔥 글로벌 네비 + 하단 네비 제외 */
        border-radius: 0;
    }
    
    .calculator-body {
        /* ✅ Flex 방식으로 변경! */
        height: 100%;  /* 부모(calculator-card) 전체 높이 */
        display: flex;
        flex-direction: column;
        padding: 0;  /* padding 제거 (flex 비율만 사용) */
        gap: 0;      /* gap 제거 (flex 비율만 사용) */
        /* 
        640px: 588px (640 - 52 네비)
        - tabs: 5% = 29px
        - convert: 30% = 176px
        - pad: 57% = 335px
        - save: 8% = 47px
        총: 587px ✅
        
        800px: 748px (자동 증가!)
        - tabs: 5% = 37px
        - convert: 30% = 224px
        - pad: 57% = 426px
        - save: 8% = 60px
        총: 747px ✅
        */
    }
    
    /* ✅ 각 자식 요소에 flex 비율 적용 (네이버식 하단 배치) */
    /* 🔥 탭 숨김으로 공간 재분배 */
    .calculator-tabs {
        display: none !important;  /* 🔥 PWA 통일로 숨김 */
    }
    
    .convert-area {
        flex: 0 0 42%;  /* 🔥 40% → 42% (탭 공간 흡수) */
        min-height: 0;
        margin: 8px;
    }
    
    .calculator-pad {
        flex: 1 1 auto;  /* 🔥 나머지 공간 모두 차지 */
        min-height: 0;
        padding: 0;
        background: #0f172a;
    }
    
    /* ✅ pad-grid padding 제거 */
    .pad-grid {
        padding: 0;  /* ✅ 2px → 0 여백 제거! */
    }
    
    /* ✅ 액션 버튼 (하단 독립 - 4등분, 2줄) */
    .action-buttons {
        flex: 0 0 12%;  /* ✅ 8% → 12% (여유롭게!) */
        min-height: 0;
        display: grid;
        grid-template-columns: repeat(4, 1fr);  /* ✅ 4등분 */
        gap: 0;
        padding: 0;  /* ✅ padding 제거 */
        margin: 0;  /* ✅ margin 제거 (패드와 딱 붙이기) */
        background: #0f172a;  /* ✅ 검은색 */
        border-radius: 0;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    
    .btn-save,
    .save-btn {
        display: none;  /* ✅ 저장 버튼 완전 제거! */
    }
    
    /* ✅ 탭 최적화 */
    .calculator-tabs {
        display: flex;
        height: 100%;
        align-items: center;
        justify-content: space-around;  /* ✅ 균등 배치 */
        width: 100%;
    }
    
    .tab-link {
        flex: 1;  /* ✅ 1:1:1 균등 분할 */
        text-align: center;  /* ✅ 텍스트 중앙 */
        font-size: calc(12px * var(--scale));  /* ✅ 14 → 12 */
        padding: calc(8px * var(--scale)) calc(6px * var(--scale));
        font-weight: 600;
    }
    
    /* ✅ 변환 영역 최적화 (calc 제거!) */
    .convert-area {
        /* ❌ height: 100% 제거! (flex로 이미 설정됨) */
        display: flex;
        flex-direction: column;
        gap: 8px;  /* ✅ 6px → 8px (간격 증가) */
        padding: 12px;  /* ✅ 10px → 12px (여백 증가) */
        background: #FFF9F0;
        border-radius: 16px;  /* calc 제거! */
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        margin: 4px;  /* calc 제거! */
        overflow: hidden;  /* ✅ 넘치는 부분 숨김 */
        box-sizing: border-box;  /* ✅ padding/margin 포함 */
    }
    
    /* ✅ 환율 정보 (calc 제거!) */
    .rate-info {
        font-size: 11px;  /* calc 제거! */
        color: #555;
        text-align: center;
        padding: 7px 9px;  /* ✅ 여백 증가 */
        background: rgba(0,0,0,0.03);
        border-radius: 7px;
        border: 1px solid rgba(0,0,0,0.05);
        line-height: 1.4;
        margin-top: 4px;  /* ✅ 위쪽 여백 추가 */
        margin-bottom: 10px;  /* ✅ 아래쪽 여백 증가 */
    }
        padding: 6px 8px;  /* calc 제거! */
        background: rgba(0,0,0,0.03);
        border-radius: 6px;  /* calc 제거! */
        opacity: 1.0;
        font-weight: 500;
    }
    
    /* ✅ 입력/결과 행 (calc 제거!) */
    .convert-row {
        display: flex;
        gap: 6px;  /* ✅ 8px → 6px (2px 절약!) */
        align-items: flex-end;
    }
    
    /* ✅ 통화 드롭다운 (calc 제거!) */
    .currency-dropdown-simple {
        flex: 0 0 auto;
        background: transparent;
        border: none;
        border-bottom: 2px solid rgba(0,0,0,0.15);
        font-size: 13px;  /* ✅ 14px → 13px */
        font-weight: 600;
        color: #1a1a1a;
        padding: 6px 24px 6px 4px;  /* ✅ 오른쪽 패딩 추가 (화살표 공간) */
        cursor: pointer;
        border-radius: 0;
        transition: border-color 0.2s;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        /* ✅ 드롭다운 화살표 추가 */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 4px center;
    }
    
    .currency-dropdown-simple:hover,
    .currency-dropdown-simple:focus {
        border-bottom-color: var(--travel-primary);
    }
    
    /* ✅ 금액 표시 (calc 제거!) */
    .amount-display {
        flex: 1;
        display: flex;
        flex-direction: row-reverse;  /* ✅ 기호를 앞으로 */
        justify-content: flex-end;
        align-items: center;
        gap: 6px;  /* calc 제거! */
        padding: 6px 4px;  /* calc 제거! */
        background: transparent;
        border: none;
        border-bottom: 2px solid rgba(0,0,0,0.2);
        border-radius: 0;
        font-size: 15px;  /* calc 제거! */
        color: #1a1a1a;
    }
    
    .amount-display .amount {
        font-weight: 600;
        color: #1a1a1a;
    }
    
    .amount-display .currency-symbol {
        font-size: 13px;  /* ✅ 14px → 13px */
        color: #666;
    }
    
    /* ✅ 스왑 + 연산 행 - 2열 그리드 */
    .swap-operation-row {
        display: grid;
        grid-template-columns: 40px 1fr;  /* 스왑 버튼 | 연산창 */
        gap: 0.5rem;
        align-items: center;
        padding: 1px 0;  /* ✅ 4px → 1px (6px 절약!) */
    }
    
    .swap-btn {
        background: transparent;
        border: none;
        font-size: 20px;  /* calc 제거! */
        cursor: pointer;
        color: #1a1a1a;
        padding: 2px;  /* ✅ 4px → 2px (4px 절약!) */
    }
    
    .operation-display {
        font-size: 10px;  /* ✅ 14px → 10px (데스크탑과 통일) */
        color: #666;
    }
    
    /* ✅ 통화 추가 버튼 (calc 제거!) */
    .btn-add-currency {
        padding: 10px;  /* calc 제거! */
        font-size: 13px;  /* calc 제거! */
        border-radius: 8px;  /* calc 제거! */
    }
    
    /* ✅ 액션 버튼 여백 (모바일) */
    .action-buttons {
        padding: 0 12px;
        gap: 8px;
        margin-top: 4px;  /* ✅ 10px → 4px (8px 통일) */
        margin-bottom: 0;  /* ✅ 여백 제거 */
    }
    
    /* ✅ 숫자 패드 최적화 (calc 제거!) */
    .calculator-pad {
        padding: 2px;  /* ✅ 4px → 2px (8px 통일) */
        /* ❌ height: 100% 제거! (flex로 이미 설정됨) */
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .pad-grid {
        gap: 4px;  /* calc 제거! */
        flex: 1;
        height: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(5, 1fr);
    }
    
    .pad-btn {
        height: 100%;
        min-height: auto;
        font-size: 19px;  /* ✅ 17px → 19px */
    }
    
    .guide-wrapper {
        display: none;
    }
    
    .global-nav-container {
        padding: 0 1rem;
    }
    
    .breadcrumb-container {
        padding: 0 1rem;
    }
    
    /* ✅ 저장 버튼 최적화 (calc 제거!) */
    .save-btn,
    .btn-save {
        padding: 10px;  /* calc 제거! */
        font-size: 15px;  /* calc 제거! */
        border-radius: 10px;  /* calc 제거! */
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ✅ 모달 관련 (중복 미디어쿼리 통합!) */
    /* 통화 모달 - 전체 너비 */
    .currency-modal,
    .history-modal {
        width: 100%;  /* ✅ 모두 100% 통일 */
        max-width: none;  /* ✅ max-width 제거! */
        left: 0;
        right: 0;
        transform: none;
        /* ✅ 패드+액션 전체 가리기! (패드 42% + 액션 12% = 54%) */
        max-height: 54vh;  /* ✅ 56vh → 54vh (패드 42%로 축소) */
    }
    
    /* ✅ 지출저장은 크림색까지 가리기! */
    .save-modal {
        width: 100%;
        max-width: none;
        left: 0;
        right: 0;
        transform: none;
        /* ✅ 탭(6%) + 크림색(40%) + 패드(42%) + 액션(12%) = 100% - 6% = 94% */
        max-height: 94vh;  /* 크림색까지 전체 가리기! */
    }
    
    .currency-modal-body,
    .history-modal-body {
        max-height: calc(54vh - 60px);  /* ✅ vh 단위로 명시! */
        overflow-y: auto;  /* ✅ 스크롤 명시! */
    }
    
    .save-modal-body {
        max-height: calc(94vh - 60px);  /* ✅ 지출저장은 더 크게 */
        overflow-y: auto;
    }
    
    /* 버튼 태그 - 모바일 */
    .btn-tag {
        font-size: 11px;  /* ✅ 통일: 11px (0.7rem → 11px) */
        padding: 8px 12px;
    }
    
    .btn-tag::before {
        width: 5px;
        height: 5px;
    }
}

/* ==========================================
   아주 작은 화면 (380px 이하) - 버튼 글자 크기 축소
   ========================================== */
@media (max-width: 380px) {
    .action-buttons {
        gap: 0.375rem;  /* ✅ 간격 더 줄임 */
        padding: 0 0.5rem;  /* ✅ 여백 더 줄임 */
    }
    
    .btn-tag {
        font-size: 11px;  /* ✅ 통일: 11px (clamp 제거) */
        padding: 7px 12px 7px 10px;
    }
}

/* ==========================================
   작은 폰 (640-720px) - 값 약간 줄이기 + B안 적용
   ========================================== */
@media (max-width: 640px) and (max-height: 720px) {
    /* ✅ 640-720px 전용 최적화 (작은 폰 전체) */
    
    /* ✅ 비율 조정 - 크림색 세로 확대 */
    .convert-area {
        flex: 0 0 39%;  /* ✅ 38% → 39% (세로 6px 증가!) */
        gap: 3px;
        padding: 8px 8px 12px 8px;  /* ✅ 아래쪽만 12px (안쪽 여백 증가!) */
        border-radius: 14px;
        margin: 4px 8px;  /* ✅ 상하 여백 줄이기 (8px → 4px) */
        overflow: hidden;
        box-sizing: border-box;
    }
    
    /* ✅ 액션 버튼 3px 축소 */
    .action-buttons {
        flex: 0 0 11%;  /* ✅ 12% → 11% (6px 축소, 여전히 18px 여유!) */
        padding: 0;
        margin: 0;
        gap: 0;
    }
    
    /* ✅ 하단 메뉴 텍스트/아이콘 */
    .btn-tag {
        font-size: 11px;  /* ✅ 10px → 11px (+1px) */
        padding: 4px 2px;  /* ✅ 6px 4px → 4px 2px */
        gap: 2px;  /* ✅ 3px → 2px */
    }
    
    .btn-icon {
        font-size: 18px;  /* ✅ 20px → 18px */
    }
    
    .btn-text {
        font-size: 11px;  /* ✅ 10px → 11px (+1px) */
        line-height: 1.1;  /* ✅ 1.2 → 1.1 */
    }
    
    .rate-info {
        font-size: 9px;  /* ✅ 10px → 9px (B안: 더 작게) */
        padding: 4px 6px;  /* ✅ 5px 7px → 4px 6px (B안) */
        border-radius: 5px;
        margin-bottom: 6px;  /* ✅ B안: 여백 줄임 */
    }
    
    .convert-row {
        gap: 6px;  /* ✅ 7px → 6px (스왑 영역 절약) */
    }
    
    .currency-dropdown-simple {
        font-size: 13px;  /* ✅ 통화 13px */
        padding: 5px 24px 5px 4px;  /* ✅ 화살표 공간 */
        /* ✅ 드롭다운 화살표 */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 4px center;
    }
    
    .amount-display {
        gap: 5px;
        padding: 5px 4px;
        font-size: 15px;  /* ✅ 숫자 15px */
    }
    
    .amount-display .currency-symbol {
        font-size: 13px;  /* ✅ 통화 기호 13px */
    }
    
    /* ✅ 한글 부분 (통화와 동일) */
    .korean-unit {
        font-size: 13px;  /* ✅ 한글 13px */
    }
    
    .swap-operation-row {
        padding: 2px 0;  /* ✅ 3px → 2px (스왑 영역 절약) */
    }
    
    .swap-btn {
        font-size: 18px;
        padding: 3px;
    }
    
    .operation-display {
        font-size: 9px;  /* ✅ 10px → 9px (rate-info와 통일) */
    }
    
    .btn-add-currency {
        padding: 9px;
        font-size: 11px;
        border-radius: 7px;
    }
    
    /* ✅ 모달 높이 - 패드+액션 전체 가리기 */
    .currency-modal,
    .history-modal {
        /* 패드 44% + 액션 11% = 55% */
        max-height: 55vh;  /* ✅ 56vh → 55vh (액션 11%로 축소) */
    }
    
    /* ✅ 지출저장은 크림색까지 */
    .save-modal {
        max-height: 94vh;  /* 크림색까지 전체 */
    }
    
    /* ✅ 모달 관련 */
    .currency-modal-header h3,
    .history-modal-header h3,
    .save-modal-header h3 {
        font-size: 16px;
    }
    
    .currency-modal-body,
    .history-modal-body,
    .save-modal-body {
        font-size: 13px;
    }
    
    .calculator-pad {
        padding: 2px;  /* ✅ 3px → 2px (8px 통일) */
    }
    
    .pad-grid {
        gap: 2px;
    }
    
    :root {
        --pad-btn-h: 50px;
    }
    
    .pad-btn {
        font-size: 19px;
    }
}

/* ==========================================
   좁은 구간 (640px~780px) - 숫자패드 더 축소!
   ========================================== */
@media (max-width: 640px) and (min-height: 640px) and (max-height: 780px) {
    /* ✅ 모달 버튼들 보이게 하기 위해 패드 더 줄임! */
    :root {
        --pad-btn-h: 42px;  /* 50px → 42px (32px 절약!) */
    }
    
    .pad-grid {
        gap: 1px;  /* 2px → 1px (3px 절약!) */
    }
    
    /* ✅ 모달 높이 - 패드 전체 가리기 */
    .currency-modal,
    .history-modal {
        max-height: 54vh;  /* ✅ 56vh → 54vh (패드 42%로 축소) */
    }
    
    .save-modal {
        max-height: 94vh;  /* 크림색까지 전체 */
    }
    
    /* 총 35px 절약! 모달 버튼들 보임 ✅ */
}

/* ==========================================
   중간 폰 (721px~820px) - 기본값 유지
   ========================================== */
@media (max-width: 640px) and (min-height: 721px) and (max-height: 820px) {
    /* ✅ 작은 폰보다 약간 여유 있지만, 큰 폰보다는 작게 */
    .convert-area {
        gap: 6px;
        padding: 11px;
        margin: 2px;  /* ✅ 8px 통일 */
    }
    
    .convert-row {
        gap: 7px;
    }
    
    .swap-operation-row {
        padding: 3px 0;
    }
    
    /* ✅ 버튼 크기 통일 */
    .btn-tag {
        font-size: 11px;
    }
    
    /* ✅ 여백 8px 통일 */
    .action-buttons {
        margin-top: 4px;
        margin-bottom: 0;
    }
    
    .calculator-pad {
        padding: 2px;  /* ✅ 8px 통일 */
    }
    
    /* ✅ 모달 높이 - 패드 전체 가리기 */
    .currency-modal,
    .history-modal {
        max-height: 54vh;  /* ✅ 56vh → 54vh (패드 42%로 축소) */
    }
    
    .save-modal {
        max-height: 94vh;  /* 크림색까지 전체 */
    }
    
    :root {
        --pad-btn-h: 51px;
    }
    
    .pad-grid {
        gap: 3px;
    }
}

/* ==========================================
   큰 폰 (821px~899px) - 값 약간 늘리기
   ========================================== */
@media (max-width: 640px) and (min-height: 821px) and (max-height: 899px) {
    .convert-area {
        gap: 7px;
        padding: 12px;
        border-radius: 18px;
        margin: 2px;  /* ✅ 5px → 2px (8px 통일) */
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .rate-info {
        font-size: 11px;  /* ✅ rate-info 11px */
        padding: 7px 9px;
        border-radius: 7px;
    }
    
    .convert-row {
        gap: 7px;  /* ✅ 9px → 7px (스왑 영역 절약) */
    }
    
    .currency-dropdown-simple {
        font-size: 14px;  /* ✅ 통화 14px */
        padding: 7px 24px 7px 4px;
        /* ✅ 드롭다운 화살표 */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 4px center;
    }
    
    .amount-display {
        gap: 7px;
        padding: 7px 4px;
        font-size: 16px;  /* ✅ 숫자 16px */
    }
    
    .amount-display .currency-symbol {
        font-size: 14px;  /* ✅ 통화 기호 14px */
    }
    
    /* ✅ 한글 부분 */
    .korean-unit {
        font-size: 14px;  /* ✅ 한글 14px */
    }
    
    .swap-operation-row {
        padding: 3px 0;  /* ✅ 5px → 3px (스왑 영역 절약) */
    }
    
    .swap-btn {
        font-size: 22px;
        padding: 5px;
    }
    
    .operation-display {
        font-size: 11px;  /* ✅ rate-info와 동일 */
    }
    
    /* ✅ 액션 버튼 여백 8px 통일 */
    .action-buttons {
        margin-top: 4px;  /* ✅ 6px → 4px (8px 통일) */
        margin-bottom: 0;
    }
    
    /* ✅ 액션 버튼 */
    .btn-tag {
        font-size: 11px;
    }
    
    /* ✅ 모달 높이 - 패드 전체 가리기 */
    .currency-modal,
    .history-modal {
        max-height: 54vh;  /* ✅ 56vh → 54vh (패드 42%로 축소) */
    }
    
    .save-modal {
        max-height: 94vh;  /* 크림색까지 전체 */
    }
    
    .btn-add-currency {
        padding: 12px;
        font-size: 12px;
        border-radius: 9px;
    }
    
    /* ✅ 모달 관련 */
    .currency-modal-header h3,
    .history-modal-header h3,
    .save-modal-header h3 {
        font-size: 17px;
    }
    
    .currency-modal-body,
    .history-modal-body,
    .save-modal-body {
        font-size: 14px;
    }
    
    .calculator-pad {
        padding: 2px;  /* ✅ 5px → 2px (8px 통일) */
    }
    
    .pad-grid {
        gap: 4px;
    }
    
    :root {
        --pad-btn-h: 52px;
    }
    
    .pad-btn {
        font-size: 20px;
    }
}

/* ==========================================
   초대형 폰 (900px+) - 더욱 크게
   ========================================== */
@media (max-width: 640px) and (min-height: 900px) {
    .convert-area {
        gap: 8px;
        padding: 14px;
        border-radius: 20px;
        margin: 2px;  /* ✅ 6px → 2px (8px 통일) */
    }
    
    .rate-info {
        font-size: 12px;  /* ✅ rate-info 12px */
        padding: 8px 10px;
        border-radius: 8px;
    }
    
    .convert-row {
        gap: 8px;  /* ✅ 10px → 8px (스왑 영역 절약) */
    }
    
    .currency-dropdown-simple {
        font-size: 15px;  /* ✅ 통화 15px */
        padding: 8px 26px 8px 4px;
        /* ✅ 드롭다운 화살표 */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 4px center;
    }
    
    .amount-display {
        gap: 8px;
        padding: 8px 4px;
        font-size: 17px;  /* ✅ 숫자 17px */
    }
    
    .amount-display .currency-symbol {
        font-size: 15px;  /* ✅ 통화 기호 15px */
    }
    
    /* ✅ 한글 부분 */
    .korean-unit {
        font-size: 15px;  /* ✅ 한글 15px */
    }
    
    .swap-operation-row {
        padding: 4px 0;  /* ✅ 6px → 4px (스왑 영역 절약) */
    }
    
    .swap-btn {
        font-size: 24px;
        padding: 6px;
    }
    
    .operation-display {
        font-size: 12px;  /* ✅ rate-info와 동일 */
    }
    
    /* ✅ 액션 버튼 여백 8px 통일 */
    .action-buttons {
        margin-top: 4px;  /* ✅ 8px → 4px (8px 통일) */
        margin-bottom: 0;
    }
    
    /* ✅ 액션 버튼 */
    .btn-tag {
        font-size: 11px;
    }
    
    /* ✅ 모달 높이 - 패드 전체 가리기 */
    .currency-modal,
    .history-modal {
        max-height: 54vh;  /* ✅ 56vh → 54vh (패드 42%로 축소) */
    }
    
    .save-modal {
        max-height: 94vh;  /* 크림색까지 전체 */
    }
    
    .btn-add-currency {
        padding: 14px;
        font-size: 13px;  /* ✅ 13px */
        border-radius: 10px;
    }
    
    /* ✅ 모달 관련 */
    .currency-modal-header h3,
    .history-modal-header h3,
    .save-modal-header h3 {
        font-size: 18px;  /* ✅ 모달 제목 18px */
    }
    
    .currency-modal-body,
    .history-modal-body,
    .save-modal-body {
        font-size: 15px;  /* ✅ 모달 내용 15px */
    }
    
    .calculator-pad {
        padding: 2px;  /* ✅ 6px → 2px (8px 통일) */
    }
    
    .pad-grid {
        gap: 5px;
    }
    
    :root {
        --pad-btn-h: 66px;
    }
    
    .pad-btn {
        font-size: 21px;
    }
}

/* ==========================================
   큰 화면 (640px 이상) - 버튼 최대값 고정
   ========================================== */
@media (min-width: 640px) {
    .btn-tag {
        font-size: 11px;  /* ✅ 통일: 11px (0.75rem 제거) */
    }
}

/* ==========================================
   계산한 내역 모달
   ========================================== */
.history-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 999;
}

.history-modal-overlay.show {
    display: block;
}

/* ✅ 기본 정의 - 모바일 기준 */
.history-modal {
    position: fixed;
    bottom: -100%;
    left: 0;  /* ✅ 모바일: 왼쪽 0 */
    right: 0;  /* ✅ 모바일: 오른쪽 0 */
    width: 100%;  /* ✅ 모바일: 100% */
    max-width: none;  /* ✅ 모바일: max-width 없음 */
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 54vh;  /* ✅ 모바일: 패드+액션 전체 */
    transition: bottom var(--transition-base);
    border: 1px solid var(--border-primary);
}

.history-modal.show {
    bottom: 0;
}

.history-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.history-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.history-modal-body {
    padding: 1rem;
    max-height: calc(54vh - 60px);  /* ✅ 56vh → 54vh (패드 42%로 조정) */
    overflow-y: auto;
}

.history-item {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.history-number {
    color: var(--text-secondary);
    font-weight: 700;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.875rem;
}


/* ==========================================
   데스크탑 전용 (769px 이상)
   ========================================== */
@media (min-width: 769px) {
    /* ✅ 가이드 복구 */
    .guide-wrapper {
        display: block !important;
    }
    
    /* ✅ 계산기 최대 너비 제한 */
    .calculator-wrapper {
        max-width: 400px;
    }
    
    /* ✅ 데스크탑 모달 스타일 */
    .currency-modal,
    .history-modal {
        left: 50%;
        transform: translateX(-50%);
        width: 50%;
        max-width: 500px;
        max-height: 70vh;
    }
    
    .save-modal {
        left: 50%;
        transform: translateX(-50%);
        width: 50%;
        max-width: 500px;
        max-height: 80vh;  /* 더 크게 */
    }
}

/* ==========================================
   🔥 PWA 통일 - 공통 스타일
   ========================================== */

/* 상단 탭 완전 숨기기 (데스크탑/모바일 모두) */
.calculator-tabs {
    display: none !important;
}

/* 특수키 행 */
.special-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 2px;
    margin-bottom: 6px;
}

.special-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.special-key:active {
    background: var(--bg-primary);
    transform: scale(0.96);
}

.special-icon {
    font-size: 16px;
}

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

/* 하단 네비 (데스크탑/모바일 모두 표시) */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #0a0c10;
    border-top: 1px solid rgba(255,255,255,0.08);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: var(--safe-area-bottom);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-sub);
}

.bottom-nav-item .nav-icon {
    font-size: 20px;
    transition: transform 0.2s;
}

.bottom-nav-item .nav-label {
    font-size: 10px;
    font-weight: 500;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.1);
}

.bottom-nav-item:hover:not(.active) {
    color: var(--text-main);
}

/* 모바일 전용 (768px 이하) */
@media (max-width: 768px) {
    /* 헤더 page-title 숨기기 */
    .page-title {
        display: none !important;
    }
    
    /* 액션버튼 숨기기 */
    .action-buttons {
        display: none !important;
    }
}

/* 데스크탑 전용 (769px 이상) */
@media (min-width: 769px) {
    /* 데스크탑에서 특수키 숨기고 액션버튼 표시 */
    .special-keys {
        display: none;
    }
    
    .action-buttons {
        display: grid;
    }
    
    /* 데스크탑 하단 네비 - 계산기 영역에 맞춤 */
    .bottom-nav {
        position: absolute;
        left: auto;
        right: auto;
        width: 100%;
        max-width: 400px;
    }
}

/* ==========================================
   🔥 저장 모달 새 스타일
   ========================================== */
.sheet-amount-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.sheet-flag {
    width: 28px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
}

.sheet-currency-symbol {
    font-size: 20px;
    color: var(--text-secondary);
}

.sheet-amount {
    font-size: 24px;
    font-weight: 700;
}

.sheet-amount-krw {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sheet-memo-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px 12px;
}

.sheet-memo-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.sheet-memo-input::placeholder {
    color: var(--text-secondary);
}

.payment-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.payment-btn {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.payment-btn.active {
    color: var(--calc-blue);
    font-weight: 600;
}

.payment-divider {
    color: var(--border-primary);
}

.sheet-datetime-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sheet-datetime-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sheet-date-input,
.sheet-time-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cat-btn:hover {
    background: var(--bg-tertiary);
}

.cat-btn.active {
    background: var(--travel-primary);
    border-color: var(--travel-primary);
    color: white;
}

.cat-emoji {
    font-size: 20px;
}

.cat-label {
    font-size: 11px;
    font-weight: 500;
}

/* ==========================================
   🔧 전역 버그 수정: 모달 + 줌/더블탭 방지
   ========================================== */

/* === 모달 삐져나옴 방지 (transform 방식) === */
.modal-sheet {
    bottom: 0 !important;
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1) !important;
    will-change: transform;
}

.modal-sheet.show {
    transform: translateY(0);
}

/* === fullscreen 모달 dvh 대응 === */
.modal-sheet.modal-fullscreen {
    height: 100dvh !important;
    max-height: 100dvh !important;
}

/* === 노치/상태바 헤더 잘림 방지 === */
.modal-fullscreen .modal-header {
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
}

/* === 줌/핀치/더블탭 완전 방지 (전역) === */
html {
    touch-action: pan-x pan-y !important;
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    -webkit-touch-callout: none;
}

body {
    touch-action: pan-x pan-y !important;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    -webkit-user-select: none;
    user-select: none;
}

/* === 인터랙티브 요소 터치 안정화 === */
button,
a,
.key-btn,
.bottom-nav,
.bottom-nav-item,
.modal-sheet,
.modal-overlay,
.minimal-btn,
.swap-btn,
.cat-btn,
.currency-item,
.save-confirm-btn,
.rate-refresh-btn,
.expense-card,
.day-card,
.action-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

/* 입력 필드는 선택/줌 허용 */
input, 
textarea,
[contenteditable="true"] {
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: manipulation;
}