:root {
  color-scheme: light;
  --bg: #05090d;
  --panel: #0b121d;
  --panel-soft: #101927;
  --ink: #f4f8ff;
  --muted: #9fb0c9;
  --line: #22314a;
  --accent: #00d8d8;
  --accent-strong: #45f3ff;
  --accent-dark: #005d63;
  --soft: #082c35;
  --shadow: none;
}

* {
  box-sizing: border-box;
  max-width: 100%;
}

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

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

.app-shell {
  width: 100%;
  max-width: min(1120px, 100vw);
  margin: 0 auto;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 390px) minmax(0, 1fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.entry-panel,
.graph-panel,
.profile-panel {
  padding: 18px;
}

.masthead,
.section-header,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 10vw, 3.05rem);
  line-height: 1;
}

h2 {
  font-size: 1.35rem;
}

.score-chip {
  min-width: 86px;
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid rgba(0, 216, 216, 0.3);
  color: var(--accent-strong);
  text-align: center;
}

.score-chip span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.score-chip strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.entry-form {
  margin-top: 22px;
}

.field-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

label,
.question-title {
  font-weight: 750;
}

label {
  color: #dce9ff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1624;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 107, 87, 0.14);
}

.question-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
  padding: 16px 0 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-inline-size: 0;
  overflow: hidden;
}

.question-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  min-width: 0;
}

.question-title span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.question-title span:last-child {
  color: var(--accent);
}

.scale {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.scale span {
  min-width: 0;
}

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

.scale label {
  display: grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  background: #0d1624;
  transition: 150ms ease;
  font-size: 0.96rem;
  text-transform: none;
}

.scale input:checked + label {
  border-color: var(--accent);
  background: linear-gradient(180deg, #00d8d8, #00757b);
  color: #001013;
}

.scale-help {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 2px;
}

.primary-button {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #00d8d8, #00777c);
  color: #001013;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.full-button {
  width: 100%;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--accent-strong);
  padding: 8px 10px;
  font-weight: 800;
  cursor: pointer;
}

#save-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.chart-frame {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #07101a;
}

#trend-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
}

.axis-text {
  fill: var(--muted);
  font-size: 12px;
}

.grid-line {
  stroke: #1d2a40;
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acute-line,
.baseline-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acute-line {
  stroke: #f5c542;
  stroke-width: 3;
}

.baseline-line {
  stroke: #7f8cff;
  stroke-width: 3;
  stroke-dasharray: 8 8;
}

.point {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 3;
}

.point.green,
.heat-day.green,
.metric-card.green {
  border-color: rgba(26, 216, 120, 0.65);
}

.point.green {
  stroke: #1ad878;
}

.point.yellow {
  stroke: #f5c542;
}

.point.red {
  stroke: #ff5d5d;
}

.empty-state {
  fill: var(--muted);
  font-size: 17px;
  text-anchor: middle;
}

.table-wrap {
  margin-top: 18px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card span {
  font-size: 0.75rem;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin: 6px 0;
  color: var(--ink);
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metric-card.green {
  background: rgba(26, 216, 120, 0.08);
}

.metric-card.yellow {
  border-color: rgba(245, 197, 66, 0.65);
  background: rgba(245, 197, 66, 0.08);
}

.metric-card.red {
  border-color: rgba(255, 93, 93, 0.75);
  background: rgba(255, 93, 93, 0.08);
}

.mini-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 10px;
}

.mini-header h3 {
  margin: 0;
  font-size: 1rem;
}

.mini-header span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.heat-day {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 7px;
  background: #141f30;
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid var(--line);
}

.heat-day.green {
  background: rgba(26, 216, 120, 0.22);
  color: #dffff0;
}

.heat-day.yellow {
  background: rgba(245, 197, 66, 0.25);
  color: #fff6cf;
  border-color: rgba(245, 197, 66, 0.55);
}

.heat-day.red {
  background: rgba(255, 93, 93, 0.25);
  color: #ffe1e1;
  border-color: rgba(255, 93, 93, 0.65);
}

.heat-day.empty {
  opacity: 0.5;
}

.insight-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.insight-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: #dce9ff;
}

.training-panel {
  margin-top: 18px;
  padding-top: 2px;
}

.training-panel .mini-header {
  align-items: flex-end;
}

.training-panel .mini-header > div {
  min-width: 0;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.file-upload {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px dashed rgba(0, 216, 216, 0.45);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  cursor: pointer;
  text-transform: none;
}

.file-upload input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

#training-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.training-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.training-summary article {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1624;
}

.training-summary span,
.training-summary small {
  display: block;
  color: var(--muted);
}

.training-summary span {
  font-size: 0.72rem;
  text-transform: uppercase;
}

.training-summary strong {
  display: block;
  margin: 5px 0;
  color: var(--ink);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

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

th {
  position: sticky;
  top: 0;
  background: #0d1624;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td:nth-child(2) {
  color: var(--accent);
  font-weight: 800;
}

.profile-panel {
  grid-column: 1 / -1;
}

.intro-copy {
  color: var(--muted);
  margin: 10px 0 18px;
  max-width: 34rem;
}

.profile-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.profile-form .field-row {
  margin: 0;
}

.app-shell.has-profile .profile-panel {
  display: none;
}

.athlete-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.athlete-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.athlete-strip strong {
  display: block;
  color: var(--ink);
}

@media (max-width: 1100px) {
  *,
  *::before,
  *::after {
    max-width: 100%;
  }

  .app-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 8px;
    overflow-x: clip;
  }

  .entry-panel,
  .graph-panel,
  .profile-panel {
    padding: 14px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 12px;
    overflow-x: clip;
  }

  .masthead,
  .section-header,
  .actions {
    align-items: stretch;
  }

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

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

  .profile-form {
    grid-template-columns: 1fr;
  }

  .profile-form .field-row {
    margin-bottom: 14px;
  }

  .profile-panel h1 {
    font-size: 2rem;
    line-height: 1.05;
  }

  .intro-copy {
    font-size: 0.95rem;
    line-height: 1.35;
  }

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

  .scale label {
    min-height: 46px;
    font-size: 1rem;
    font-weight: 850;
  }

  .scale-help {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 4px;
  }

  .question-card {
    padding: 14px 0 13px;
  }

  .question-title {
    margin-bottom: 10px;
    font-size: 1.08rem;
    line-height: 1.2;
  }

  .question-title span:last-child {
    font-size: 1.2rem;
  }

  .notes-row {
    display: none;
  }

  .primary-button {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
  }
}

@media (max-width: 540px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .masthead,
  .section-header,
  .actions {
    flex-direction: column;
  }

  .score-chip,
  #save-status {
    width: 100%;
    text-align: left;
  }

  .app-shell {
    padding: 6px;
  }

  h1 {
    font-size: 2rem;
  }

  .entry-panel h1 {
    font-size: 2.35rem;
  }

  .entry-panel,
  .graph-panel,
  .profile-panel {
    padding: 14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .question-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .scale-help {
    font-size: 1rem;
  }

  label {
    font-size: 0.92rem;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .athlete-strip {
    display: block;
  }

  .athlete-strip .ghost-button {
    width: 100%;
    margin-top: 10px;
    min-height: 48px;
  }

  .chart-frame {
    margin-top: 14px;
  }

  .upload-row,
  .training-summary {
    grid-template-columns: 1fr;
  }

  #trend-chart {
    min-height: 210px;
  }

  th,
  td {
    padding: 8px;
    font-size: 0.82rem;
  }
}
