:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --text: #030712;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #030712;
  --accent-hover: #111827;
  --blue: #386af5;

  --radius-card: 24px;
  --radius-control: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 12px 30px -3px rgba(0, 0, 0, .10),
  0 2px 6px -1px rgba(0, 0, 0, .12);
  --shadow-soft: 0 12px 30px -16px rgba(0, 0, 0, .25);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.hero {
  position: relative;
  text-align: center;
  padding: 28px 0 24px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -100px;
  background:
  radial-gradient(circle at 15% 20%, rgba(187, 247, 208, .55), transparent 30%),
  radial-gradient(circle at 85% 20%, rgba(254, 215, 170, .55), transparent 30%),
  radial-gradient(circle at 50% 70%, rgba(216, 180, 254, .45), transparent 40%);
  filter: blur(50px);
  z-index: -1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 11vw, 4.8rem);
  line-height: .95;
  letter-spacing: -.06em;
  font-weight: 800;
}

.subline {
  max-width: 620px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
  overflow-x: auto;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  transition: .18s ease;
}

.nav a:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card > * {
  position: relative;
  z-index: 1;
}

.form-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.form-head h2 {
  margin-bottom: 4px;
}

.form-subline {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

.secondary-link {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  font-size: .9rem;
  font-weight: 700;
  align-self: flex-start;
}

.secondary-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

label {
  display: grid;
  min-width: 0;
  gap: 8px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.grid > *,
.split-field > * {
  min-width: 0;
}

.split-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stepper-label {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin-bottom: 16px;
}

.stepper-label > label {
  display: block;
  margin: 0;
}

.stepper-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.stepper-label-row > label {
  margin: 0;
}

.stepper-clear {
  width: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  box-shadow: none;
}

.stepper-clear:hover {
  background: transparent;
  color: var(--blue);
}

.stepper {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.stepper-wheel {
  --wheel-item-height: 42px;
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  height: 0;
  padding: 0 42px;
  overflow: hidden;
  opacity: 0;
  border-top: 0 solid var(--line);
  background: #fff;
  transition: height 220ms ease, padding 220ms ease, opacity 160ms ease, border-width 220ms ease;
}

.stepper.is-wheel-open .stepper-wheel {
  height: 184px;
  padding-top: 8px;
  padding-bottom: 8px;
  opacity: 1;
  border-top-width: 1px;
}

.stepper-wheel.is-decimal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wheel-column {
  position: relative;
  z-index: 2;
  height: 168px;
  padding-block: 63px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.wheel-column::-webkit-scrollbar {
  display: none;
}

.wheel-item {
  height: var(--wheel-item-height);
  scroll-snap-align: center;
  color: #a8b0bc;
  font-size: 16px;
  font-weight: 500;
  line-height: var(--wheel-item-height);
  text-align: center;
  user-select: none;
}

.wheel-item.is-selected {
  color: var(--text);
  font-weight: 500;
}

.wheel-highlight {
  position: absolute;
  z-index: 1;
  top: 71px;
  right: 10px;
  left: 10px;
  height: var(--wheel-item-height);
  border-radius: 10px;
  background: var(--surface-2);
  pointer-events: none;
}

.stepper-wheel::before,
.stepper-wheel::after {
  content: "";
  position: absolute;
  z-index: 3;
  right: 0;
  left: 0;
  height: 52px;
  pointer-events: none;
}

.stepper-wheel::before {
  top: 0;
  background: linear-gradient(#fff, rgba(255, 255, 255, 0));
}

.stepper-wheel::after {
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
}

@media (prefers-reduced-motion: reduce) {
  .stepper-wheel {
    transition: none;
  }
}

.stepper:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(56, 106, 245, .12);
}

.stepper input {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  box-shadow: none;
}

.stepper input:focus {
  border-color: var(--line);
  box-shadow: none;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.stepper input[type="number"] {
  -moz-appearance: textfield;
}

.stepper-button {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.3rem;
  box-shadow: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.stepper-button:hover {
  background: #e8edfa;
}

.stepper-button:active {
  background: #dfe6f7;
}

.body-status-section,
.legacy-status-section {
  margin: 4px 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 14px;
  background: var(--surface-2);
}

.body-status-section > summary,
.legacy-status-section > summary {
  cursor: pointer;
  font-weight: 750;
}

.body-status-section[open] > summary,
.legacy-status-section[open] > summary {
  margin-bottom: 10px;
}

.body-status-timing {
  margin: 18px 0 8px;
  font-size: .92rem;
}

.body-status-timing:first-of-type {
  margin-top: 12px;
}

.body-status-matrix {
  display: grid;
  gap: 7px;
}

.body-status-head,
.body-status-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(108px, 1fr) minmax(108px, 1fr);
  gap: 8px;
  align-items: center;
}

.body-status-head {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
}

.body-status-head span:first-child {
  text-align: left;
}

.body-status-region {
  font-size: .84rem;
  font-weight: 650;
}

.body-status-control {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px 25px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.body-status-control input {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 2px;
  text-align: center;
  box-shadow: none;
  -moz-appearance: textfield;
}

.body-status-control input::-webkit-outer-spin-button,
.body-status-control input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.body-status-step,
.body-status-clear {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  box-shadow: none;
}

.body-status-clear {
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}

.body-status-step:hover,
.body-status-clear:hover {
  background: #e8edfa;
  color: var(--text);
}

@media (max-width: 600px) {
  .body-status-section,
  .legacy-status-section {
    margin-right: -4px;
    margin-left: -4px;
    padding: 12px;
  }

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

  .body-status-head span:first-child {
    display: none;
  }

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

  .body-status-region {
    grid-column: 1 / -1;
    margin-top: 4px;
  }

  .body-status-control {
    grid-template-columns: 32px minmax(0, 1fr) 32px 26px;
  }
}

input,
textarea,
select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(56, 106, 245, .12);
}

textarea {
  resize: vertical;
}

.checkbox-label {
  align-content: start;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  font-weight: 500;
}

.checkbox-row input {
  width: auto;
  box-shadow: none;
}

button {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  padding: 14px 18px;
  background: linear-gradient(0deg, #030712, #1f2937);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 3px 2px -1px rgba(0, 0, 0, .18);
  cursor: pointer;
}

button:hover {
  background: linear-gradient(0deg, #111827, #374151);
}

.upload-save-button {
  margin-bottom: 22px;
}

.danger-button {
  margin-top: 12px;
  border-color: #fecddb;
  background: #fff1f4;
  color: #bf1158;
  box-shadow: none;
}

.danger-button:hover {
  background: #ffe4eb;
}

.notice {
  background: #eff4ff;
  border: 1px solid #bfd4fe;
  color: #1e39d7;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  margin-bottom: 16px;
  font-weight: 700;
}

.history {
  margin-top: 18px;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  letter-spacing: -.03em;
}

.empty {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

th,
td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.table-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.table-link:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 4px 9px;
  font-size: .78rem;
  font-weight: 800;
}

.status.active {
  background: #ecfdf3;
  color: #067647;
}

.status.inactive {
  background: #f3f4f6;
  color: #6b7280;
}

@media (min-width: 720px) {
  .app {
    padding-top: 32px;
  }

  .hero {
    padding-top: 48px;
    padding-bottom: 32px;
  }

  .card {
    padding: 28px;
  }

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

  .form-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}


/* Calendar */

.calendar-toolbar,
.calendar-legend,
.stats-card {
  margin-bottom: 22px;
}

.calendar-toolbar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.year-nav,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.14);
}

.button-light {
  background: rgba(255, 255, 255, 0.78);
  color: #111827;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 0.9rem;
  color: #475569;
}

.legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: -2px;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.legend-dot.empty {
  background: #f8fafc;
}

.legend-dot.log {
  background: #dcfce7;
}

.legend-dot.activity {
  background: #e9d5ff;
}

.legend-dot.both {
  background:
  linear-gradient(
    135deg,
    #dcfce7 0%,
    #dcfce7 50%,
    #e9d5ff 50%,
    #e9d5ff 100%
  );
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.stats-grid > div {
  padding: 16px;
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.stat-label {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 0.84rem;
}

.stats-grid strong {
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

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

.month-card {
  padding: 22px;
}

.month-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

.weekday-row {
  margin-bottom: 7px;
}

.weekday {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.days-grid {
  align-items: stretch;
}

.week-export-cell {
  min-height: 38px;
}

.week-export {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #475569;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 800;
}

.day-cell {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  text-decoration: none;
  color: #111827;
  font-size: 0.86rem;
  font-weight: 750;
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.day-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.12);
}

.day-cell.empty {
  background: #f8fafc;
  color: #94a3b8;
}

.day-cell.log {
  background: #dcfce7;
}

.day-cell.activity {
  background: #e9d5ff;
}

.day-cell.both {
  background:
  linear-gradient(
    135deg,
    #dcfce7 0%,
    #dcfce7 50%,
    #e9d5ff 50%,
    #e9d5ff 100%
  );
}

.day-cell.today {
  box-shadow:
  0 0 0 2px #ffffff,
  0 0 0 4px rgba(17, 24, 39, 0.35);
}

.outside-month {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
}

.activity-count {
  position: absolute;
  right: -4px;
  top: -5px;
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 800;
  border: 2px solid #ffffff;
}

.compact-table {
  margin-top: 14px;
}

@media (max-width: 860px) {
  .calendar-year {
    grid-template-columns: 1fr;
  }

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

  .calendar-grid {
    grid-template-columns: 48px repeat(7, minmax(0, 1fr));
    gap: 5px;
  }

  .day-cell,
  .week-export-cell {
    min-height: 34px;
  }

  .month-card {
    padding: 18px;
  }

  .month-head {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .calendar-grid {
    grid-template-columns: 42px repeat(7, minmax(0, 1fr));
  }

  .day-cell {
    min-height: 32px;
    border-radius: 11px;
    font-size: 0.78rem;
  }

  .week-export {
    font-size: 0.66rem;
    border-radius: 11px;
  }
}

.icon-button {
  appearance: none;
  -webkit-appearance: none;

  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;

  padding: 0;
  margin: 0;

  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1;

  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus,
.icon-button:active {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;

  color: #94a3b8;
  transform: none;
}

/* Activity context: RPE + tags */

.tag-field {
  margin-top: 18px;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 750;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tag-chip {
  display: inline-flex;
  cursor: pointer;
}

.tag-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #475569;
  font-size: 0.86rem;
  font-weight: 650;
}

.tag-chip input:checked + span {
  background:
  linear-gradient(
    135deg,
    rgba(220, 252, 231, 0.9),
    rgba(233, 213, 255, 0.9)
  );
  border-color: rgba(124, 58, 237, 0.18);
  color: #111827;
}

.action-column {
  width: 28px;
  min-width: 28px;
  padding-left: 0;
  padding-right: 0;
  text-align: left;
}

.inline-delete {
  display: inline;
}

.icon-button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  padding: 0;
  margin: 0;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus,
.icon-button:active {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  color: #94a3b8;
  transform: none;
}

/* Review pages */

.period-actions,
.calendar-toolbar,
.calendar-legend,
.stats-card {
  margin-bottom: 28px;
}

.period-group h2 {
  margin-bottom: 14px;
}

.month-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.review-toolbar {
  margin-bottom: 28px;
}

.review-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

.quality-list {
  display: grid;
  gap: 12px;
}

.quality-list > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.quality-list span {
  color: #64748b;
}

.quality-list strong {
  color: #111827;
}

.subheading {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 1rem;
}

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

.tag-summary span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background:
  linear-gradient(
    135deg,
    rgba(220, 252, 231, 0.8),
    rgba(233, 213, 255, 0.8)
  );
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
}

.simple-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 220px;
  padding-top: 20px;
  margin-top: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.chart-bar-wrap {
  flex: 1;
  min-width: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.chart-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 999px 999px 0 0;
  background:
  linear-gradient(
    180deg,
    rgba(216, 180, 254, 0.9),
    rgba(187, 247, 208, 0.9)
  );
  min-height: 4px;
}

.chart-bar.soft {
  background:
  linear-gradient(
    180deg,
    rgba(254, 215, 170, 0.9),
    rgba(216, 180, 254, 0.75)
  );
}

.chart-bar-wrap span {
  min-height: 26px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #64748b;
  font-size: 0.72rem;
  white-space: nowrap;
}

.stacked-bars {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.stacked-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
}

.stacked-row > span {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
}

.stacked-values {
  display: grid;
  gap: 6px;
}

.stacked-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.92);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.stacked-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.run-bar {
  background: rgba(216, 180, 254, 0.95);
}

.bike-bar {
  background: rgba(187, 247, 208, 0.95);
}

.chart-legend-inline {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  color: #64748b;
  font-size: 0.84rem;
}

.chart-legend-inline i {
  display: inline-block;
  width: 20px;
  height: 8px;
  border-radius: 999px;
  margin-right: 6px;
}

.line-chart {
  position: relative;
  display: flex;
  gap: 8px;
  height: 220px;
  margin-top: 18px;
  padding-top: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background:
  linear-gradient(
    to bottom,
    transparent,
    transparent 32%,
    rgba(148, 163, 184, 0.12) 32%,
    rgba(148, 163, 184, 0.12) 33%,
    transparent 33%,
    transparent 66%,
    rgba(148, 163, 184, 0.12) 66%,
    rgba(148, 163, 184, 0.12) 67%,
    transparent 67%
  );
}

.line-point-wrap {
  position: relative;
  flex: 1;
  min-width: 18px;
}

.line-point {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #111827;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(216, 180, 254, 0.55);
}

.line-point-wrap em {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%) rotate(-45deg);
  transform-origin: center;
  color: #64748b;
  font-size: 0.72rem;
  font-style: normal;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .review-grid {
    grid-template-columns: 1fr;
  }

  .review-stats {
    grid-template-columns: 1fr;
  }

  .month-actions {
    justify-content: flex-start;
  }

  .simple-chart,
  .line-chart {
    overflow-x: auto;
  }

  .chart-bar-wrap,
  .line-point-wrap {
    min-width: 28px;
  }
}

main.app > .card,
main.app > .review-grid {
  margin-bottom: 22px;
}

.chart-value {
  margin-top: 4px;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Year comparison + race reviews */

.compare-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.compare-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  min-height: 260px;
  margin-top: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.compare-month {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 8px;
  min-width: 42px;
  text-align: center;
}

.compare-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 190px;
}

.compare-bars i,
.compare-bars b {
  display: block;
  width: 13px;
  min-height: 3px;
  border-radius: 999px 999px 0 0;
}

.compare-bars i,
.compare-a {
  background: rgba(216, 180, 254, 0.95);
}

.compare-bars b,
.compare-b {
  background: rgba(187, 247, 208, 0.95);
}

.compare-month strong {
  color: #334155;
  font-size: 0.78rem;
}

.compare-month span {
  color: #64748b;
  font-size: 0.7rem;
  white-space: nowrap;
}

.compare-lines > div {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  align-items: center;
}

.compare-lines i {
  display: block;
  height: 11px;
  border-radius: 999px;
}

.compare-lines small {
  color: #64748b;
  font-size: 0.72rem;
  text-align: right;
}

.race-chart.simple-chart {
  min-height: 250px;
  padding-bottom: 22px;
}

.after-chart.simple-chart {
  max-width: 520px;
}

.chart-value {
  margin-top: 4px;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .compare-form {
    grid-template-columns: 1fr;
  }

  .compare-chart {
    overflow-x: auto;
  }

  .compare-month {
    min-width: 48px;
  }
}

/* Mobile burger navigation */

.nav.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav.app-nav .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.nav-brand {
  display: none;
  font-weight: 800;
  color: #111827;
}

.nav-toggle {
  display: none !important;
}

.nav.app-nav .nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .nav.app-nav .nav-inner {
    min-height: 56px;
  }

  .nav-brand {
    display: inline-flex;
  }

  .nav-toggle {
    display: inline-flex !important;
    position: relative;
    z-index: 1001;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #111827;
  }

  .nav-icon {
    position: absolute;
    width: 22px;
    height: 22px;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
  }

  .nav-icon-close {
    opacity: 0;
    visibility: hidden;
  }

  .nav-toggle.is-open .nav-icon-menu {
    opacity: 0;
    visibility: hidden;
  }

  .nav-toggle.is-open .nav-icon-close {
    opacity: 1;
    visibility: visible;
  }

  .nav.app-nav .nav-links {
    display: none !important;
  }

  .nav.app-nav.nav-open .nav-links {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100vw;
    height: 100vh;
    padding: 72px 24px;
    background:
    radial-gradient(circle at 15% 20%, rgba(187, 247, 208, 0.52), transparent 30%),
    radial-gradient(circle at 85% 22%, rgba(254, 215, 170, 0.52), transparent 30%),
    radial-gradient(circle at 50% 74%, rgba(216, 180, 254, 0.48), transparent 38%),
    #f8fafc;
  }

  .nav.app-nav.nav-open .nav-links a {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #111827;
    font-size: clamp(2rem, 10vw, 4rem);
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -0.06em;
  }

  .nav.app-nav.nav-open .nav-links a.secondary-link {
    margin-top: 0.35rem;
    color: #64748b;
    font-size: clamp(1.4rem, 7vw, 2.4rem);
  }

  body.nav-menu-open {
    overflow: hidden;
  }
}

.activity-glossary {
  margin-top: 22px;
}

.activity-glossary summary {
  cursor: pointer;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 18px;
}

.glossary-grid h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.glossary-grid p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.glossary-grid strong {
  color: var(--text);
}

@media (max-width: 760px) {
  .glossary-grid {
    grid-template-columns: 1fr;
  }
}

/* Review chart layout fixes */

.simple-chart {
  align-items: stretch;
  height: 260px;
  padding-top: 24px;
  padding-bottom: 0;
  overflow: hidden;
}

.chart-bar-wrap {
  display: grid;
  grid-template-rows: 28px 1fr 48px;
  align-items: end;
  justify-items: center;
  height: 100%;
  gap: 6px;
}

.chart-bar-wrap span:not(.chart-value) {
  align-self: start;
  justify-self: center;
  min-height: 42px;
  line-height: 1.1;
  text-align: center;
}

.chart-value {
  align-self: end;
  margin: 0;
  text-align: center;
}

.chart-bar {
  align-self: end;
  justify-self: center;
}

.chart-bar-wrap span {
  align-self: start;
  min-height: 42px;
  line-height: 1.1;
}

.line-chart {
  height: 280px;
  padding-top: 28px;
  padding-bottom: 48px;
  overflow: hidden;
}

.line-point-wrap em {
  bottom: -38px;
}

.line-value {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-36px);
  color: #111827;
  font-size: 0.82rem;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
}

.line-point {
  z-index: 2;
}

.line-value {
  z-index: 3;
}
