:root {
  /* Green Spectrum */
  --grass-50:  #F9FCF9;
  --grass-100: #E4F0E1;
  --grass-200: #C8DFC5;
  --grass-300: #9FC49D;
  --grass-400: #6FA77A;
  --grass-500: #4F865D;
  --grass-600: #315F40;

  /* Accent */
  --mustard-line: #D6A84F;

  /* Surfaces & Text */
  --surface-main: #FFFFFF;
  --surface-bg: #F4F7F4;
  --text-dark: #1A1A1A;
  --text-gray: #666666;
  --text-light: #F3F8F1;
  --border-light: #EBEBEB;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans KR', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--surface-bg);
  color: var(--text-dark);
  overflow-x: hidden;
  font-size: 14px;
}

/* Base Screen Layout */
.screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  background-color: var(--surface-bg);
  transition: opacity 0.3s ease;
  overflow: hidden; /* For fixed nav */
}

.hidden { display: none !important; }
.active { display: flex; }

/* 1. Splash Screen */
.splash-bg {
  /* Placeholder for the background photo */
  background: linear-gradient(to bottom, #dbe9d8, #a8c8a6);
  align-items: center;
  justify-content: center;
}
.splash-content {
  text-align: center;
  margin-top: -10vh;
}
.splash-content .app-logo {
  color: var(--grass-600);
  font-size: 2.2rem;
  font-weight: 700;
  margin-top: 10px;
}
.splash-content .tagline {
  color: var(--grass-500);
  font-size: 1rem;
  margin-top: 10px;
  line-height: 1.4;
}

/* 2. Login Screen */
#login-screen {
  background-color: var(--surface-main);
  justify-content: center;
  padding: 2rem;
}
.login-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}
.login-header {
  margin-bottom: 3rem;
}
.app-logo-green {
  color: var(--grass-600);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.login-tagline {
  color: var(--text-gray);
  font-size: 1rem;
  line-height: 1.5;
}
.social-login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 2rem;
}
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background-color: var(--surface-main);
  color: var(--text-dark);
}
.social-btn .icon {
  position: absolute;
  left: 20px;
  font-weight: bold;
}
.social-btn.facebook { border-color: #1877F2; color: #1877F2; }
.social-btn.google { border-color: #EA4335; color: #EA4335; }
.social-btn.kakao { background-color: #FEE500; border-color: #FEE500; }
.social-btn.naver { background-color: #03C75A; border-color: #03C75A; color: white; }
.terms-text {
  font-size: 0.8rem;
  color: #999;
  line-height: 1.4;
}

/* 3. Main App Layout */
.app-header {
  height: 56px;
  background-color: var(--surface-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  flex-shrink: 0;
}
.header-logo {
  color: var(--grass-600);
  font-weight: 700;
  font-size: 1.4rem;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem 90px 1.2rem; /* Bottom padding for nav */
}

/* Dashboard Sections */
.dashboard-section {
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}
.subtitle-hint {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-gray);
  margin-left: 4px;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.text-link {
  background: none;
  border: none;
  color: var(--text-gray);
  font-size: 0.85rem;
  cursor: pointer;
}

/* Cards */
.card {
  background-color: var(--surface-main);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 1.2rem;
}

/* Stats Card */
.stats-card {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 1.5rem 1rem;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--grass-600);
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-gray);
}
.stat-divider {
  width: 1px;
  height: 40px;
  background-color: var(--border-light);
}

/* Chart Toggles */
.chart-toggles {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.toggle-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background-color: var(--surface-main);
  color: var(--text-gray);
  font-size: 0.85rem;
  cursor: pointer;
}
.toggle-btn.active {
  background-color: var(--grass-500);
  color: white;
  border-color: var(--grass-500);
}
.chart-card {
  padding: 1rem;
  height: 150px;
}
.mock-chart {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.chart-svg {
  flex: 1;
  width: 100%;
}
.chart-x-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-top: 8px;
}

/* Round List */
.round-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.round-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem;
}
.round-info {
  display: flex;
  flex-direction: column;
}
.round-date {
  font-size: 0.8rem;
  color: var(--text-gray);
  margin-bottom: 4px;
}
.round-club {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.round-course {
  font-size: 0.85rem;
  color: var(--text-gray);
  display: flex;
  align-items: center;
  gap: 8px;
}
.weather-info {
  font-size: 0.8rem;
}
.round-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.score-total {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--grass-600);
  line-height: 1;
}
.score-relative {
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-top: 4px;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 70px;
  background-color: var(--surface-main);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50; /* Ensure it stays above active screens */
}
.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #B0B0B0;
  cursor: pointer;
  width: 20%;
}
.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}
.nav-item.active {
  color: var(--grass-600);
}

/* =========================================
   Round Entry Modal & Flow (Phase 3)
   ========================================= */

#round-modal {
  /* Inherits from .screen, covers everything */
  z-index: 100;
}

.modal-step {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.modal-step.hidden {
  display: none !important;
}

.modal-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background-color: var(--grass-50);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-dark);
}

.modal-content {
  flex: 1;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  padding-bottom: 100px; /* Space for bottom bar */
}

.modal-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Method Cards */
.method-card {
  background-color: var(--surface-main);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  cursor: pointer;
  transition: all 0.2s;
}
.method-card.selected {
  border-color: var(--grass-500);
  background-color: var(--grass-50);
}
.method-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background-color: var(--surface-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grass-600);
  flex-shrink: 0;
}
.method-card.selected .method-icon-box {
  background-color: var(--grass-500);
  color: white;
}
.method-info {
  flex: 1;
}
.method-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge-recommend {
  background-color: var(--grass-500);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.method-desc {
  font-size: 0.85rem;
  color: var(--text-gray);
  line-height: 1.4;
}

/* Modal Bottom Bar */
.modal-bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background-color: var(--surface-main);
  padding: 1rem 1.2rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
}
.btn-primary, .btn-secondary, .btn-ghost {
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  border: none;
  text-align: center;
}
.btn-primary {
  flex: 2;
  background-color: var(--grass-500);
  color: white;
}
.btn-primary:disabled {
  background-color: var(--grass-200);
  cursor: not-allowed;
}
.btn-secondary {
  flex: 1;
  background-color: var(--surface-main);
  border: 1px solid var(--border-light);
  color: var(--text-dark);
}
.btn-ghost {
  background-color: transparent;
  color: var(--text-gray);
  font-weight: 500;
}
.full-width-btn {
  width: 100%;
  flex: none;
  margin-bottom: 8px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--grass-300);
  border-radius: 16px;
  background-color: var(--surface-main);
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
}
.upload-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.5;
}
.upload-hint {
  font-size: 0.8rem;
  color: var(--text-gray);
  font-weight: 400;
}

/* File Item */
.file-item {
  display: flex;
  align-items: center;
  background-color: var(--surface-main);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  gap: 12px;
}
.file-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background-color: var(--grass-100);
}
.file-info-text {
  flex: 1;
}
.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 2px;
}
.file-size {
  font-size: 0.8rem;
  color: var(--text-gray);
}
.remove-file-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

/* AI Confirm Step */
.center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 2rem;
}
.confirm-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--grass-600);
}
.confirm-desc {
  font-size: 0.9rem;
  color: var(--text-gray);
  line-height: 1.5;
  margin-bottom: 2.5rem;
}
.ai-illustration {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 4/3;
  background-color: var(--surface-main);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.mock-scorecard-ill {
  width: 70%;
  height: 60%;
  border: 1px solid var(--grass-200);
  border-radius: 4px;
  position: relative;
}
.ill-grid {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(var(--grass-100) 1px, transparent 1px), linear-gradient(90deg, var(--grass-100) 1px, transparent 1px);
  background-size: 20px 20px;
}
.ill-magnify {
  position: absolute;
  bottom: -15px;
  right: -15px;
}
.confirm-buttons {
  width: 100%;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================
   AI Result & Success (Phase 4)
   ========================================= */

/* Utilities */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.text-left { text-align: left; }
.text-sm { font-size: 0.85rem; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; align-items: center; }
.gap-12 { gap: 12px; }

/* AI Image Header */
.original-image-box {
  width: 100%;
  height: 120px;
  background-color: var(--grass-100);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}
.mock-scorecard-img {
  font-size: 0.8rem;
  color: var(--grass-500);
}

/* Forms */
.form-group {
  background-color: var(--surface-main);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-group > label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--grass-600);
  margin-bottom: 4px;
}
.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--grass-50);
  padding-bottom: 8px;
}
.input-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.input-row .label {
  font-size: 0.9rem;
  color: var(--text-gray);
  width: 35%;
}
.input-row input, .input-row select {
  flex: 1;
  border: none;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  background: transparent;
  outline: none;
}

/* Player List */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-row {
  display: flex;
  align-items: center;
  background-color: var(--surface-main);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.player-row.selected {
  border-color: var(--grass-500);
  background-color: var(--grass-50);
}
.player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.player-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}
.player-score-detail {
  font-size: 0.8rem;
  color: var(--text-gray);
}
.player-total {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-right: 16px;
}
.player-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge-mine {
  background-color: var(--grass-600);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-gray);
  line-height: 1.4;
}

/* Tabs & Table */
.course-tabs {
  display: flex;
  background-color: var(--surface-main);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  font-weight: 500;
  color: var(--text-gray);
}
.tab-btn.active {
  background-color: var(--grass-500);
  color: white;
  font-weight: 700;
}
.score-table {
  width: 100%;
  background-color: var(--surface-main);
  border-radius: 12px;
  margin-top: 1rem;
  border-collapse: collapse;
  text-align: center;
  overflow: hidden;
}
.score-table th {
  background-color: var(--grass-50);
  padding: 10px 4px;
  font-size: 0.75rem;
  color: var(--text-gray);
  border-bottom: 1px solid var(--border-light);
}
.score-table td {
  padding: 10px 4px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--grass-50);
}
.score-table tfoot td {
  font-weight: 700;
  background-color: var(--grass-50);
  border-bottom: none;
  color: var(--grass-600);
}

/* Success Icon */
.success-icon {
  display: flex;
  justify-content: center;
  align-items: center;
}
