.events-page {
  min-height: 100vh;
  --ink: #241f33;
  --muted: #726985;
  --line: #ddd4ec;
  --accent-2: #7a5ccf;
  --shadow: 0 10px 28px rgba(55, 38, 86, 0.14);
  background: #f6f2fb;
}

.events-page,
.events-page body {
  height: auto;
}

.events-shell {
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.events-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.events-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.events-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.events-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.events-nav-link {
  min-height: 30px;
  padding: 0 12px;
}

.events-intro {
  margin-bottom: 28px;
  padding: 16px 20px;
  background: rgba(122, 92, 207, 0.06);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.events-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .events-intro p {
    font-size: 13px;
    line-height: 1.5;
  }
}

.events-intro p + p {
  margin-top: 8px;
}

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

.events-host-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 24px 28px;
  border: 1.5px solid rgba(122, 92, 207, 0.22);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(122, 92, 207, 0.07) 0%, rgba(255, 250, 253, 0.6) 100%);
}

.events-host-cta-body {
  min-width: 0;
}

.events-host-cta-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.events-host-cta-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.events-host-cta-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 20px;
  font-size: 14px;
  white-space: nowrap;
}

.garmin-example-note {
  margin: 0 0 8px;
  color: #6a587f;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .events-host-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .events-host-cta-btn {
    align-self: stretch;
    justify-content: center;
    text-align: center;
  }
}

.event-group {
  display: grid;
  gap: 12px;
}

.event-group + .event-group {
  margin-top: 10px;
}

.event-group-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.2;
}

.terms-layout {
  display: grid;
  gap: 32px;
  margin-bottom: 48px;
}

.terms-section {
  display: grid;
  gap: 10px;
}

.terms-section-label {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(122, 92, 207, 0.1);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  width: fit-content;
}

.terms-section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.privacy-content ul {
  margin: 0;
  padding-left: 1.4em;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.privacy-content ul li {
  margin-bottom: 2px;
}

.terms-updated {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-content {
  display: grid;
  gap: 10px;
  max-width: 760px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafd;
  box-shadow: 0 6px 18px rgba(55, 38, 86, 0.08);
}

.privacy-content h2 {
  margin: 8px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.privacy-content h2:first-child {
  margin-top: 0;
}

.privacy-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.battery-page {
  background: #f6f2fb;
}

.battery-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.battery-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.battery-header h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.05;
}

.battery-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.battery-back {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.battery-controls,
.battery-summary,
.battery-plot-section,
.battery-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 253, 0.92);
  box-shadow: 0 6px 18px rgba(55, 38, 86, 0.08);
}

.battery-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(130px, 170px));
  gap: 12px;
  padding: 12px;
}

.battery-controls label {
  display: grid;
  gap: 5px;
}

.battery-checkbox-label {
  align-content: end;
  grid-template-columns: auto 1fr;
  min-height: 56px;
}

.battery-controls span,
.battery-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.battery-controls select,
.battery-controls input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.battery-controls select {
  padding: 0 10px;
}

.battery-controls input {
  padding: 0 8px;
}

.battery-controls .battery-checkbox-label input {
  align-self: center;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.battery-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
}

.battery-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  background: #fff;
}

.battery-summary strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battery-plot-section {
  position: relative;
  margin-top: 12px;
  padding: 14px;
}

.battery-chart-wrap {
  position: relative;
}

.battery-refresh-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 10;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  opacity: 0.85;
}

.battery-refresh-btn:hover {
  opacity: 1;
}

.battery-chart {
  display: block;
  width: 100%;
  min-height: 320px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.battery-chart:active {
  cursor: grabbing;
}

.battery-grid line {
  stroke: rgba(114, 105, 133, 0.2);
  stroke-width: 1;
}

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

.battery-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.battery-dot {
  stroke: #fff;
  stroke-width: 1.5;
}

.battery-mode-marker {
  opacity: 0.85;
}

.battery-rate-label {
  font: 700 10px system-ui, sans-serif;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.battery-mode-label {
  font: 700 10px system-ui, sans-serif;
}

.battery-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 24px;
  padding-top: 8px;
}

.battery-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #342b42;
  font-size: 12px;
  font-weight: 700;
}

.battery-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.battery-empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.battery-details {
  margin-top: 12px;
  overflow: hidden;
}

.battery-table-wrap {
  overflow: auto;
  background: #fff;
}

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

.battery-table th,
.battery-table td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(221, 212, 236, 0.82);
  text-align: left;
  white-space: nowrap;
}

.battery-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .battery-header {
    align-items: start;
    flex-direction: column;
  }

  .battery-controls,
  .battery-summary {
    grid-template-columns: 1fr;
  }
}

.event-item {
  display: block;
  padding: 16px;
  border: 1.5px solid rgba(122, 92, 207, 0.25);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(55, 38, 86, 0.11);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.15s;
}

.event-item:hover {
  border-color: rgba(122, 92, 207, 0.3);
  box-shadow: 0 10px 28px rgba(55, 38, 86, 0.13);
  transform: translateY(-2px);
}

.event-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.event-main h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.event-meta,
.event-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.event-actions code {
  min-width: 0;
  max-width: 100%;
  padding: 7px 9px;
  overflow-wrap: anywhere;
  border: 1px solid #e5ddef;
  border-radius: 6px;
  color: #4a405d;
  background: #fbf8ff;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.join-page-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.join-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.join-page-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.join-page-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.join-page-header .event-meta {
  min-height: 18px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.join-event-description {
  margin: 8px 0 0;
  color: #4a405d;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.join-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-choice {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffafd;
  box-shadow: 0 4px 14px rgba(55, 38, 86, 0.07);
}

.join-guide {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffafd;
  box-shadow: 0 4px 14px rgba(55, 38, 86, 0.07);
}

.join-form {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.join-guide h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-2);
  line-height: 1.2;
}

.join-guide ol {
  display: grid;
  gap: 18px;
  margin: 0;
  padding-left: 1.8em;
  color: #4a405d;
  font-size: 14px;
  line-height: 1.6;
}

.join-guide ol > li {
  padding-left: 4px;
}

.join-guide ol > li::marker {
  color: var(--accent-2);
  font-weight: 800;
  font-size: 16px;
}

.settings-output-item {
  list-style: none;
}

.settings-output-item[hidden] {
  display: none;
}

.install-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.store-badge-link {
  display: inline-block;
  line-height: 0;
}

.store-badge-appstore {
  height: 40px;
  width: auto;
}

.store-badge-googleplay {
  height: 50px;
  width: auto;
}

.owntracks-mode-guide {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.owntracks-help-note {
  margin: 8px 0 0;
  color: #6a587f;
  font-size: 13px;
  line-height: 1.5;
}

.owntracks-help-gallery {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.owntracks-help-figure {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px;
  border: 1px solid #e5ddef;
  border-radius: 8px;
  background: #fbf8ff;
}

.owntracks-help-figure figcaption {
  order: -1;
  margin: 0 0 8px;
  color: #4a405d;
  font-size: 13px;
  line-height: 1.45;
}

.owntracks-help-figure img {
  display: block;
  width: 100%;
  border: 1px solid #e5ddef;
  border-radius: 8px;
  background: #0a0a0c;
}

.owntracks-mode-guide[hidden] {
  display: none;
}

.owntracks-mode-guide h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.mode-screenshot {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid #e5ddef;
  border-radius: 8px;
  background: #0a0a0c;
}

.mode-summary {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid #e5ddef;
  border-radius: 8px;
  color: #4a405d;
  background: #fbf8ff;
  font-size: 13px;
  line-height: 1.45;
}

.mode-summary strong {
  color: var(--accent-2);
}

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

.mode-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5ddef;
  border-radius: 8px;
  background: #fbf8ff;
  color: #4a405d;
  font-size: 12px;
  line-height: 1.35;
}

.mode-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.mode-card span:last-child {
  grid-column: 1 / -1;
}

.mode-icon {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 24px;
  padding: 0 5px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent-2);
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.join-form {
  display: grid;
  justify-items: start;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(122, 92, 207, 0.15);
  border-radius: 8px;
  background: #f8f5ff;
}

.join-form label {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
}

.app-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.app-choice legend {
  grid-column: 1 / -1;
  padding: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-choice label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid rgba(122, 92, 207, 0.28);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.app-choice label:first-of-type {
  border-radius: 8px 0 0 8px;
}

.app-choice label:last-of-type {
  border-radius: 0 8px 8px 0;
  border-left: 0;
}

.app-choice label:hover {
  background: #fff;
  color: var(--accent-2);
  border-color: rgba(122, 92, 207, 0.5);
}

.app-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.app-choice label:has(input:checked) {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #fff;
}

.app-choice label:has(input:focus-visible) {
  outline: 3px solid rgba(122, 92, 207, 0.4);
  outline-offset: 2px;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}

.name-row input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1.5px solid #c8bedb;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: 15px/1.2 system-ui, sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.name-row input:focus {
  border-color: var(--accent-2);
  outline: none;
  box-shadow: 0 0 0 3px rgba(122, 92, 207, 0.18);
}

.consent-label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(122, 92, 207, 0.18);
  border-radius: 7px;
  background: rgba(122, 92, 207, 0.04);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.consent-label input {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
  cursor: pointer;
}

.consent-label a {
  color: var(--accent-2);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-submit {
  justify-self: start;
}

.join-terms-wrap {
  display: grid;
  gap: 8px;
  width: 100%;
}

.join-terms-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.join-terms {
  max-height: 180px;
  overflow-y: scroll;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
  display: grid;
  gap: 5px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.join-terms h3 {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.join-terms h3:first-child {
  margin-top: 0;
}

.join-terms p {
  margin: 0;
}

.join-terms ul {
  margin: 0;
  padding-left: 1.4em;
}

.join-form:not(:has(input[name="location-consent"]:checked)) .settings-submit,
.join-form:not(:has(input[name="terms-consent"]:checked)) .settings-submit {
  opacity: 0.5;
  cursor: not-allowed;
  background: #e8e0f5;
  color: var(--accent-2);
  border-color: transparent;
  pointer-events: none;
}

.join-qr {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 16px;
  border: 1.5px solid rgba(122, 92, 207, 0.3);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(122, 92, 207, 0.1);
}

.join-qr[hidden] {
  display: none;
}

.join-qr img {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.join-qr code {
  display: block;
  width: 100%;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  border: 1px solid #e5ddef;
  border-radius: 6px;
  color: #4a405d;
  background: #fbf8ff;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.url-label {
  display: block;
  justify-self: stretch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.copy-status {
  min-height: 18px;
  margin: 0;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 720px) {
  .events-shell {
    width: min(100vw - 20px, 560px);
    padding: 22px 0 34px;
  }

  .events-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  .events-header-actions {
    justify-content: flex-start;
  }

  .events-header h1 {
    font-size: 22px;
  }

  .event-item {
    padding: 13px;
  }

  .event-main h2 {
    font-size: 19px;
  }

  .event-actions {
    align-items: stretch;
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .join-choice,
  .join-guide,
  .join-form {
    padding: 14px;
  }

  .join-qr img,
  .qr-label {
    display: none;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

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

  .join-qr code {
    min-height: 72px;
    padding: 12px;
    font-size: 13px;
  }
}

/* Wizard */

.wizard-step-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--ink);
}

.wizard-next {
  margin-top: 20px;
  width: 100%;
}

.join-error-inline {
  margin-top: 10px;
  color: #c0392b;
  font-size: 14px;
}

/* Personal page */
.bookmark-gate {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.bookmark-gate h2 {
  margin: 0;
}

.bookmark-gate-message,
.bookmark-platform-help {
  margin: 0;
  color: #4a405d;
  font-size: 14px;
  line-height: 1.6;
}

.bookmark-target-card {
  display: grid;
  gap: 8px;
}

.bookmark-next-btn {
  width: 100%;
}

.p-top-tabs {
  display: flex;
  border-bottom: 2px solid var(--line);
  margin-bottom: 24px;
  gap: 0;
}

.p-top-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.p-top-tab.active,
.p-top-tab[aria-selected="true"] {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.p-top-tab:hover:not(.active) {
  color: var(--ink);
}

.p-top-panel {
  min-height: 120px;
}

.p-placeholder {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.app-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.app-tab {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.app-tab.active,
.app-tab[aria-selected="true"] {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.app-tab:hover:not(.active) {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.garmin-figure {
  margin: 12px 0 0;
}

.garmin-example-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.garmin-example-note {
  margin: 0 0 8px;
  color: #6a587f;
  font-size: 13px;
  line-height: 1.5;
}

.garmin-example-title {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.garmin-figure img {
  display: block;
  max-width: 200px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.garmin-start-btn {
  margin-top: 16px;
}

.garmin-start-status {
  margin-top: 10px;
  font-size: 14px;
}

.garmin-start-ok {
  color: #2e7d32;
}

.garmin-start-err {
  color: #c62828;
}

.garmin-note {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fff8e1;
  border-left: 3px solid #f9a825;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Photo upload (photo_upload behavior) ─────────────────────────── */
.photo-upload-section {
  padding: 12px 0;
}

.photo-upload-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 8px;
}

.photo-select-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  padding: 18px 0 20px;
}

.photo-select-btn {
  width: min(100%, 320px);
  min-height: 148px;
  border: 1px solid #c8bedb;
  border-radius: 8px;
  background: #fff;
  color: var(--accent-2);
  box-shadow: 0 4px 16px rgba(40, 28, 58, 0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  font: inherit;
  font-weight: 800;
}

.photo-select-btn:hover {
  background: #fbf8ff;
  border-color: var(--accent);
}

.photo-select-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.photo-select-label {
  font-size: 1rem;
}

.photo-preview-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
}

.photo-preview-img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  flex: 0 0 auto;
  border: 1px solid var(--line);
}

.photo-selection-summary {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.photo-exif-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 8px;
}

.photo-exif-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.photo-exif-grid {
  margin: 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.photo-exif-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  border-bottom: 1px solid var(--line);
}
.photo-exif-row:last-child { border-bottom: none; }

.photo-exif-key {
  padding: 6px 10px;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface, #faf8fd);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.photo-exif-val {
  padding: 6px 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
}
.photo-exif-ok { color: var(--accent); font-weight: 600; }
.photo-exif-na { color: var(--danger, #d63333); }

.photo-warn {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 4px 0 8px;
  padding: 6px 10px;
  background: #fff8e1;
  border-radius: 4px;
  border-left: 3px solid #e6b800;
}

.photo-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.photo-upload-status {
  margin-top: 8px;
  font-size: 0.82rem;
  padding: 6px 0;
}
.photo-upload-ok { color: var(--accent); }
.photo-upload-err { color: var(--danger, #d63333); }

@media (max-width: 720px) {
  .photo-action-row {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .photo-upload-status {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

#photo-list-panel {
  padding-top: 4px;
}

#photo-back-btn {
  margin-bottom: 12px;
}

.photo-list-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.photo-list-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--line);
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* flyby photo overlay */
.photo-overlay-wrapper {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.photo-overlay-inner {
  pointer-events: auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  /* transform / opacity / transition are set inline by flyby.js */
}

.photo-overlay-name {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(88%, 22rem);
  z-index: 1;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 6px 12px 7px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom-right-radius: 8px;
}

@media (min-width: 768px) {
  .photo-overlay-name {
    font-size: 2.3rem;
    padding: 10px 18px 12px;
  }
}
