@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;700&display=swap");

:root {
  --bg: #f2f9f8;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --primary: #0f766e;
  --primary-soft: #d7f5ef;
  --accent: #f59e0b;
  --danger: #dc2626;
  --line: #d8e2eb;
  --shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  background: radial-gradient(circle at 90% 4%, #d6f0ff 0%, transparent 28%),
    radial-gradient(circle at 8% 20%, #dafaf4 0%, transparent 32%),
    var(--bg);
  font-family: "Outfit", "Noto Sans KR", sans-serif;
}

body {
  display: flex;
  justify-content: center;
  padding: 20px 12px 100px;
}

.global-loading-bar {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  pointer-events: none;
  opacity: 0;
  z-index: 120;
  transition: opacity 180ms ease;
}

.global-loading-bar.active {
  opacity: 1;
}

.global-loading-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #34d399 0%, #0f766e 55%, #0ea5e9 100%);
  box-shadow: 0 0 10px rgba(15, 118, 110, 0.45);
  transition: width 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.app {
  width: min(980px, 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.logo img {
  width: 34px;
  height: 34px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  animation: slide-in 260ms ease-out;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  row-gap: 8px;
  align-items: center;
}

.button-row > button {
  min-width: 110px;
  max-width: 100%;
  justify-self: start;
}

.button-row > button:nth-child(even) {
  justify-self: end;
}

.button-row > button:only-child {
  grid-column: 1 / -1;
  justify-self: center;
}

.profile-action-row > button {
  justify-self: end;
}

.profile-action-row > button:only-child {
  grid-column: 2;
  justify-self: end;
}

.home-start-row > button,
.home-start-row > button:nth-child(even) {
  justify-self: start;
}

.home-start-row > button:only-child {
  grid-column: 1;
  justify-self: start;
}

.login-action-row {
  margin-top: 16px;
}

.login-google-btn {
  width: 100%;
}

.login-actions-wrap {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.login-action-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.login-action-line > button {
  min-width: 120px;
}

.login-signup-line > button {
  min-width: 132px;
}

.field {
  flex: 1;
  min-width: 130px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field textarea:focus,
.field select:focus {
  border-color: #61c8bd;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.custom-exercise-checkbox-row {
  margin-top: 10px;
}

label.checkbox-label,
.field label.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.checkbox-label .checkbox-text {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  line-height: 1.2;
}

button {
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.03);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #e2ecf3;
  color: #1f2937;
}

button.warn {
  background: var(--accent);
  color: #1f2937;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-panel {
  max-width: 560px;
  margin: 48px auto 0;
}

.main {
  display: none;
}

.main.active {
  display: block;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: min(980px, calc(100% - 22px));
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #334155;
  border: 1px solid transparent;
  font-size: 12px;
  line-height: 1.2;
  padding: 10px 6px;
  white-space: normal;
}

.tab-btn.active {
  background: #f0fdfa;
  border-color: #a7f3d0;
  color: var(--primary);
}

.bottom-nav.session-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.session-nav-btn {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  font-size: 13px;
}

.session-nav-btn.rest-running {
  background: #f59e0b;
  color: #1f2937;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  padding: 12px;
}

.log-card {
  padding: 0;
  overflow: hidden;
}

.log-card.is-expanded {
  border-color: #8ec5ff;
  background: #f8fbff;
}

.log-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 12px;
  text-align: left;
}

.log-card-title-wrap {
  display: grid;
  gap: 4px;
}

.log-card-title {
  font-size: 15px;
  font-weight: 700;
}

.log-card-chevron {
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
}

.log-loading-text {
  margin: 0 12px 12px;
}

.log-detail-wrap {
  border-top: 1px solid #d9e7f4;
  margin-top: 0;
  padding: 10px 12px 12px;
}

.log-item-block + .log-item-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d8e3ef;
}

.log-item-block h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.log-set-row {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
}

.program-list-item.is-active {
  border-color: #0f766e;
  background: linear-gradient(180deg, #f0fdf8 0%, #e8faf6 100%);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.active-program-label {
  margin: 0 0 6px;
  color: #0f766e;
  font-weight: 700;
}

button.active-program-btn {
  background: #0f766e;
  color: #ffffff;
}

.list-item h4 {
  margin: 0 0 6px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-search-row {
  align-items: flex-end;
}

.analytics-search-btn {
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  align-self: flex-end;
  white-space: nowrap;
}

.analytics-selected-name {
  margin: 8px 0 0;
}

.analytics-chart-wrap {
  margin-top: 10px;
}

.analytics-chart-note {
  margin: 0 0 8px;
  color: #0f766e;
  font-weight: 600;
}

.analytics-chart-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.analytics-chart-meta p {
  margin: 0;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.analytics-chart-change {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.analytics-chart-change.is-up {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.analytics-chart-change.is-down {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fca5a5;
}

.analytics-chart-change.is-flat {
  color: #1e3a8a;
  background: #dbeafe;
  border-color: #93c5fd;
}

.analytics-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.analytics-chart-header h3 {
  margin: 0;
}

.analytics-chart-exercise {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #dbe5ef;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.analytics-chart-exercise.is-selected {
  border-color: #9ddfd4;
  background: #d7f5ef;
  color: #0f766e;
}

.analytics-chart-scroll {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  padding-bottom: 2px;
}

.analytics-chart-svg {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  display: block;
  background: #ffffff;
  border: 1px solid #d7e3ed;
  border-radius: 12px;
}

.analytics-chart-baseline {
  stroke: #cbd5e1;
  stroke-width: 1.1;
  stroke-dasharray: 4 4;
}

.analytics-chart-area {
  fill: url(#analyticsVolumeAreaGradient);
}

.analytics-chart-line {
  fill: none;
  stroke: #0f766e;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 6px 10px rgba(15, 118, 110, 0.2));
}

.analytics-chart-dot {
  fill: #0d9488;
  stroke: #ffffff;
  stroke-width: 1.6;
}

.analytics-chart-y-label,
.analytics-chart-x-label {
  fill: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.analytics-chart-latest {
  margin: 8px 2px 0;
}

.program-day-card {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.program-day-editor-wrap {
  margin-top: 22px;
}

.program-day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 10px;
}

.program-day-nav p {
  margin: 0;
}

.program-day-nav button {
  flex: 0 0 auto;
  min-width: 108px;
}

.program-day-nav-bottom {
  margin-top: 12px;
  margin-bottom: 0;
}

.program-day-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.select-program-day-btn,
.open-day-editor-btn {
  white-space: nowrap;
  border: 1px solid #cbdbe8;
}

.select-program-day-btn.active,
.open-day-editor-btn.active {
  background: #dff4ef;
  border-color: #8fd8c8;
  color: #0f766e;
}

.program-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.program-day-header h3 {
  margin: 0;
}

.program-day-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
  background: #e8faf6;
  border: 1px solid #bcebe0;
}

.program-items-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.program-item-card {
  border: 1px solid #d7e3ed;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
}

.program-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.program-item-head h4 {
  margin: 0;
  font-size: 14px;
}

.program-item-head .small {
  margin: 0;
}

.program-item-grid-basic {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.program-item-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e5edf4;
}

.program-item-section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.program-item-exercise-picker {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.program-item-selected-name {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid #d7e3ed;
  border-radius: 12px;
  background: #f8fbff;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.program-item-search-row {
  align-items: flex-end;
}

.program-item-search-results {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.program-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d7e3ed;
  border-radius: 12px;
  background: #f8fcff;
}

.program-search-result-content {
  min-width: 0;
}

.program-search-result-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.program-search-result .small {
  margin: 0;
}

.program-search-result button {
  min-width: 68px;
}

.program-item-grid-rule {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.program-item-hint {
  margin: 0;
  align-self: center;
}

.program-item-actions {
  margin-top: 10px;
}

.program-day-actions {
  margin-top: 10px;
  grid-template-columns: minmax(0, 1fr);
}

.program-item-actions > button,
.program-day-actions > button {
  justify-self: start;
}

.program-item-actions > button:nth-child(even),
.program-day-actions > button:nth-child(even) {
  justify-self: start;
}

.program-item-actions > button:only-child,
.program-day-actions > button:only-child {
  grid-column: 1;
  justify-self: start;
}

.program-day-actions > button,
.program-day-actions > button:nth-child(even),
.program-day-actions > button:only-child {
  width: 100%;
  grid-column: 1 / -1;
  justify-self: stretch;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px;
}

.set-grid.active-set {
  border-color: #93c5fd;
  background: #eff6ff;
}

.session-item-card.active-item-card {
  border: 1px solid #60a5fa;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.15) inset;
}

.session-item-card.reorder-source {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25) inset;
}

.session-item-card.reorder-over {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.24) inset;
}

.set-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.set-done-btn {
  justify-self: start;
  min-width: 84px;
  padding: 8px 12px;
  font-size: 12px;
}

.set-remove-btn {
  justify-self: end;
  min-width: 84px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
}

.session-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.session-item-head + .set-grid,
.session-item-head + .session-prev-record {
  margin-top: 10px;
}

.session-item-head h3 {
  margin: 0;
}

.session-item-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.session-item-remove-btn {
  min-width: 64px;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
}

.session-set-footer {
  margin-top: 8px;
}

.session-prev-record {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid #dbe7f1;
  border-radius: 10px;
  background: #f8fbff;
}

.session-prev-title {
  margin: 0 0 6px;
  font-weight: 600;
  color: #334155;
}

.session-prev-row {
  margin: 0;
}

.session-add-search-row {
  align-items: flex-end;
}

.session-add-selected-name {
  margin: 8px 0 0;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px dashed #94a3b8;
  color: #334155;
  cursor: grab;
  user-select: none;
  background: #f8fafc;
  font-weight: 700;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle.reorder-source {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #92400e;
}

#tab-session {
  width: 100%;
}

#tab-session.active {
  animation: slide-in 200ms ease-out;
}

#tab-session .card {
  margin-bottom: 12px;
}

.notice {
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  padding: 10px 12px;
  font-size: 13px;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.hidden {
  display: none;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 740px) {
  body {
    padding: 12px 10px 100px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .set-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .set-actions {
    grid-column: 1 / -1;
  }

  .analytics-search-row {
    align-items: stretch;
  }

  .analytics-search-btn {
    width: 100%;
  }

  .analytics-chart-svg {
    min-width: 0;
  }

  .analytics-chart-header {
    align-items: flex-start;
  }

  .analytics-chart-meta {
    grid-template-columns: 1fr;
  }

  .program-day-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .program-day-nav {
    align-items: center;
    flex-direction: row;
  }

  .program-item-grid-basic,
  .program-item-grid-rule {
    grid-template-columns: 1fr;
  }

  .program-item-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .program-search-result {
    align-items: stretch;
    flex-direction: column;
  }

  .program-search-result button {
    width: 100%;
  }
}
