:root {
  --brand-dark: #272727;
  --brand-blue: #a4d8ff;
  --brand-blue-soft: #eef8ff;
  --bg: #272727;
  --surface: #ffffff;
  --surface-strong: #f7f9fc;
  --surface-tint: #edf7ff;
  --text: #272727;
  --muted: #627080;
  --border: #d5e2ec;
  --border-strong: #a4d8ff;
  --teal: #a4d8ff;
  --teal-dark: #272727;
  --coral: #272727;
  --amber: #a4d8ff;
  --green: #5fb6e7;
  --ink: #272727;
  --shadow: 0 18px 44px rgba(39, 39, 39, 0.08);
  --shadow-soft: 0 6px 18px rgba(39, 39, 39, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
label.button {
  user-select: none;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}

.app-menu-wrap {
  position: relative;
  z-index: 46;
  flex: 0 0 auto;
}

.menu-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.menu-button:hover,
.menu-button:focus-visible {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(164, 216, 255, 0.32);
  outline: none;
}

.app-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 190px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px;
}

.app-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.app-menu button:hover,
.app-menu button.active {
  background: var(--brand-blue-soft);
}

.about-page {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 248, 255, 0.96));
  box-shadow: var(--shadow-soft);
  padding: 34px;
}

.tool-page {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 248, 255, 0.96));
  box-shadow: var(--shadow-soft);
  padding: 34px;
}

.tool-hero {
  max-width: 760px;
  margin-bottom: 28px;
}

.tool-hero h2 {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1.08;
}

.tool-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

.timing-tool {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: stretch;
}

.timing-product {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(340px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.timing-sequence-card,
.timing-result-card,
.timing-splits-card,
.timing-video-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.timing-sequence-card,
.timing-video-card {
  grid-column: span 1;
}

.timing-video-card,
.timing-splits-card {
  grid-column: 1 / -1;
}

.timing-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.timing-camera-count {
  display: grid;
  min-width: 142px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.timing-card-heading h3 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.connected {
  border-color: rgba(33, 150, 116, 0.34);
  background: rgba(33, 150, 116, 0.1);
  color: #14624c;
}

.timing-display-card.compact {
  border: 1px solid var(--border);
  box-shadow: none;
  margin-bottom: 16px;
  padding: 22px;
}

.timing-phase,
.timing-video-lead,
.timing-camera-sync {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.timing-setup-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.timing-setup-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.timing-setup-grid input {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}

.timing-result-display {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  padding: 22px;
}

.timing-result-display span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timing-result-display strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.timing-split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.timing-video-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.timing-speed-control {
  display: grid;
  grid-template-columns: auto minmax(160px, 260px) 54px;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.timing-speed-control input {
  width: 100%;
  accent-color: var(--brand-blue);
}

.timing-speed-control strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.timing-video-grid {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timing-video-empty {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.timing-camera-card {
  position: relative;
  flex: 0 0 calc((100% / var(--camera-count, 1)) * (var(--visible, 100) / 100));
  min-width: 240px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  margin-left: calc((100% / var(--camera-count, 1)) * (var(--overlap, 0) / -100));
  box-shadow: 0 12px 26px rgba(20, 33, 48, 0.08);
}

.timing-camera-card + .timing-camera-card {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.timing-camera-card video {
  display: block;
  width: calc(100% * 100 / var(--visible, 100));
  aspect-ratio: 16 / 9;
  background: var(--brand-dark);
  object-fit: contain;
}

.timing-camera-placeholder {
  display: grid;
  min-height: 180px;
  aspect-ratio: 16 / 9;
  place-items: center;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.08) 50%, transparent 51%),
    linear-gradient(180deg, #24333a, #344d5c);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 900;
}

.timing-seam-handle {
  position: absolute;
  top: 46px;
  bottom: 132px;
  left: 0;
  z-index: 4;
  width: 14px;
  cursor: ew-resize;
}

.timing-seam-handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
  border-radius: 999px;
  background: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(164, 216, 255, 0.28);
}

.timing-camera-heading,
.timing-camera-actions,
.timing-camera-sync {
  padding: 12px;
}

.timing-camera-heading {
  display: grid;
  gap: 3px;
}

.timing-camera-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timing-camera-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timing-camera-layout {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.timing-camera-layout label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.timing-camera-layout input {
  width: 100%;
}

.timing-display-card,
.timing-side {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.timing-display-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 28px;
}

.timing-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timing-clock {
  font-size: clamp(3rem, 8vw, 6.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.timing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.timing-actions .button {
  min-width: 110px;
}

.timing-side {
  overflow: hidden;
}

.timing-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.timing-metrics div {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.timing-metrics div + div {
  border-left: 1px solid var(--border);
}

.timing-metrics span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.timing-metrics strong {
  font-size: 1.45rem;
}

.timing-table-wrap {
  position: relative;
  min-height: 260px;
  padding: 0;
}

.timing-table {
  width: 100%;
  border-collapse: collapse;
}

.timing-table th,
.timing-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.timing-table th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.timing-empty {
  margin: 28px 16px;
  color: var(--muted);
}

.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.about-eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-hero h2 {
  max-width: 760px;
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  line-height: 1.1;
}

.about-hero p,
.about-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.about-hero p {
  max-width: 680px;
  font-size: 1.08rem;
}

.about-proof {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.about-proof strong {
  display: block;
  margin-bottom: 6px;
  font-size: 2.2rem;
  line-height: 1;
}

.about-proof span {
  color: var(--muted);
  line-height: 1.5;
}

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

.about-grid section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 18px;
}

.about-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.about-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.about-values div {
  display: grid;
  gap: 5px;
  background: #fff;
  padding: 18px;
}

.about-values strong {
  font-size: 1.02rem;
}

.about-values span {
  color: var(--muted);
  line-height: 1.5;
}

.about-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  padding: 22px;
}

.about-cta h3 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.about-cta p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.55;
}

.language-flags {
  position: relative;
  z-index: 45;
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px auto;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 5px;
  border: 1px solid rgba(197, 211, 224, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(20, 33, 48, 0.12);
  backdrop-filter: blur(12px);
}

.flag-button {
  display: inline-flex;
  width: auto;
  height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.language-flag {
  width: 24px;
  height: 14px;
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.flag-button.active {
  border-color: var(--brand-blue);
  background: #fff;
  box-shadow: 0 6px 16px rgba(164, 216, 255, 0.28);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 109px;
  height: 77px;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand-block p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions,
.playback-controls,
.live-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions {
  margin-left: auto;
}

.about-view .top-actions,
.tool-view .top-actions,
.about-view #projectStatus,
.tool-view #projectStatus,
.about-view .brand-block h1 {
  display: none;
}

.language-control {
  display: grid;
  grid-template-columns: auto 132px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-weight: 700;
}

.button:hover,
.icon-button:hover,
.mode-tab:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
.segment-button:focus-visible,
.mode-tab:focus-visible {
  outline: 3px solid rgba(164, 216, 255, 0.55);
  outline-offset: 2px;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

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

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--brand-dark);
  box-shadow: 0 8px 18px rgba(164, 216, 255, 0.34);
}

.button.primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}

.button.accent {
  border-color: rgba(39, 39, 39, 0.22);
  background: var(--brand-blue-soft);
  color: var(--brand-dark);
}

.button.ghost {
  background: transparent;
}

.button.wide {
  width: 100%;
}

.select,
input,
select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.02);
}

input.input-error {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(39, 39, 39, 0.12);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 374px;
  gap: 16px;
  align-items: start;
}

.video-panel,
.control-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.media-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--surface-strong));
}

.time-readout {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.time-readout strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b1220;
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.empty-video-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  color: #fff;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(39, 39, 39, 0.94), rgba(65, 108, 133, 0.86)),
    var(--brand-dark);
}

.empty-video-state strong {
  z-index: 2;
  font-size: 1rem;
  background: rgba(15, 23, 42, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 10px 18px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);
}

.pool-lines {
  position: absolute;
  inset: 9% 0;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  opacity: 0.72;
}

.pool-lines span {
  border-top: 6px dotted rgba(255, 255, 255, 0.8);
}

.guide-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.guide-overlay.has-line,
.guide-overlay.drawing {
  pointer-events: auto;
}

.guide-overlay.drawing {
  cursor: crosshair;
}

.guide-line-visual {
  stroke: var(--brand-blue);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1px rgba(32, 35, 43, 0.72));
  pointer-events: stroke;
  cursor: move;
}

.guide-line-hit {
  stroke: transparent;
  stroke-width: 18px;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: move;
}

.guide-handle {
  stroke: var(--brand-dark);
  stroke-width: 1.4px;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: grab;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95));
}

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

.guide-overlay.no-line .guide-line-hit,
.guide-overlay.no-line .guide-line-visual,
.guide-overlay.no-line .guide-handle,
.guide-draft-point {
  display: none;
}

.guide-overlay.has-draft .guide-draft-point {
  display: block;
}

.guide-draft-point {
  fill: var(--brand-blue);
  stroke: #fff;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.pen-button {
  gap: 8px;
}

.pen-button.active {
  border-color: var(--teal);
  background: var(--brand-blue-soft);
  color: var(--teal-dark);
  font-weight: 700;
}

.race-info-overlay,
.split-overlay {
  position: absolute;
  left: 12px;
  min-width: 148px;
  max-width: min(320px, calc(100% - 24px));
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 3;
}

.race-info-overlay {
  top: 12px;
  display: grid;
  gap: 4px;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.race-info-overlay:empty {
  display: none;
}

.race-info-overlay span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.race-info-overlay strong {
  color: #fff;
}

.split-overlay {
  top: var(--split-overlay-top, 12px);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.split-overlay.visible {
  opacity: 1;
  transform: translateY(0);
}

.split-overlay strong {
  display: block;
  font-size: 1.02rem;
}

.split-overlay span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.video-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  z-index: 4;
}

.scrub-row {
  position: relative;
  padding: 12px 14px;
  background: #fff;
}

.scrubber {
  width: 100%;
  accent-color: var(--teal);
}

.timeline-marks {
  position: relative;
  height: 22px;
  margin-top: 4px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(164, 216, 255, 0.26), rgba(39, 39, 39, 0.08));
  overflow: hidden;
}

.timeline-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--brand-dark);
  border: 0;
  cursor: pointer;
  padding: 0;
}

.timeline-mark span {
  position: absolute;
  top: 2px;
  left: 5px;
  color: var(--text);
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
}

.control-panel {
  overflow: hidden;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--border);
  background: #f0f4f8;
  color: var(--muted);
  cursor: pointer;
}

.mode-tab:last-child {
  border-right: 0;
}

.mode-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--teal);
}

.mode-panel {
  display: none;
  padding: 16px;
}

.mode-panel.active {
  display: block;
}

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

.field-grid label:first-child {
  grid-column: 1 / -1;
}

.field-grid label:nth-child(2) {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.action-stack,
.segment-block,
.stroke-block,
.profile-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.profile-block {
  margin-top: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.analysis-controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(340px, 1.35fr) minmax(260px, 1fr);
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--brand-blue-soft));
}

.analysis-controls .action-stack,
.analysis-controls .segment-block,
.analysis-controls .stroke-block {
  min-width: 0;
  margin-top: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.analysis-controls .action-stack {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.analysis-controls .action-stack #setStartButton {
  grid-column: 1 / -1;
}

.analysis-controls .segment-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.analysis-controls .segment-block #clearMarksButton {
  margin-top: 8px;
}

.analysis-controls .stroke-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analysis-controls .stroke-summary {
  margin-top: 8px;
}

.cloud-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(164, 216, 255, 0.24), rgba(255, 255, 255, 0));
}

.cloud-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cloud-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.cloud-auth-fields,
.cloud-user-fields {
  display: grid;
  gap: 8px;
}

.cloud-user-fields {
  display: none;
}

.cloud-user-fields > span {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

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

.google-button {
  justify-content: center;
  width: 100%;
  background: #fff;
  color: #1f2937;
}

.google-button span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 800;
}

.app-shell {
  position: relative;
}

.auth-locked .topbar,
.auth-locked .language-flags {
  position: relative;
  z-index: 35;
}

.auth-locked .workspace,
.auth-locked .results-panel,
.auth-locked .history-panel {
  pointer-events: none;
  user-select: none;
}

.auth-locked .workspace,
.auth-locked .results-panel,
.auth-locked .history-panel {
  filter: blur(2px);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 132px 20px 40px;
  background: rgba(226, 235, 242, 0.28);
  backdrop-filter: blur(7px);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-card {
  display: grid;
  width: min(430px, 100%);
  gap: 14px;
  padding: 34px 34px 32px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 28px 90px rgba(20, 33, 48, 0.22);
  backdrop-filter: blur(18px);
}

.auth-card [hidden] {
  display: none !important;
}

.auth-card h2 {
  margin: 0;
  color: #050b18;
  font-size: 2rem;
  line-height: 1.08;
}

.auth-card h3 {
  margin: 12px 0 0;
  color: #050b18;
  font-size: 1rem;
}

.auth-status {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-socials {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 2px;
}

.social-button {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #4285f4;
  font-size: 1.18rem;
  font-weight: 800;
  cursor: pointer;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  color: #111827;
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.auth-card input {
  border: 0;
  border-radius: 22px;
  background: #f5f6f8;
  padding: 13px 16px;
}

.auth-primary {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--brand-blue);
  color: var(--brand-dark);
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
}

.auth-primary:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-warning {
  margin: -6px 0 0;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 700;
}

.auth-link,
.auth-switch button {
  border: 0;
  background: transparent;
  color: #244987;
  font-weight: 700;
  cursor: pointer;
}

.auth-link.align-right {
  justify-self: end;
  margin-top: -8px;
}

.auth-switch {
  margin: -2px 0 0;
  text-align: center;
}

.auth-switch button {
  padding: 0;
  color: #0f172a;
}

.profile-pair {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

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

.modal-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(20, 33, 48, 0.28);
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
}

.modal-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.stroke-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.stroke-summary {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, var(--surface-strong));
  color: var(--muted);
  padding: 9px 10px;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.stroke-summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stroke-details {
  display: none;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

.stroke-details.open {
  display: block;
}

.stroke-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

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

.stroke-row-main {
  display: grid;
  gap: 2px;
  font-size: 0.86rem;
}

.stroke-row-main strong {
  font-variant-numeric: tabular-nums;
}

.stroke-row-main span {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.stroke-row-actions {
  display: flex;
  gap: 6px;
}

.stroke-row-actions button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 0 8px;
  font-size: 0.82rem;
}

.stroke-row-actions button:hover {
  border-color: var(--teal);
}

.button.active {
  border-color: var(--teal);
  background: var(--brand-blue-soft);
  color: var(--teal-dark);
  font-weight: 700;
}

.section-title {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.segment-button {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 7px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.segment-button strong {
  font-size: 0.98rem;
}

.segment-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.segment-button.marked {
  border-color: rgba(164, 216, 255, 0.95);
  background: var(--brand-blue-soft);
}

.segment-button.finish {
  border-color: rgba(39, 39, 39, 0.28);
  background: #f7f8fa;
}

.top-actions .button,
.top-actions label.button {
  min-height: 42px;
}

.playback-controls {
  justify-content: flex-end;
}

.playback-controls .select {
  min-width: 220px;
}

.live-clock {
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.live-actions {
  margin-top: 10px;
}

.mini-table {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mini-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

.mini-row strong {
  font-variant-numeric: tabular-nums;
}

.results-panel {
  margin-top: 16px;
  padding: 16px;
}

.history-panel {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 1.12rem;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(108px, 1fr));
  gap: 8px;
}

.summary-metrics div {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, var(--surface-strong));
  padding: 8px 10px;
}

.summary-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.summary-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

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

.history-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) repeat(4, minmax(90px, 1fr));
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  color: var(--text);
  cursor: pointer;
  padding: 10px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.history-item:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 8px 20px rgba(164, 216, 255, 0.22);
}

.history-item:active {
  transform: translateY(1px);
}

.history-empty {
  cursor: default;
}

.history-empty:hover {
  border-color: var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.history-empty:active {
  transform: none;
}

.history-item strong,
.history-item span {
  font-variant-numeric: tabular-nums;
}

.history-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: #eef3f7;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 800;
}

td {
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: #fafcff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.chart-wrap {
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  padding: 10px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 1120px) {
  .workspace,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

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

  .control-panel {
    order: -1;
  }

  .analysis-controls {
    grid-template-columns: 1fr;
  }

  .timing-tool {
    grid-template-columns: 1fr;
  }

  .timing-product {
    grid-template-columns: 1fr;
  }

  .timing-video-card,
  .timing-splits-card {
    grid-column: auto;
  }

  .analysis-controls .segment-grid,
  .analysis-controls .stroke-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .media-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .app-menu {
    position: static;
    margin-top: 8px;
  }

  .top-actions,
  .playback-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button,
  .icon-button,
  label.button,
  .select {
    width: 100%;
  }

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

  .field-grid,
  .segment-grid,
  .analysis-controls .segment-grid,
  .analysis-controls .stroke-actions,
  .analysis-controls .action-stack,
  .profile-pair,
  .about-grid,
  .about-hero,
  .about-values,
  .timing-metrics,
  .summary-metrics,
  .history-item {
    grid-template-columns: 1fr;
  }

  .timing-metrics div + div {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .timing-setup-grid {
    grid-template-columns: 1fr;
  }

  .tool-page,
  .about-page {
    padding: 22px;
  }

  .about-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .live-clock {
    font-size: 1.7rem;
  }
}
