/* ============================================================
   Rolling Blockstamps — Simple Proof design tokens
   Hand-ported from ./example/Rolling Timestamps UI/_ds/.../tokens/*.css
   (navy #001A72 primary, orange #F68D2E accent, IBM Plex Sans/Mono).
   Plain CSS custom properties only — no dependency on the mockup's
   own JS runtime or component bundle.
   ============================================================ */

/* Loaded from Google Fonts; the font-family stacks below fall back to
   system fonts if this fails to load (e.g. no internet on the LAN). */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* --- Navy (primary) --- */
  --color-navy-950: #000b2e;
  --color-navy-900: #001142;
  --color-navy-800: #001a72;
  --color-navy-700: #122c86;
  --color-navy-600: #2a459b;
  --color-navy-500: #4760b0;
  --color-navy-400: #7286c7;
  --color-navy-300: #a0aedb;
  --color-navy-200: #cad3ec;
  --color-navy-100: #e5eaf6;
  --color-navy-50: #f2f5fb;

  /* --- Orange (accent) --- */
  --color-orange-700: #c96a12;
  --color-orange-600: #e07b1e;
  --color-orange-500: #f68d2e;
  --color-orange-100: #feeedd;

  /* --- Neutrals --- */
  --color-gray-900: #1a1f2e;
  --color-gray-600: #5c6478;
  --color-gray-400: #a1a8ba;
  --color-gray-300: #c7ccd8;
  --color-gray-200: #e2e5ec;
  --color-gray-100: #f0f2f6;
  --color-gray-50: #f7f8fb;
  --color-white: #ffffff;

  /* --- Semantic: confirmed (green) / tampered (red) --- */
  --color-green-700: #0f6b47;
  --color-green-600: #15805a;
  --color-green-500: #1e9e6a;
  --color-green-100: #ddf3e9;
  --color-red-700: #a82a24;
  --color-red-600: #c8362f;
  --color-red-500: #e04438;
  --color-red-100: #fbe3e1;
  --status-confirmed: var(--color-green-500);
  --status-confirmed-bg: var(--color-green-100);
  --status-tampered: var(--color-red-500);
  --status-tampered-bg: var(--color-red-100);

  /* --- Semantic aliases --- */
  --text-primary: var(--color-navy-900);
  --text-body: var(--color-gray-900);
  --text-muted: var(--color-gray-600);
  --text-link: var(--color-navy-700);
  --surface-page: var(--color-gray-50);
  --surface-card: var(--color-white);
  --border-subtle: var(--color-gray-200);
  --border-default: var(--color-gray-300);

  /* --- Type --- */
  --font-sans:
    'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:
    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --tracking-caps: 0.08em;

  /* --- Spacing & radius (4px base grid) --- */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --container-xl: 1280px;

  /* --- Shadows (navy-tinted, restrained) --- */
  --shadow-md:
    0 4px 12px rgba(0, 26, 114, 0.08), 0 2px 4px rgba(0, 26, 114, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: var(--text-link);
  text-decoration: none;
}
a:hover {
  color: var(--color-navy-900);
  text-decoration: underline;
}

code,
.mono {
  font-family: var(--font-mono);
}

/* ---- Layout shell ---- */

.container {
  max-width: var(--container-xl);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-8);
  box-sizing: border-box;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--color-navy-800);
  border-bottom: 1px solid var(--color-navy-900);
}

.navbar .container {
  padding-top: 14px;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.navbar-logo-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.navbar-logo {
  flex-shrink: 0;
  display: block;
}

.navbar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  white-space: nowrap;
}
.navbar-brand strong {
  font-weight: 700;
  font-size: 17px;
  color: var(--color-white);
  letter-spacing: -0.01em;
}
.navbar-brand span {
  font-size: 11px;
  color: var(--color-navy-200);
}

.navbar-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.18);
}

.navbar-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-navy-200);
}

.navbar select {
  font: 500 14px var(--font-sans);
  color: var(--color-white);
  padding: 8px 36px 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  appearance: none;
  min-width: 180px;
  cursor: pointer;
}
.navbar select option {
  color: var(--color-navy-900);
}

.navbar-meta {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-navy-100);
  white-space: nowrap;
}
.navbar-meta .sep {
  color: rgba(255, 255, 255, 0.3);
}

main.container {
  flex: 1;
  padding-top: var(--space-8);
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

footer {
  background: var(--color-navy-800);
  color: var(--color-navy-200);
}
footer .container {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  font-size: 13px;
}
.footer-logo {
  flex-shrink: 0;
  display: block;
}
footer a {
  color: var(--color-white);
}
footer a:hover {
  color: var(--color-orange-500);
}
footer .sep {
  color: rgba(255, 255, 255, 0.3);
}
footer .node {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---- Shared primitives (used by later sections) ---- */

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-orange-600);
}

.btn {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--color-white);
  color: var(--color-navy-800);
  font: 500 13px var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover {
  background: var(--color-navy-50);
}
.btn-primary {
  background: var(--color-navy-800);
  border-color: var(--color-navy-800);
  color: var(--color-white);
}
.btn-primary:hover {
  background: var(--color-navy-900);
  /* .btn-primary is sometimes an <a> (e.g. the "Download video" link); the
     global a:hover rule sets a dark navy text color that beats this rule's
     plain (non-hover) `color: white` by specificity, making the label
     unreadable against this same dark hover background. Repeat it here,
     explicitly, in a selector that outranks a:hover. */
  color: var(--color-white);
}
.btn.active {
  background: var(--color-navy-800);
  border-color: var(--color-navy-800);
  color: var(--color-white);
}
.icon-btn {
  width: 36px;
  padding: 0;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.btn-link {
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-link);
  font: 500 13px var(--font-sans);
  cursor: pointer;
}
.btn-link:hover {
  background: var(--color-navy-50);
}
.pill {
  height: auto;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  font-size: 12.5px;
}

/* ---- SegmentGrid (video history filmstrip) ---- */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.section-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.section-title h2 {
  font-size: 18px;
  white-space: nowrap;
}
.section-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.section-actions {
  display: flex;
  gap: var(--space-2);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-top: var(--space-2);
  background: var(--color-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.date-filter[hidden] {
  display: none;
}
.date-filter label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.date-filter input {
  font: 500 13px var(--font-mono);
  color: var(--text-primary);
  padding: 7px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--color-white);
}
.filter-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filmstrip {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 20px 6px 10px;
}

.seg-tile {
  flex: none;
  width: 208px;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-sans);
}
.seg-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--color-navy-100);
  position: relative;
  overflow: hidden;
  box-shadow: none;
  transition: box-shadow 200ms;
}
.seg-tile.selected .seg-thumb {
  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--color-orange-500);
}
.seg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.seg-thumb-live {
  background: var(--color-navy-800);
  display: grid;
  place-items: center;
}
.seg-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-navy-900);
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.seg-thumb-live .seg-duration {
  color: #fff;
  background: rgba(0, 11, 46, 0.55);
}
.live-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-lg);
  background: rgba(0, 11, 46, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
}
.live-flag .dot,
.seg-tile-live .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-orange-500);
}
.seg-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
}
.seg-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.seg-range {
  font-size: 12px;
  color: var(--text-muted);
}
.seg-empty {
  flex: none;
  width: 260px;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.seg-more {
  flex: none;
  align-self: flex-start;
  width: 140px;
  height: 117px; /* thumbnail height of a 208px tile */
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-navy-800);
  font: 500 13px var(--font-sans);
  cursor: pointer;
}
.seg-more:hover {
  background: var(--color-navy-50);
}
.seg-more:disabled {
  color: var(--text-muted);
  cursor: default;
}

/* ---- VideoPlayer ---- */

.video-player-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  align-items: stretch;
}

.video-frame-wrap {
  flex: 1 1 600px;
  min-width: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-navy-950);
  box-shadow: var(--shadow-md);
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--color-navy-900);
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--color-navy-900);
}
.video-frame video[hidden] {
  display: none;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-navy-300);
  font-size: 13px;
  text-align: center;
  padding: var(--space-4);
}
.video-placeholder[hidden] {
  display: none;
}

.video-overlay-top {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mode-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
}
.mode-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.mode-chip.live-chip {
  background: rgba(0, 11, 46, 0.55);
  color: #fff;
}
.mode-chip.live-chip .dot {
  background: var(--color-orange-500);
  box-shadow: 0 0 0 3px rgba(246, 141, 46, 0.3);
}
.mode-chip.playback-chip {
  background: rgba(246, 141, 46, 0.75);
  color: #fff;
}

.video-clock {
  white-space: nowrap;
  font-size: 12.5px;
  color: #fff;
  background: rgba(0, 11, 46, 0.6);
  padding: 6px 10px;
  border-radius: 8px;
}

.hashing-indicator {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 11, 46, 0.6);
  color: #fff;
  font-size: 12px;
}
.hashing-indicator[hidden] {
  display: none;
}

.video-meta {
  flex: 1 1 340px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.video-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.video-meta-header h3 {
  font-size: 16px;
}
.meta-list {
  margin: 0;
  padding: 8px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.meta-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-gray-100);
  align-items: baseline;
}
.meta-row dt {
  font-size: 12.5px;
  color: var(--text-muted);
}
.meta-row dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.privacy-note {
  margin: 4px 20px 20px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-navy-50);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-navy-800);
}
.privacy-note[hidden] {
  display: none;
}

.back-to-live-btn {
  height: auto;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 11, 46, 0.6);
  color: #fff;
}
.back-to-live-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.back-to-live-btn .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-orange-500);
}
.back-to-live-btn[hidden] {
  display: none;
}

.meta-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 20px 20px;
}
.meta-actions[hidden] {
  display: none;
}
.meta-actions .btn {
  text-decoration: none;
}

/* ---- FrameIntegrity: timeline ---- */

.fi-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.fi-title h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-navy-800);
}

.fi-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.verify-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.verify-action-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.verify-caption {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.verify-control .btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.verify-result {
  font: 500 13px var(--font-sans);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

.verify-result[hidden] {
  display: none;
}

.verify-confirmed {
  color: var(--color-green-700);
  background: var(--color-green-100);
}

.verify-tampered {
  color: var(--color-red-700);
  background: var(--color-red-100);
}

.verify-error {
  color: var(--text-muted);
  background: var(--surface-sunken, var(--color-gray-100));
}

.integrity-summary {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.timeline-track {
  position: relative;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--color-gray-100);
  border: 1px solid var(--color-navy-200);
  overflow: hidden;
}

.timeline-recorded {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--color-navy-100);
  transition: width 320ms;
}

.timeline-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  transform: translateX(-50%);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  justify-content: center;
}
.timeline-marker:hover {
  background: rgba(0, 26, 114, 0.08);
}
.timeline-marker .bar {
  width: 2px;
  height: 100%;
  background: var(--color-orange-500);
}

.timeline-verified .timeline-marker .bar {
  background: var(--color-green-500);
}

.timeline-playhead {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 0;
  width: 0;
  border-left: 2px dashed var(--color-navy-900);
  pointer-events: none;
  z-index: 1;
}
.timeline-playhead[hidden] {
  display: none;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.stamps-card {
  overflow: hidden;
}

.stamps-title {
  margin: var(--space-3) 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-navy-800);
}

.stamps-scroll {
  overflow-x: auto;
}

.stamps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stamps-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: #f7f8fb;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.stamps-table td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: #2c3242;
  white-space: nowrap;
}

.stamps-table th:last-child,
.stamps-table td:last-child {
  text-align: center;
}

.stamp-row {
  cursor: pointer;
}

.stamp-row:hover {
  background: var(--color-navy-50);
}

.stamp-row.flash {
  background: var(--color-orange-100);
  transition: background 0.2s ease;
}

.attested-link {
  color: var(--text-link);
  text-decoration: none;
}

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

.row-download {
  display: inline-flex;
  justify-content: center;
  color: var(--color-navy-700);
  text-decoration: none;
}

.row-download:hover {
  color: var(--color-orange-600);
}

.row-download-disabled {
  display: inline-flex;
  justify-content: center;
  color: var(--color-navy-300);
  cursor: default;
}

.stamps-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
}

.stamps-pager {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stamps-pager button {
  height: 30px;
  padding: 0 var(--space-3);
}

.stamps-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---- Mobile ----
   Same markup as desktop. Below 720px (MOBILE_QUERY in app.js) the video
   moves to the top and the three sections become tabs under it. */

.mobile-tabs,
.timeline-hint {
  display: none;
}

@media (max-width: 720px) {
  /* Navbar: brand + version/uptime on one row, full-width camera picker below */
  .navbar .container {
    padding: 18px 16px;
    gap: 14px 10px;
  }
  .navbar-divider,
  .navbar-label,
  .navbar-meta .sep {
    display: none;
  }
  .navbar-logo {
    width: 26px;
    height: 26px;
  }
  .navbar-brand {
    line-height: 1.15;
  }
  .navbar-brand strong {
    font-size: 16px;
  }
  .navbar-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    font-size: 11px;
    line-height: 1.35;
    color: var(--color-navy-200);
  }
  .navbar label {
    order: 3;
    width: 100%;
  }
  .navbar select {
    width: 100%;
    min-width: 0;
    height: 44px;
    font-size: 15px;
    padding: 0 40px 0 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }

  /* Layout: video first, then tabs, then the active panel */
  main.container {
    padding: 0 0 32px;
    gap: 0;
  }
  #video-player,
  .video-player-row {
    display: contents;
  }
  .video-frame-wrap {
    order: 1;
    flex: none;
    border-radius: 0;
    box-shadow: none;
  }
  .mobile-tabs {
    order: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--color-white);
    border-bottom: 1px solid var(--border-subtle);
  }
  .mobile-tabs button {
    height: 48px;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: 500 14px var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-tabs button[aria-selected='true'] {
    color: var(--color-navy-800);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--color-orange-500);
  }
  [data-panel] {
    order: 3;
    margin: 16px 16px 0;
  }
  main[data-tab='info'] [data-panel]:not([data-panel='info']),
  main[data-tab='history'] [data-panel]:not([data-panel='history']),
  main[data-tab='integrity'] [data-panel]:not([data-panel='integrity']) {
    display: none;
  }

  /* Video player */
  .video-overlay-top {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .mode-chip {
    padding: 4px 10px;
    gap: 6px;
    font-size: 11px;
  }
  .mode-chip .dot {
    width: 7px;
    height: 7px;
  }
  .video-clock {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
  }
  .hashing-indicator {
    left: 10px;
    bottom: 10px;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
  }
  /* Compact so it covers less of the small video */
  .back-to-live-btn {
    height: 32px;
    padding: 0 10px;
    gap: 6px;
    font-size: 12.5px;
  }

  /* Live Stream tab: stream / recording info */
  .video-meta {
    flex: none;
  }
  .video-meta-header {
    padding: 14px 16px;
  }
  .meta-list {
    padding: 4px 16px 8px;
  }
  .meta-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
  }
  .meta-row dt {
    flex: none;
    font-size: 13px;
  }
  .meta-row dd {
    min-width: 0;
    text-align: right;
    font-size: 14px;
  }
  .meta-row dd.mono {
    font-size: 12.5px;
  }
  .privacy-note {
    margin: 4px 16px 16px;
  }
  .meta-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 8px 16px 16px;
  }
  .meta-actions .btn {
    height: 44px;
    justify-content: center;
    font-size: 14px;
  }

  /* Video History tab: vertical list instead of the filmstrip */
  .section-header {
    align-items: center;
    flex-wrap: nowrap;
  }
  .section-title {
    flex: 1 1 0;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    min-width: 0;
  }
  .section-title h2 {
    font-size: 17px;
  }
  .section-sub {
    font-size: 12.5px;
  }
  #scroll-left,
  #scroll-right {
    display: none;
  }
  #filter-toggle {
    flex: none;
    height: 44px;
    padding: 0 14px;
    font-size: 14px;
  }
  .date-filter {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 12px;
  }
  .date-filter label {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    font-size: 11px;
  }
  .date-filter input {
    width: 100%;
    height: 44px;
    font-size: 14px;
  }
  .filter-presets {
    order: -1;
    gap: 8px;
  }
  .filter-presets .btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
  }
  .filter-count {
    margin-left: 0;
  }
  /* Own scroll so "Show more" doesn't stretch the page: up to ~10 rows, but
     never taller than 60% of the screen (a scroll area taller than the
     viewport traps the finger between list and page). */
  .filmstrip {
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-top: 12px;
    max-height: min(840px, 60vh);
    max-height: min(840px, 60svh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--color-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
  }
  .seg-tile {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-gray-100);
  }
  .seg-tile:last-child {
    border-bottom: none;
  }
  .seg-tile.selected {
    background: var(--color-navy-50);
    box-shadow: inset 3px 0 0 var(--color-orange-500);
  }
  .seg-tile.selected .seg-thumb {
    box-shadow: none;
  }
  .seg-thumb {
    flex: none;
    width: 112px;
  }
  .seg-meta {
    gap: 3px;
    min-width: 0;
  }
  .seg-date {
    font-size: 14px;
    font-weight: 700;
  }
  .seg-range {
    font-size: 13px;
    color: var(--text-body);
  }
  .live-flag {
    top: 5px;
    left: 5px;
    gap: 4px;
    padding: 1px 6px;
    font-size: 9.5px;
  }
  .seg-duration {
    bottom: 5px;
    right: 5px;
    padding: 1px 5px;
    font-size: 10.5px;
  }
  .seg-empty {
    width: auto;
    aspect-ratio: auto;
    border: none;
    padding: 24px 16px;
  }
  .seg-more {
    align-self: stretch;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 0;
    font-size: 14px;
  }

  /* Frame Integrity tab */
  .fi-title {
    gap: 8px;
  }
  .fi-title-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
  }
  .fi-title-row > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }
  .fi-title h2 {
    font-size: 24px;
  }
  /* Check only works on closed segments */
  .fi-live .verify-control {
    display: none;
  }
  /* Flatten the control so the button sits beside the title and the result
     gets its own full-width row below them */
  .verify-control,
  .verify-action-row {
    display: contents;
  }
  .verify-result {
    order: 1;
    flex-basis: 100%;
    padding: 10px 12px;
  }
  .verify-control .btn {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
  }
  .verify-caption {
    display: none;
  }
  .integrity-summary {
    font-size: 13.5px;
  }
  .timeline-track {
    height: 64px;
    cursor: pointer;
  }
  .timeline-labels {
    font-size: 11px;
  }
  .timeline-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
  }
  .stamps-title {
    margin: 20px 0 10px;
  }

  /* Blockstamps: each table row becomes a card */
  .stamps-scroll {
    overflow-x: visible;
  }
  .stamps-table thead {
    display: none;
  }
  .stamps-table,
  .stamps-table tbody {
    display: block;
  }
  .stamps-table tr.stamp-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 44px;
    grid-template-areas:
      'idx time dl'
      'mid mid dl'
      'cal cal dl'
      'elapsed delta dl';
    column-gap: 8px;
    row-gap: 5px;
    align-items: baseline;
    padding: 12px 8px 12px 16px;
    border-bottom: 1px solid var(--color-gray-100);
  }
  .stamps-table td {
    display: block;
    padding: 0;
    border: none;
    white-space: normal;
  }
  .stamps-table td.st-idx {
    grid-area: idx;
    color: var(--text-muted);
  }
  .st-idx::before {
    content: '#';
  }
  .stamps-table td.st-time {
    grid-area: time;
    white-space: nowrap;
    font-weight: 700;
    color: var(--text-primary);
  }
  .stamps-table td.st-elapsed {
    grid-area: elapsed;
    font-size: 12px;
    color: var(--text-muted);
  }
  .stamps-table td.st-mid {
    grid-area: mid;
    font-size: 12px;
    word-break: break-all;
  }
  .stamps-table td.st-cal {
    grid-area: cal;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .st-cal .attested-link {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-orange-100);
    color: var(--color-orange-700);
    font-size: 12px;
    font-weight: 500;
    overflow-wrap: anywhere;
  }
  .attested-sep {
    display: none;
  }
  .stamps-table td.st-delta {
    grid-area: delta;
    font-size: 12px;
    color: var(--text-muted);
  }
  .stamps-table td.st-dl {
    grid-area: dl;
    align-self: center;
  }
  .row-download,
  .row-download-disabled {
    width: 44px;
    height: 44px;
    align-items: center;
  }
  .stamps-footer {
    flex-direction: column;
    gap: 10px;
    padding: 10px 16px;
  }
  .stamps-pager {
    width: 100%;
    justify-content: space-between;
  }
  .stamps-pager button {
    height: 44px;
    padding: 0 16px;
  }

  footer .container {
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    font-size: 12.5px;
    text-align: center;
  }
  .footer-logo {
    height: 36px;
    width: auto;
  }
  footer .node {
    margin-left: 0;
  }
  /* Nothing fills it yet; with column-reverse it would sit first and add a gap */
  footer .node:empty {
    display: none;
  }
}
