:root {
  --bg: #f4f7f4;
  --surface: #ffffff;
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-soft: #d8f3dc;
  --accent: #f4a261;
  --text: #1b4332;
  --text-muted: #3d6b5c; /* WCAG AA ~5.8:1 on white */
  --border: #b7e4c7;
  --fasting: #fff3e0;
  --fasting-border: #ffb74d;
  --free: #e8eaf6;
  --free-border: #7986cb;
  --today-ring: #e76f51;
  --shadow: 0 4px 24px rgba(27, 67, 50, 0.08);
  --radius: 16px;
  /* ── Extended design tokens (additive only) ── */
  --shadow-sm: 0 2px 8px rgba(27, 67, 50, 0.06);
  --shadow-lg: 0 12px 40px rgba(27, 67, 50, 0.12);
  --shadow-xl: 0 20px 60px rgba(27, 67, 50, 0.16);
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --accent-coral: #e76f51;
  --accent-coral-soft: #fceee9;
  --google-blue: #4285f4;
  --google-red: #ea4335;
  --google-yellow: #fbbc05;
  --google-green: #34a853;
  --surface-elevated: #fafcfa;
  --surface-sunken: #f1f6f2;
  --focus-ring: 0 0 0 3px rgba(45, 106, 79, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: linear-gradient(160deg, #f4f7f4 0%, #e8f5e9 50%, #f0f4f8 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: clip;
}

body.print-page {
  overflow-x: auto;
}

/* ── 키프레임 (중복 방지) ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════════════════════
   LAYOUT — .app container
   ════════════════════════════════════════════════════════════════════════════ */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  width: 100%;
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════════════════
   NAV — Unified across all pages
   ════════════════════════════════════════════════════════════════════════════ */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

.app-nav .brand-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-links a,
.app-nav a:not(.brand-logo) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-links a.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 1px 6px rgba(45,106,79,.25);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-right .program-selector.compact select {
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.btn-print-inline {
  margin-left: 8px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #e89160 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(244, 162, 97, 0.25);
}

.btn-print-inline:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 162, 97, 0.35);
}

.btn-print-inline:active {
  transform: translateY(0);
}

header {
  text-align: center;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header h1 {
  font-size: clamp(1.3rem, 3.5vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  position: relative;
  display: inline-block;
}

header h1::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin: 6px auto 0;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 2px;
}

.user-nickname {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-light);
}

/* ── Current program badge (unified nav display) ── */
.current-program-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.4;
}

header p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress-counter {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #e8f5e9 100%);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ── Progress bar (visual indicator) ── */
.progress-bar-wrapper {
  width: 100%;
  max-width: 360px;
  margin: 10px auto 0;
  height: 12px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 6px rgba(45, 106, 79, 0.35);
  position: relative;
}

.progress-bar-fill::after {
  content: "";
  position: absolute;
  top: 2px; left: 4px; right: 4px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}

/* ── Phase banner (header) ── */
.phase-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin: 14px auto 0;
  max-width: 640px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #e8f5e9 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
}

.phase-banner-stage {
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
}

.phase-banner-title {
  font-weight: 700;
  color: var(--primary);
}

.phase-banner-desc {
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Phase info (detail panel) ── */
.phase-info {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #f0faf4 0%, #fafcfa 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.phase-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.phase-stage-badge {
  flex-shrink: 0;
  padding: 3px 9px;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 800;
}

.phase-info-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.phase-info-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.phase-info-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phase-info-tips li {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
}

.phase-info-tips li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-light);
  font-weight: 700;
}

/* ── Allowed foods (per phase) ── */
.phase-allowed-foods {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.phase-allowed-foods--compact {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  text-align: left;
}

.phase-allowed-foods summary {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}

.phase-allowed-foods summary::-webkit-details-marker {
  display: none;
}

.phase-allowed-foods summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.phase-allowed-foods[open] summary::after {
  transform: rotate(180deg);
}

.allowed-foods-summary {
  margin: 8px 0 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.allowed-foods-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
}

.allowed-foods-list li {
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-left: 12px;
  position: relative;
  line-height: 1.4;
}

.allowed-foods-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary-light);
  font-size: 0.65rem;
  font-weight: 700;
}

.allowed-foods-list--compact li {
  font-size: 0.72rem;
}

/* ── Encouragement toast ── */
.toast-container {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  pointer-events: none;
}

.encouragement-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 420px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--primary-light);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(27, 67, 50, 0.18);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.encouragement-toast.toast-in {
  opacity: 1;
  transform: translateY(0);
}

.encouragement-toast.toast-out {
  opacity: 0;
  transform: translateY(8px);
}

.encouragement-toast .toast-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.encouragement-toast .toast-message {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

.encouragement-toast .toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.encouragement-toast .toast-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

/* ==========================================================================
   Utility classes (extracted inline styles)
   ========================================================================== */
.settings-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.settings-toolbar .btn-save-health {
  padding: 12px 28px;
  font-size: 0.95rem;
}
.section-gap {
  margin-top: 24px;
}
.card-title-gap {
  margin-top: 24px;
}
.health-btn-group {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.weight-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Program selector dropdown ── */
.program-selector {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 4px;
  padding: 8px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.program-selector:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.program-selector label {
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.82rem;
}

.program-selector select {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 34px 8px 12px;
  background: var(--surface-elevated) 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='%232d6a4f' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  min-width: 170px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.program-selector select:hover {
  border-color: var(--primary-light);
}

.program-selector select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: var(--focus-ring);
}

.start-date-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.start-date-picker:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.start-date-picker label {
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.82rem;
}

.start-date-picker input[type="date"] {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--surface-elevated);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.start-date-picker input[type="date"]:hover {
  border-color: var(--primary-light);
}

.start-date-picker input[type="date"]:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: var(--focus-ring);
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calendar-card,
.bottom-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.calendar-card {
  padding: 16px;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.month-nav h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.month-nav button {
  background: var(--primary-soft);
  border: none;
  color: var(--primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-nav button:hover:not(:disabled) {
  background: var(--border);
  transform: scale(1.08);
}

.month-nav button:active:not(:disabled) {
  transform: scale(0.95);
}

.month-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.weekdays span {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.weekdays span:first-child {
  color: #c62828;
}

.weekdays span:last-child {
  color: #1565c0;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-cell {
  min-height: 56px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: var(--surface-elevated);
  padding: 6px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.day-cell:hover:not(.empty) {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.15);
  border-color: var(--primary-light);
}

.day-cell:active:not(.empty) {
  transform: translateY(-1px);
}

.day-cell.empty {
  background: transparent;
  cursor: default;
}

.day-cell.out-of-plan {
  background: #f5f5f5;
  color: #aaa;
  cursor: default;
}

.day-cell.fasting {
  background: var(--fasting);
  border-color: var(--fasting-border);
}

.day-cell.free-day {
  background: var(--free);
  border-color: var(--free-border);
}

.day-cell.today {
  outline: 2.5px solid var(--today-ring);
  outline-offset: 1px;
}

.day-cell.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.day-cell.completed {
  border-color: #ef9a9a;
  background: rgba(211, 47, 47, 0.06);
}

.day-cell.completed .day-num {
  color: var(--text-muted);
}

.day-complete-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: #d32f2f;
  opacity: 0.92;
  pointer-events: none;
  line-height: 1;
  z-index: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.day-num {
  font-size: 0.8rem;
  font-weight: 700;
}

.diet-badge {
  margin-top: auto;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(45, 106, 79, 0.1);
  border-radius: 6px;
  padding: 2px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-cell.fasting .diet-badge {
  color: #e65100;
  background: rgba(230, 81, 0, 0.12);
}

.day-cell.free-day .diet-badge {
  color: #3949ab;
  background: rgba(57, 73, 171, 0.12);
}

/* ── Bottom tab panel ── */
.bottom-panel {
  overflow: hidden;
}

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--surface-elevated);
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  min-width: max-content;
  min-height: 46px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tab-btn:not(.active):not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background-color: var(--border);
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.10);
}

.tab-btn:hover::after {
  opacity: 0;
}

.tab-btn:active {
  transform: translateY(0);
  background: var(--border);
  box-shadow: none;
}

.tab-btn.active {
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  box-shadow: 0 2px 10px rgba(45, 106, 79, 0.25);
}

.tab-btn.active:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(45, 106, 79, 0.35);
}

.tab-btn.active::after {
  display: none;
}

.tab-panels {
  padding: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px 0;
}

.btn-today {
  min-height: 44px;
  padding: 8px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-today:hover {
  background: var(--border);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-today:active {
  transform: translateY(0);
}

.panel-content {
  padding: 18px 20px 22px;
}

.rules-section + .rules-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.rules-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}

.phase-day-range {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-left: auto;
}

.guide-list,
.forbidden-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-list li,
.forbidden-list li {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.forbidden-list li::before {
  content: "🚫";
  flex-shrink: 0;
}

.detail-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 32px 12px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
}

.detail-header .phase-tag {
  font-size: 0.75rem;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.meal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meal-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid #e8f0eb;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.meal-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.meal-item .meal-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 36px;
}

.meal-item .meal-icon {
  font-size: 1.2rem;
}

.meal-item .meal-label {
  font-size: 0.88rem;
  font-weight: 500;
}

.exercise-row {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
}

.complete-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.complete-btn:hover:not(:disabled) {
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.complete-btn:active:not(:disabled) {
  transform: translateY(0);
}

.complete-btn.is-done {
  background: #d32f2f;
  color: #fff;
  border-color: #c62828;
}

.complete-btn.is-done:hover:not(:disabled) {
  background: #c62828;
  box-shadow: 0 4px 14px rgba(211, 47, 47, 0.25);
}

.complete-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.complete-locked {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f5f5f5;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  line-height: 1.45;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.legend-item {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.legend-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.legend-item.normal { background: #fafcfa; color: var(--primary); }
.legend-item.fasting { background: var(--fasting); color: #e65100; }
.legend-item.free { background: var(--free); color: #3949ab; }
.legend-item.completed { background: rgba(211, 47, 47, 0.12); color: #c62828; }

footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.app-footer {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-footer-copyright {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.6;
}

.app-footer-copyright a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.app-footer-copyright a:hover {
  text-decoration: underline;
}

.family-site-container {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: flex-end;
}

.family-site-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-height: 36px;
  min-width: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.family-site-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.family-site-btn:active {
  transform: translateY(0);
}

.family-site-btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.family-site-btn .arrow {
  display: inline-block;
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.family-site-container.is-open .family-site-btn .arrow {
  transform: rotate(180deg);
}

.family-site-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  min-width: min(280px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
}

.family-site-popup[hidden] {
  display: none;
}

.popup-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 240px;
  overflow-y: auto;
}

.popup-list li a {
  display: block;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.popup-list li a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.popup-list li a.is-current {
  color: var(--primary);
  font-weight: 700;
  background: rgba(216, 243, 220, 0.5);
  pointer-events: none;
}

@media print {
  .no-print {
    display: none !important;
  }
}

/* ── Mobile: tablet & phone ── */
@media (max-width: 768px) {
  .app {
    padding: 16px 12px 36px;
  }

  header {
    margin-bottom: 20px;
  }

  header p {
    font-size: 0.88rem;
    padding: 0 4px;
  }

  .app-nav {
    flex-wrap: wrap;
    gap: 6px;
  }

  .app-nav a,
  .btn-print-inline {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-print-inline {
    margin-left: 0;
  }

  .start-date-picker {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 14px;
    gap: 10px;
  }

  .program-selector {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 14px;
    gap: 10px;
  }

  .program-selector select {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px 32px 8px 10px;
    font-size: 0.9rem;
  }

  .phase-banner {
    max-width: 100%;
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .phase-allowed-foods summary {
    min-height: 40px;
    align-items: center;
  }

  .allowed-foods-summary,
  .allowed-foods-list li {
    font-size: 0.78rem;
  }

  .start-date-picker input[type="date"] {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .calendar-card {
    padding: 14px 12px;
  }

  .month-nav h2 {
    font-size: 1.1rem;
  }

  .month-nav button {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .weekdays,
  .days-grid {
    gap: 4px;
  }

  .weekdays span {
    font-size: 0.72rem;
    padding: 2px 0;
  }

  .day-cell {
    min-height: 44px;
    padding: 4px 3px;
    border-radius: 10px;
    -webkit-tap-highlight-color: rgba(45, 106, 79, 0.15);
  }

  .day-cell:hover:not(.empty) {
    transform: none;
  }

  .day-num {
    font-size: 0.8rem;
  }

  .diet-badge {
    font-size: 0.55rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
    padding: 2px 3px;
  }

  .day-complete-x {
    font-size: 1.5rem;
  }

  .legend {
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
  }

  .legend-item {
    font-size: 0.68rem;
    padding: 5px 8px;
  }

  .tab-btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .panel-content {
    padding: 14px 14px 18px;
  }

  .panel-toolbar {
    padding: 10px 14px 0;
  }

  .rules-section h3 {
    font-size: 0.92rem;
  }

  .guide-list li,
  .forbidden-list li {
    font-size: 0.85rem;
  }

  .detail-header h3 {
    font-size: 1rem;
  }

  .meal-item {
    padding: 12px;
    min-height: 44px;
  }

  .complete-btn {
    min-height: 48px;
    padding: 14px 16px;
  }

  .btn-today {
    min-height: 44px;
    padding: 10px 16px;
  }

  .app-footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .app-footer-copyright {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .family-site-container {
    flex-shrink: 0;
  }

  .family-site-btn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.72rem;
  }

  .family-site-popup {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    min-width: min(280px, calc(100vw - 32px));
  }
}

@media (max-width: 480px) {
  .app {
    padding: 12px 10px 32px;
  }

  header h1 {
    font-size: 1.35rem;
  }

  .progress-counter {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  .calendar-card {
    padding: 10px 8px;
  }

  .weekdays,
  .days-grid {
    gap: 3px;
  }

  .day-cell {
    min-height: 38px;
    padding: 3px 2px;
    border-radius: 8px;
  }

  .day-num {
    font-size: 0.75rem;
  }

  .diet-badge {
    font-size: 0.5rem;
    -webkit-line-clamp: 2;
  }

  .weekdays span {
    font-size: 0.68rem;
  }

  .legend-item {
    font-size: 0.62rem;
    padding: 4px 6px;
  }

  .month-nav h2 {
    font-size: 1rem;
  }
}

/* ── Onboarding Modal (redesigned) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(27, 67, 50, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: modalOverlayIn 0.3s ease;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay[hidden] {
  display: none;
}

.modal-content {
  width: min(100%, 420px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 36px 28px 28px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  text-align: center;
  animation: modalContentIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
  margin-bottom: 6px;
}

#onboarding-choice > h2::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin: 8px auto 0;
  background: var(--accent);
  border-radius: 2px;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Choice cards (Step 1) ── */
.modal-btn-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  padding: 20px 16px;
  margin-bottom: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.modal-btn-choice::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-soft) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.modal-btn-choice:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.modal-btn-choice:hover::before {
  opacity: 1;
}

.modal-btn-choice:active {
  transform: translateY(-1px);
}

.modal-btn-choice .choice-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.modal-btn-choice .choice-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  position: relative;
}

.modal-btn-choice .choice-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  position: relative;
}

/* Google choice card — uses Google brand colors */
.modal-btn-choice.google {
  border-color: #dadce0;
}

.modal-btn-choice.google:hover {
  border-color: var(--google-blue);
  box-shadow: 0 8px 24px rgba(66, 133, 244, 0.15);
}

.modal-btn-choice.google::before {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.06) 0%, transparent 60%);
}

.modal-btn-choice.google .choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #dadce0;
  font-size: 0;
}

.modal-btn-choice.google .choice-icon::after {
  content: "G";
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--google-red) 0%, var(--google-yellow) 35%, var(--google-blue) 70%, var(--google-green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Consent box (Step 2 — Google only) ── */
.consent-box {
  text-align: left;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.consent-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}

.consent-items {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.consent-items li {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 18px;
  position: relative;
  line-height: 1.4;
}

.consent-items li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary-light);
  font-weight: 700;
  font-size: 0.72rem;
}

.consent-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.consent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--transition-fast);
}

.consent-check:hover {
  border-color: var(--primary-light);
}

.consent-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.consent-check em {
  color: var(--accent-coral);
  font-style: normal;
  font-weight: 700;
}

/* ── Form inputs (Step 2) ── */
.modal-label {
  display: block;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  margin-top: 4px;
}

.modal-content input[type="text"],
.modal-content input[type="date"] {
  width: 100%;
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-sunken);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.modal-content input[type="text"]::placeholder {
  color: #aab4b0;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: var(--surface);
  box-shadow: var(--focus-ring);
}

.modal-content input[type="date"] {
  color: var(--text);
}

/* ── Submit button ── */
.modal-submit {
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.25);
}

.modal-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(45, 106, 79, 0.35);
}

.modal-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.2);
}

.modal-submit:disabled {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
}

/* ── Notice box ── */
.modal-notice {
  margin-top: 18px;
  padding: 12px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  text-align: left;
}

.modal-notice strong {
  color: var(--primary);
  font-weight: 700;
}

/* ==========================================================================
   Training Room (트레이닝 룸) Styles
   ========================================================================== */

.training-layout {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 40px;
  width: 100%;
}

.mute-option-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.mute-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.mute-checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.training-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Slot Machine Styles */
.slot-machine-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: #f1f8e9;
  padding: 24px;
  border-radius: 16px;
  border: 2px dashed var(--primary-light);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.03);
}

.slot-machine {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  border: 6px solid #ffb300;
  border-radius: 16px;
  padding: 12px 24px;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.4), 0 8px 20px rgba(0,0,0,0.15);
}

.slot-window {
  width: 200px;
  height: 60px;
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  border: 3px solid #ffb300;
  position: relative;
}

.slot-reel {
  width: 100%;
  display: flex;
  flex-direction: column;
  transform: translateY(0px);
}

.reel-item {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #222;
  flex-shrink: 0;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.05);
}

.slot-pointer {
  font-size: 1.3rem;
  color: #ffeb3b;
  margin-left: 8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  animation: bounce 0.8s infinite alternate;
}

@keyframes bounce {
  from { transform: translateX(0); }
  to { transform: translateX(4px); }
}

.spin-btn {
  background: linear-gradient(135deg, #ffb300, #ff8f00);
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 143, 0, 0.4);
  transition: transform 0.1s, box-shadow 0.2s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 143, 0, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.spin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.slot-result {
  margin-top: 16px;
  text-align: center;
  background: #e8f5e9;
  border: 1.5px solid var(--primary-light);
  padding: 14px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot-result strong {
  color: var(--primary);
  font-weight: 900;
  font-size: 1.2rem;
  display: inline-block;
  margin-left: 6px;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Oracle Workout Card Styles */
.oracle-container {
  perspective: 1000px;
  width: 100%;
  max-width: 340px;
  height: 380px;
  margin: 0 auto 16px;
}

/* ── Workout section card font unification ── */
.lucky-workout-section .card {
  font-size: 0.88rem;
}
.lucky-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}
.lucky-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.oracle-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  cursor: pointer;
}

.oracle-card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  border: 2px solid var(--border);
  box-shadow: 0 6px 16px rgba(27, 67, 50, 0.06);
  display: flex;
  flex-direction: column;
  padding: 24px;
  box-sizing: border-box;
}

.card-front {
  background: linear-gradient(135deg, #1b4332, #2d6a4f);
  color: #fff;
  justify-content: center;
  align-items: center;
  border-color: #081c15;
}

.oracle-card-design {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.oracle-icon {
  font-size: 3.2rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.oracle-prompt {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  color: #ffeb3b;
}

.card-back {
  background: #fff;
  transform: rotateY(180deg);
  justify-content: space-between;
  border-color: var(--primary-light);
}

.workout-result-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.workout-result-content h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 8px;
}

.workout-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.workout-meta .badge {
  font-size: 0.75rem;
  background: #f5f5f5;
  color: #555;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.workout-meta .badge.category {
  background: var(--primary-soft);
  color: var(--primary);
}

.workout-video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.workout-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.workout-result-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 12px;
  flex-grow: 1;
}

.workout-btn-link {
  display: block;
  text-align: center;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 8px;
  transition: background 0.15s;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.2);
}

.workout-btn-link:hover {
  background: var(--primary-light);
}

.reset-workout-btn {
  display: block;
  margin: 0 auto;
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.reset-workout-btn:hover {
  background: #eee;
}

/* Spinner and Placeholder */
.loading-cell,
.empty-cell,
.error-cell {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-weight: 600;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(46, 125, 50, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin: 0 auto 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden-placeholder {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  margin-top: 16px;
}

.hidden-placeholder p {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.hidden-placeholder .placeholder-desc {
  font-size: 0.85rem;
  font-weight: normal;
}

/* ==========================================================================
   Main Page Ranking Panel Styles (메인페이지 랭킹 패널)
   ========================================================================== */

@media (min-width: 950px) {
  .main-layout {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    grid-template-rows: auto auto;
    gap: 20px;
    align-items: start;
  }
  .calendar-card {
    grid-column: 1;
    grid-row: 1;
  }
  .bottom-panel {
    grid-column: 1;
    grid-row: 2;
  }
  .side-layout {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
  }
}

.ranking-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 2px;
}

.ranking-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-elevated);
  border: 1px solid #e8f0eb;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: var(--transition);
  gap: 6px;
}

.ranking-item:hover {
  transform: translateX(4px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.ranking-item.is-me {
  background: #e8f5e9;
  border-color: var(--primary-light);
  box-shadow: 0 2px 6px rgba(46, 125, 50, 0.04);
}

.rank-num {
  font-size: 0.95rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.rank-name-wrapper {
  display: flex;
  align-items: center;
  flex-grow: 1;
  overflow: hidden;
  gap: 4px;
  min-width: 0;
}

.rank-name {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.me-tag {
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rank-streak {
  font-weight: 700;
  color: #e65100;
  font-size: 0.78rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.ranking-footer {
  margin-top: 4px;
  text-align: center;
}

.btn-more-rankings {
  display: inline-block;
  width: 100%;
  padding: 10px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  transition: var(--transition);
  border: 1px solid var(--border);
  white-space: nowrap;
  text-align: center;
}

.btn-more-rankings:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.2);
}

.btn-more-rankings:active {
  transform: translateY(0);
}

/* ==========================================================================
   Food Wishlist Panel Styles (음식 위시리스트 패널)
   ========================================================================== */

.side-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wishlist-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wishlist-header h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 2px;
}

.wishlist-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.wishlist-tabs {
  display: flex;
  gap: 4px;
  background: #f1f6f2;
  padding: 3px;
  border-radius: 6px;
}

.wish-tab-btn {
  flex: 1;
  padding: 5px 8px;
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

.wish-tab-btn:hover {
  color: var(--primary);
}

.wish-tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(27, 67, 50, 0.1);
  font-weight: 800;
}

.wishlist-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wishlist-form input {
  flex-grow: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}

.wishlist-form input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.wishlist-form button {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.15);
}

.wishlist-form button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.25);
}

.wishlist-form button:active:not(:disabled) {
  transform: translateY(0);
}

.wishlist-form button:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.wishlist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

/* Custom scrollbar for wishlist list */
.wishlist-list::-webkit-scrollbar {
  width: 4px;
}
.wishlist-list::-webkit-scrollbar-track {
  background: transparent;
}
.wishlist-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.wishlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-elevated);
  border: 1px solid #e8f0eb;
  border-radius: 8px;
  font-size: 0.78rem;
  transition: var(--transition);
}

.wishlist-item:hover {
  border-color: var(--primary-light);
  background: #f3faf5;
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}

.wish-item-name {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}

.wish-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.wish-item-likes {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-like-wish {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-like-wish:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.05);
}

.btn-like-wish:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-like-wish:disabled {
  background: var(--bg);
  color: var(--text-muted);
  border-color: #ddd;
  cursor: not-allowed;
}

/* ==========================================================================
   Google Login Area
   ========================================================================== */

.google-login-area {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.btn-google-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  color: #3c4043;
  border: 1.5px solid #dadce0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn-google-login:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: #c6c6c6;
  transform: translateY(-1px);
}
.btn-google-login:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-google-login:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.google-user-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}
.google-user-info:hover {
  border-color: var(--primary-light);
}
.google-avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--border);
}
.google-badge {
  padding: 2px 8px;
  background: #e8f0fe;
  color: var(--google-blue);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ==========================================================================
   Health Panel (건강 관리 탭)
   ========================================================================== */

.health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 768px) {
  .health-grid { grid-template-columns: 1fr; }
}

.health-profile,
.health-weight {
  padding: 18px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.health-profile:hover,
.health-weight:hover {
  box-shadow: var(--shadow);
}

.health-profile h3,
.health-weight h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
}

.health-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.health-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.health-row label {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.health-row input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

@media (max-width: 600px) {
  .health-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}
.health-row input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: var(--focus-ring);
}
.health-row input::placeholder {
  color: #aab4b0;
}

/* ── Read-only stat value display ── */
.stat-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  display: inline-block;
  padding: 4px 0;
}

.bmi-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  background: linear-gradient(160deg, var(--primary-soft) 0%, var(--surface-elevated) 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  gap: 2px;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}
.bmi-display::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(45, 106, 79, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.bmi-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bmi-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
}
.bmi-category {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
}

.btn-save-health {
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.15);
}
.btn-save-health:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.25);
}
.btn-save-health:active:not(:disabled) {
  transform: translateY(0);
}
.btn-save-health:disabled { opacity: .65; cursor: wait; }

/* ── Weight input row ── */
.weight-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.weight-input-row input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.weight-input-row input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: var(--focus-ring);
}
.weight-input-row input::placeholder {
  color: #aab4b0;
}
.btn-save-weight {
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #e89160 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(244, 162, 97, 0.25);
}
.btn-save-weight:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 162, 97, 0.35);
}
.btn-save-weight:active:not(:disabled) {
  transform: translateY(0);
}
.btn-save-weight:disabled { opacity: .65; cursor: wait; }

/* ── Weight chart ── */
.weight-chart-container {
  position: relative;
  height: 240px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.chart-empty {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-line;
  padding: 20px;
}




/* ════════════════════════════════════════════════════════════════════════════
   GOAL PROGRESS CARD (Training Room)
   ════════════════════════════════════════════════════════════════════════════ */
.goal-progress-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.goal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}
.goal-weight-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.85rem;
  background: var(--bg);
  padding: 12px 16px;
  border-radius: 12px;
}
.goal-step-item {
  text-align: center;
}
.goal-step-item .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 2px;
}
.goal-step-item .val {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
}
.goal-step-item.highlight .val {
  color: var(--primary);
  font-size: 1.25rem;
}
.weight-progress-track {
  height: 14px;
  background: #e2ece9;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.weight-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #40916c, #2d6a4f);
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* ════════════════════════════════════════════════════════════════════════════
   INBODY SUMMARY GRID (read-only display)
   ════════════════════════════════════════════════════════════════════════════ */
.inbody-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inbody-summary-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.inbody-summary-item .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.inbody-summary-item .val {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}
@media (max-width: 600px) {
  .inbody-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════════════════════════════
   INBODY COMPARISON (latest vs previous)
   ════════════════════════════════════════════════════════════════════════════ */
.inbody-compare {
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.inbody-compare-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 12px;
}

@media (max-width: 600px) {
  .inbody-compare-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.compare-card-item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.compare-card-item .label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.compare-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.compare-group .val {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.inbody-compare-date {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 12px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ════════════════════════════════════════════════════════════════════════════
   INBODY HISTORY TABLE STYLING
   ════════════════════════════════════════════════════════════════════════════ */
.inbody-history-table {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.inbody-history-table table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.82rem;
}

.inbody-history-table th {
  background: var(--surface-sunken);
  color: var(--primary);
  font-weight: 800;
  padding: 10px 8px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.inbody-history-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.inbody-history-table tr:last-child td {
  border-bottom: none;
}

.inbody-history-table tr:hover {
  background: var(--primary-soft);
}

/* ════════════════════════════════════════════════════════════════════════════
   TRAINING SECTION TRANSITIONS
   ════════════════════════════════════════════════════════════════════════════ */
.training-section {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.training-section.active {
  opacity: 1;
}
.training-section[hidden] {
  display: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   MYPAGE
   ════════════════════════════════════════════════════════════════════════════ */
.mypage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
  margin: 0 auto 24px;
  box-sizing: border-box;
}
.mypage-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.mypage-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  border: 2px solid var(--primary-light);
}
.mypage-user-info h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.mypage-user-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.mypage-section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin: 20px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ════════════════════════════════════════════════════════════════════════════
   Google User Info (nav-right)
   ════════════════════════════════════════════════════════════════════════════ */
.google-user-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.google-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.google-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}
.btn-logout-small {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  text-decoration: underline;
  transition: color 0.15s;
}
.btn-logout-small:hover {
  color: #c62828;
}

/* ════════════════════════════════════════════════════════════════════════════
   UNIFIED OVERRIDES (single source of truth, no !important conflicts)
   ════════════════════════════════════════════════════════════════════════════ */

/* App container */
.app { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; width: 100%; box-sizing: border-box; }

/* Top-level wrappers */
.main-layout,
.training-content {
  display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 100%;
  padding: 0; margin: 0; box-sizing: border-box;
}

/* Ensure cards fill width */
.dashboard-card,
.calendar-card,
.bottom-panel,
.phase-banner,
.card,
.goal-progress-card,
.mypage-card {
  width: 100%; max-width: 100%; box-sizing: border-box;
  margin-left: 0; margin-right: 0;
}

/* Compact header card */
.dashboard-card.compact {
  background: linear-gradient(135deg, #ffffff 0%, #f4f9f5 100%);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 24px; box-shadow: var(--shadow-sm);
  margin-bottom: 20px; min-height: 74px;
  display: flex; flex-direction: column; justify-content: center;
}

.dashboard-compact-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-bottom: 0;
}
.dashboard-compact-header h1 {
  font-size: 1.3rem; font-weight: 800; color: var(--primary);
  margin: 0; display: inline-flex; align-items: center; gap: 8px;
}
.plan-range-text {
  font-size: 0.88rem; font-weight: 600; color: var(--text-muted); margin-left: 8px;
}

/* Sub-tab bars */
.tab-bar {
  display: flex; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 6px; margin-bottom: 20px; width: 100%; box-sizing: border-box;
  justify-content: center;
}

.training-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.training-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Prevent text wrapping in nav */
.nav-links a,
.nav-right,
.nav-right *,
.brand-logo,
.google-user-name,
.btn-google-login,
.btn-logout-small {
  white-space: nowrap; word-break: keep-all;
}

@media (max-width: 768px) {
  .app-nav {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links a {
    padding: 6px 10px;
    font-size: 0.82rem;
    min-height: 36px;
  }
  .nav-right {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .dashboard-compact-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .plan-range-text {
    margin-left: 0;
    display: block;
  }
  .tab-bar {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 40px;
    flex: 1 0 auto;
  }
  .meal-item {
    padding: 8px 10px;
    gap: 6px;
  }
  .meal-item .meal-time {
    min-width: 28px;
    font-size: 0.68rem;
  }
  .meal-item .meal-label {
    font-size: 0.8rem;
    word-break: keep-all;
  }
  .panel-content {
    padding: 12px 14px 16px;
  }
  .modal-overlay {
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-content {
    width: 100% !important;
    max-width: min(100%, 400px) !important;
    box-sizing: border-box !important;
    padding: 24px 18px 20px !important;
    margin: auto !important;
  }
  .modal-btn-choice {
    padding: 12px 10px !important;
    box-sizing: border-box !important;
  }
  .modal-btn-choice .choice-title {
    font-size: 0.92rem;
  }
  .modal-btn-choice .choice-desc {
    font-size: 0.74rem;
  }
  .modal-content input[type="text"],
  .modal-content input[type="date"] {
    padding: 9px 10px !important;
    font-size: 0.88rem !important;
    margin-bottom: 10px !important;
    box-sizing: border-box !important;
  }
  .modal-submit {
    padding: 11px 12px !important;
    font-size: 0.9rem !important;
    box-sizing: border-box !important;
  }
  .consent-box {
    padding: 10px 8px !important;
    box-sizing: border-box !important;
  }
  .consent-title {
    font-size: 0.8rem !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   InBody Modal Grid & Chart Metric Tabs
   ════════════════════════════════════════════════════════════════════════════ */
.inbody-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
  text-align: left;
}

.inbody-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbody-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.inbody-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  box-sizing: border-box;
}

.inbody-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

@media (max-width: 540px) {
  .inbody-modal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.chart-metric-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.metric-btn {
  flex: 1;
  min-width: max-content;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.metric-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.metric-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Batch InBody Table Styling */
.batch-input-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.batch-input-table tr:last-child td {
  border-bottom: none;
}
.batch-input-table input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-sunken);
  font-size: 0.85rem;
  box-sizing: border-box;
  text-align: center;
}
.batch-input-table input[type="date"] {
  font-size: 0.78rem;
  padding: 5px 4px;
}
.batch-input-table input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

