:root {
  --bg: #020712;
  --panel: #061323;
  --panel-2: #0b1d30;
  --text: #edf5ed;
  --muted: #8da6ba;
  --line: rgba(237, 245, 237, 0.11);
  --accent: #08db2d;
  --accent-2: #08a7ff;
  --warn: #ffd521;
  --bad: #ff5b24;
  --ease: cubic-bezier(.23, 1, .32, 1);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 52% -8%, rgba(8, 167, 255, 0.2), transparent 28rem),
    linear-gradient(180deg, #030916 0%, var(--bg) 54%, #00040b 100%);
}

body.sun {
  --bg: #14211d;
  --panel: #eef4e7;
  --panel-2: #ddebdc;
  --text: #10201c;
  --muted: #496057;
  --line: rgba(16, 32, 28, 0.16);
  --accent: #146c48;
  --accent-2: #0d625c;
  background: #e8efe1;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(150px + env(safe-area-inset-bottom));
  position: relative;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.eyebrow,
.label,
label span,
.setup-card span,
.next-move span,
.boat-iq span,
.learned span,
.best-grid span {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}

.icon-button:active,
.primary-action:active,
.secondary-action:active,
.segment:active,
.dock-item:active {
  transform: scale(0.97);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  display: none;
  animation: rise 260ms var(--ease) both;
}

.view.is-active {
  display: block;
}

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

.manifest-card,
.stance-panel,
.setup-card,
.next-move,
.learned,
.history-row,
.quick-log,
.video-capture,
.session-tile,
.score-dashboard,
.diagnosis-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 40px rgba(0, 0, 0, 0.22);
}

.preflight-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.setup-rider-tile,
.setup-condition-tile {
  min-height: 118px;
}

.setup-rider-tile strong,
.setup-condition-tile strong {
  font-size: 25px;
}

.stance-panel {
  margin-top: 8px;
  padding: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.is-selected {
  background: var(--text);
  color: var(--bg);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

label:nth-child(4) {
  grid-column: auto;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input[type="range"] {
  accent-color: var(--accent);
}

.setup-card {
  padding: 16px;
}

.manifest-card {
  margin-top: 14px;
  padding: 16px;
}

.split-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.split-line strong {
  color: var(--accent-2);
}

.recommendation strong {
  display: block;
  font-size: 25px;
  line-height: 1.12;
}

.recommendation strong span {
  display: inline;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
}

.crew-manifest {
  display: grid;
  gap: 8px;
}

.crew-card {
  display: grid;
  grid-template-columns: 30px 50px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(8, 167, 255, 0.17);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 167, 255, 0.11), rgba(8, 219, 45, 0.035)),
    rgba(0, 8, 20, 0.34);
  transition: border-color 180ms var(--ease), opacity 180ms var(--ease), transform 160ms var(--ease);
}

.crew-card.is-rider {
  border-color: rgba(8, 219, 45, 0.5);
  box-shadow: inset 0 0 0 1px rgba(8, 219, 45, 0.16);
}

.crew-card.is-offboat {
  opacity: 0.56;
}

.crew-toggle {
  display: grid;
  place-items: center;
  min-height: 50px;
}

.crew-toggle input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.crew-toggle span {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(8, 167, 255, 0.42);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}

.crew-toggle input:checked + span {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 38%, rgba(8, 219, 45, 0.2) 41% 100%);
  box-shadow: 0 0 18px rgba(8, 219, 45, 0.28);
}

.crew-avatar {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(8, 167, 255, 0.32);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #f7fbff;
  font-size: 15px;
  font-weight: 950;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.25), transparent 0 12px),
    linear-gradient(135deg, rgba(8, 167, 255, 0.45), rgba(8, 219, 45, 0.14)),
    #061323;
}

.crew-card-main {
  min-width: 0;
}

.crew-name-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.crew-name-line input {
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f7fbff;
  font-size: 18px;
  font-weight: 950;
  text-transform: uppercase;
}

.crew-name-line b {
  padding: 4px 7px;
  border: 1px solid rgba(8, 167, 255, 0.28);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
  white-space: nowrap;
}

.crew-card.is-rider .crew-name-line b {
  border-color: rgba(8, 219, 45, 0.42);
  color: var(--accent);
}

.crew-card-controls {
  display: grid;
  grid-template-columns: 0.76fr 1fr;
  gap: 7px;
}

.crew-card-controls label {
  min-width: 0;
}

.crew-card-controls label span {
  margin-bottom: 3px;
  font-size: 9px;
}

.crew-card-controls select,
.crew-card-controls input {
  min-height: 36px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 850;
}

.crew-card-controls .wide-control {
  grid-column: 1 / -1;
}

.remove-crew {
  width: 32px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.manifest-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.ballast-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 14px;
  background: var(--line);
}

.ballast-map div {
  background: var(--panel);
  padding: 10px;
}

.ballast-map strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.recommendation small,
.next-move small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 58px;
  border-radius: 999px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  transition: transform 140ms var(--ease), opacity 140ms var(--ease);
}

.primary-action {
  border: 0;
  margin-top: 16px;
  background: var(--accent);
  color: #071210;
}

.secondary-action {
  border: 1px solid var(--line);
  margin-top: 10px;
  background: transparent;
  color: var(--text);
}

.session-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.session-tile {
  min-height: 88px;
  padding: 10px;
}

.session-tile strong {
  display: block;
  margin-top: 6px;
  color: #f7fbff;
  font-size: 21px;
  line-height: 1;
  text-transform: uppercase;
}

.session-tile strong b,
.session-tile strong i,
.session-tile small b,
.session-tile small i {
  color: var(--accent-2);
  font-style: normal;
}

.session-tile small {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.score-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(118px, 0.66fr);
  overflow: hidden;
}

.score-stage {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 230px;
  border-right: 1px solid var(--line);
  padding: 8px 0 0;
}

.score-ring {
  width: min(50vw, 205px);
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  position: relative;
  display: grid;
  place-items: center;
}

.score-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 8;
}

.ring-track {
  stroke: rgba(237, 245, 237, 0.1);
}

.ring-value {
  stroke: url("#scoreGradient");
  stroke-dasharray: 364;
  stroke-dashoffset: 33;
  transition: stroke-dashoffset 260ms var(--ease);
}

.score-ring span {
  font-size: clamp(58px, 17vw, 82px);
  font-weight: 950;
  line-height: 0.88;
  font-variant-numeric: tabular-nums;
  color: #f7fbff;
}

.score-ring small {
  position: absolute;
  bottom: 23%;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.score-flags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0 10px 10px;
}

.score-flags span {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.score-flags strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
}

.metric-stack {
  display: grid;
  align-content: stretch;
}

.metric-row {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  text-align: left;
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  display: block;
  min-width: 0;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.02;
  text-transform: uppercase;
}

.metric-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.metric-row b {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--panel) 58%, transparent 60%),
    conic-gradient(var(--accent) var(--score), rgba(255, 255, 255, 0.12) 0);
  color: var(--text);
  font-size: 11px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.diagnosis-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 104px;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  padding: 10px;
}

.diagnosis-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: radial-gradient(circle, rgba(8, 167, 255, 0.32), rgba(8, 167, 255, 0.04) 68%);
  border: 1px solid rgba(8, 167, 255, 0.28);
}

.diagnosis-card strong {
  display: block;
  color: #f7fbff;
  font-size: 17px;
  line-height: 1.05;
}

.diagnosis-card p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
}

.video-thumb {
  min-height: 64px;
  border: 1px solid rgba(8, 167, 255, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 60% 45%, rgba(255, 255, 255, 0.36), transparent 0 18px, transparent 19px),
    linear-gradient(135deg, rgba(8, 167, 255, 0.35), rgba(8, 219, 45, 0.14)),
    #081727;
  color: #fff;
  display: grid;
  place-items: center;
}

.video-thumb svg {
  width: 38px;
  height: 38px;
  fill: rgba(255, 255, 255, 0.16);
}

.next-move {
  margin-top: 8px;
  padding: 12px;
  border-color: rgba(8, 219, 45, 0.32);
}

.next-move strong {
  display: block;
  color: #f7fbff;
  font-size: 23px;
  line-height: 1.05;
}

.trim-change {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 4px;
  font-size: 27px;
  font-weight: 950;
}

.trim-change b:last-child {
  color: var(--accent);
}

.trim-change i {
  width: 40px;
  height: 2px;
  background: var(--accent);
  position: relative;
}

.trim-change i::after {
  content: "";
  position: absolute;
  right: 0;
  top: -5px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.run-telemetry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 12px -12px -12px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.run-telemetry div {
  min-width: 0;
  padding: 6px 7px;
  background: color-mix(in srgb, var(--panel) 92%, #000);
}

.run-telemetry span {
  margin: 0 0 3px;
  font-size: 9px;
}

.run-telemetry strong {
  font-size: 10px;
  line-height: 1.1;
  color: var(--accent-2);
  text-transform: uppercase;
}

.run-telemetry strong b {
  color: var(--text);
}

.quick-log {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
}

.video-capture {
  margin-top: 14px;
  padding: 14px;
}

.video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.video-head strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

#wave-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(99, 193, 139, 0.13), rgba(136, 215, 208, 0.05)),
    #06100e;
  object-fit: cover;
}

.video-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.small-pill {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.small-pill:disabled {
  opacity: 0.42;
}

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

.detail-score {
  text-align: center;
  margin: 18px 0 20px;
}

.detail-score strong {
  display: block;
  font-size: 86px;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.detail-score span {
  color: var(--accent-2);
  font-weight: 900;
  text-transform: uppercase;
}

.metric-rings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
}

.mini-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) var(--score), rgba(237, 245, 237, 0.11) 0);
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.mini-ring::before {
  content: "";
  position: absolute;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.boat-iq {
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
}

.boat-iq strong {
  display: block;
  font-size: 36px;
  line-height: 1;
}

.best-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 14px 0;
  background: var(--line);
}

.best-grid div {
  background: var(--bg);
  padding: 14px 0;
}

.best-grid strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.learned {
  padding: 16px;
  margin-bottom: 14px;
}

.learned p {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 850;
}

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

.history-row {
  width: 100%;
  padding: 14px;
  text-align: left;
  color: var(--text);
}

.history-row strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.history-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: max(6px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 408px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dock-item {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  transition: background 180ms var(--ease), color 180ms var(--ease), transform 140ms var(--ease);
}

.dock-item svg {
  width: 19px;
  height: 19px;
}

.dock-item span {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dock-item.is-active {
  background: rgba(8, 167, 255, 0.16);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(8, 167, 255, 0.28);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: start center;
  }

  .shell {
    border-inline: 1px solid var(--line);
  }
}
