* { box-sizing: border-box; }

:root {
  --cream: #f3efe6;
  --cream-2: #ece6d9;
  --ink: #2a2a28;
  --ink-soft: #6f6b60;
  --gray: #9c988c;
  --line: #e3ddcd;
  --brand: #2f8f5b;
  --brand-soft: #e4f2e9;
  --alert: #d9534f;
  --alert-soft: #f7dede;
  --card: #fbf9f4;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Malgun Gothic", sans-serif;
  background: var(--cream);
  color: var(--ink);
}

.phone {
  max-width: 400px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--cream);
  padding-bottom: 24px;
}

/* header */
.appbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 6px;
}
.appbar .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.appbar .titles { flex: 1; min-width: 0; }
.appbar .titles h1 { margin: 0; font-size: 16px; font-weight: 800; }
.appbar .titles .sub { font-size: 10px; letter-spacing: 0.08em; color: var(--gray); font-weight: 600; }
.appbar .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
}
.appbar .icon-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* search overlay panel */
.search-panel {
  margin: 4px 18px 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: none;
}
.search-panel.open { display: block; }
.search-panel input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 8px;
  background: #fff;
}
.search-results { display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.search-result { padding: 8px 10px; border-radius: 8px; background: var(--cream-2); font-size: 12.5px; }
.search-result .sr-name { font-weight: 700; }
.search-result .sr-meta { color: var(--gray); font-size: 11px; margin-top: 2px; }
.search-hint { font-size: 12px; color: var(--gray); padding: 4px 2px; }

/* generic section */
.section {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.section:first-of-type { border-top: none; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title .label { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.nav-btn {
  border: none;
  background: none;
  color: var(--gray);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

/* calendar */
.cal-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title-row .month { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.round-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--alert);
  background: var(--alert-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
  text-align: center;
}
.cal-grid .dow { font-size: 11px; color: var(--gray); padding-bottom: 2px; font-weight: 600; }
.cal-grid .dow.sun { color: var(--alert); }
.cal-cell {
  position: relative;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--ink);
}
.cal-cell.other-month { visibility: hidden; }
.cal-cell.sun { color: var(--alert); }
.cal-cell.today .num { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.cal-cell .num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.cal-cell.has-round .num { border: 1.5px solid var(--alert); }

/* weather strip */
.weather-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.weather-hour {
  flex: 0 0 auto;
  min-width: 58px;
  text-align: center;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.weather-hour.highlight { background: var(--alert-soft); border-color: var(--alert); }
.weather-hour .time { font-size: 11px; color: var(--gray); font-weight: 600; }
.weather-hour .icon { font-size: 20px; margin: 6px 0 4px; }
.weather-hour .temp { font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.weather-hour .pop, .weather-hour .wind {
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
}
.weather-hour.highlight .pop { color: var(--alert); font-weight: 700; }
.weather-note { font-size: 10.5px; color: var(--gray); margin-top: 10px; }

/* upcoming rounding cards */
.round-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  cursor: pointer;
}
.round-card .region-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
}
.round-card .info { flex: 1; min-width: 0; }
.round-card .name { font-weight: 800; font-size: 13.5px; }
.round-card .meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }
.round-card .wx {
  flex: 0 0 auto;
  text-align: center;
  font-size: 11px;
  color: var(--alert);
  font-weight: 700;
}
.round-card .wx .icon { font-size: 16px; }
.round-card .chev { color: var(--gray); font-size: 15px; flex: 0 0 auto; }
.empty-note { font-size: 12.5px; color: var(--gray); padding: 6px 0; }
.card-icon-btn {
  flex: 0 0 auto;
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  color: var(--ink-soft);
}

/* rounding registration/edit modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-sheet {
  width: 100%;
  max-width: 400px;
  background: var(--cream);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px 22px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 15px; font-weight: 800; }
.modal-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}
.modal-label:first-of-type { margin-top: 0; }
#modalDate, #modalTeeTime, #modalCourseSearch {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}
.modal-course-selected {
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.modal-course-selected button {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

/* detail view: tee-time timeline */
.weather-hour.tee { position: relative; }
.weather-hour .flag {
  font-size: 11px;
  margin-bottom: 2px;
  visibility: hidden;
}
.weather-hour.tee .flag { visibility: visible; }

/* detail view: satellite map (Windy) */
.windy-embed {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}
.windy-embed iframe {
  width: 100%;
  height: 260px;
  border: none;
  display: block;
}

/* detail view: action buttons */
.action-row { display: flex; gap: 10px; }
.action-btn {
  flex: 1;
  padding: 13px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.action-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.reset-map-app-btn {
  display: block;
  margin: 10px auto 0;
  border: none;
  background: none;
  color: var(--gray);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}

/* map app selection bottom sheet */
.map-app-list { display: flex; flex-direction: column; gap: 8px; }
.map-app-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.map-app-option:active { background: var(--cream-2); }
.map-app-emoji { font-size: 16px; }
.map-app-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

/* ad placeholder */
.ad-slot {
  margin: 6px 18px 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--gray);
}
