:root {
  --md-primary: #1976d2;
  --md-primary-dark: #115293;
  --md-success: #2e7d32;
  --md-success-dark: #1b5e20;
  --md-warning: #ed6c02;
  --md-warning-dark: #e65100;
  --md-surface: #ffffff;
  --md-background: #f5f6fa;
  --md-text-primary: #212121;
  --md-text-secondary: #757575;
  --md-divider: #e0e0e0;
  --md-error: #d32f2f;
  --border-radius: 6px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--md-background);
  color: var(--md-text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------
   1. Header & Avatar (공통)
--------------------------------------------------- */
.app-header {
  background: var(--md-surface);
  color: var(--md-text-primary);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  position: relative;
  z-index: 10;
}
.header-title { 
  display: flex; 
  align-items: center; 
  height: 100%; 
}
.header-title img {
  height: 100%; 
  max-height: 40px; 
  width: auto;      
  object-fit: contain; 
  cursor: pointer;
}
.avatar-container {
  cursor: pointer;
  font-size: 40px;
  color: var(--md-primary);
  line-height: 1;
}
.user-menu {
  display: none;
  position: absolute;
  top: 70px;
  right: 16px;
  background: var(--md-surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: var(--border-radius);
  border: 1px solid var(--md-divider);
  padding: 16px;
  min-width: 220px;
}
.user-menu.active { display: block; }
.user-email {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-text-secondary);
  margin-bottom: 12px;
  word-break: break-all;
}

/* ---------------------------------------------------
   2. Layout & Cards (공통)
--------------------------------------------------- */
.app-container {
  padding: 24px 16px;
  max-width: 600px;
  margin: 0 auto;
}
.md-card {
  background: var(--md-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  padding: 28px;
  margin-bottom: 16px;
  box-sizing: border-box; 
}
.page-title {
  font-size: 22px;
  margin: 0 0 8px 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--md-text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ---------------------------------------------------
   3. Buttons (공통) - 모바일 터치 개선 영역
--------------------------------------------------- */
.md-button {
  border: none;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: all 0.2s;
  box-sizing: border-box;
  
  /* 모바일에서 버튼 터치 시 생기는 기본 회색/파란색 음영 완전 제거 */
  -webkit-tap-highlight-color: transparent; 
}

/* 1. 기본 색상 */
.btn-primary { background: var(--md-primary); color: #fff; }
.btn-success { background: var(--md-success); color: #fff; }
.btn-warning { background: var(--md-warning); color: #fff; }
.btn-outline { background: transparent; color: var(--md-text-primary); border: 1px solid var(--md-divider); }

/* 2. 진짜 마우스가 있는 기기(PC)에서만 동작하는 Hover 효과 */
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--md-primary-dark); box-shadow: 0 2px 6px rgba(25,118,210,0.3); }
  .btn-success:hover:not(:disabled) { background: var(--md-success-dark); box-shadow: 0 2px 6px rgba(46,125,50,0.3); }
  .btn-warning:hover:not(:disabled) { background: var(--md-warning-dark); box-shadow: 0 2px 6px rgba(237,108,2,0.3); }
  .btn-outline:hover:not(:disabled) { background: #f5f5f5; }
}

/* 3. 실제로 손가락이나 마우스로 '누르고 있는 순간(Active)' 동작 */
.btn-primary:active:not(:disabled) { background: var(--md-primary-dark); transform: scale(0.98); }
.btn-success:active:not(:disabled) { background: var(--md-success-dark); transform: scale(0.98); }
.btn-warning:active:not(:disabled) { background: var(--md-warning-dark); transform: scale(0.98); }
.btn-outline:active:not(:disabled) { background: #eeeeee; transform: scale(0.98); }

/* 4. 비활성화 상태 */
.md-button:disabled { background: #e0e0e0; color: #9e9e9e; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------------------------------------------------
   4. Forms & Inputs (인증용 + 앱용 완벽 병합)
--------------------------------------------------- */
.form-group, .input-field { margin-bottom: 20px; text-align: left; }

.form-label, .input-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--md-text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.form-label .mdi, .input-field label .mdi {
  font-size: 16px;
}

.form-input, .input-field input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--md-divider);
  border-radius: var(--border-radius);
  font-size: 16px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .input-field input:focus { border-color: var(--md-primary); }

.input-error { border-color: var(--md-error) !important; }
.field-error-message {
  display: block;
  font-size: 12px;
  color: var(--md-error);
  margin-top: 4px;
  min-height: 16px;
  text-align: left;
}

/* ---------------------------------------------------
   5. UI Messages & Status 
--------------------------------------------------- */
.message {
  margin-bottom: 20px;
  text-align: center;
  font-size: 14px;
  word-break: keep-all;
  line-height: 1.5;
}
.message:empty {
  display: none;
}
.message.error { color: var(--md-error); }
.message.success { color: var(--md-success); }

.status-display {
  text-align: center;
  padding: 20px 0;
  font-weight: 500;
  color: var(--md-text-primary);
}

/* ---------------------------------------------------
   6. Auth Links (수평 배치 적용)
--------------------------------------------------- */
.action-links {
  margin-top: 24px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.action-links a {
  color: var(--md-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent; 
}
.action-links a:hover {
  color: var(--md-primary-dark);
  text-decoration: underline;
}
.action-links-divider {
  color: var(--md-divider);
  font-size: 12px;
}

/* ---------------------------------------------------
   7. Menu List 
--------------------------------------------------- */
.menu-list { display: flex; flex-direction: column; gap: 12px; }
.menu-item {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--md-divider);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--md-surface);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .menu-item:hover { background: #f9f9f9; border-color: #bdbdbd; }
}
.menu-item:active { background: #eeeeee; transform: scale(0.99); } 

.menu-item .mdi { font-size: 24px; color: var(--md-primary); margin-right: 16px; }
.menu-item-text { flex-grow: 1; font-size: 16px; font-weight: 500; }
.menu-item-arrow { font-size: 24px; color: var(--md-text-secondary); }

/* ---------------------------------------------------
   8. Balance UI 
--------------------------------------------------- */
.balance-text-wrapper {
  text-align: right;
  padding: 0 8px 16px 8px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--md-text-primary);
}
.balance-text-label {
  font-size: 14px;
  color: var(--md-text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.balance-text-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--md-text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}
.balance-text-amount span.currency {
  font-size: 18px;
  font-weight: 500;
  margin-left: 4px;
}

/* ---------------------------------------------------
   9. Utilities (공통)
--------------------------------------------------- */
.hidden { display: none !important; }
.md-divider { border: none; border-top: 1px solid var(--md-divider); margin: 16px 0; }
.loading-state {
  font-size: 16px;
  color: var(--md-text-secondary);
  text-align: center;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.loading-state .mdi { font-size: 32px; color: var(--md-primary); }

/* ---------------------------------------------------
   10. Card Centered Layout
--------------------------------------------------- */
.card-centered-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 16px; 
}

/* 양옆 여백을 동일하게 맞추기 위해 너비 고정 (100%, 최대 400px) */
.card-centered-layout .md-card {
  margin-bottom: 0; 
  width: 100%;
  max-width: 400px;
}

/* ---------------------------------------------------
   11. Root Service List Layout
--------------------------------------------------- */
.service-list-card {
  text-align: center;
  padding: 36px 24px !important; /* md-card의 기본 padding 덮어쓰기 */
}
.service-list-icon {
  font-size: 80px;
  color: var(--md-text-secondary);
  margin-bottom: 16px;
  display: inline-block;
}
.service-list-title {
  font-size: 24px;
  color: var(--md-text-primary);
  margin: 0 0 16px 0;
  font-weight: 700;
}
.service-list-desc {
  font-size: 15px;
  color: var(--md-text-secondary);
  line-height: 1.6;
  margin-bottom: 36px;
  word-break: keep-all;
}
.service-list-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.service-list-actions a {
  text-decoration: none;
}
.service-list-actions .mdi {
  font-size: 20px;
}