@font-face {
  font-family: "SF Pro Display Local";
  src: url("./Fonts/SF-Pro-Display-Semibold.otf") format("opentype");
  font-style: normal;
  font-weight: 600;
  font-display: block;
}

@font-face {
  font-family: "SF Pro Display Local";
  src: url("./Fonts/SF-Pro-Display-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "SF Pro Text Local";
  src: url("./Fonts/SF-Pro-Text-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "SF Pro Text Local";
  src: url("./Fonts/SF-Pro-Text-Semibold.otf") format("opentype");
  font-style: normal;
  font-weight: 600;
  font-display: block;
}

/* Reset and Core Layout */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #090a0c;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  padding: 32px;
}

/* Sidebar Controls Panel */
.controls {
  background: #181a20;
  border: 1px solid #2c2f38;
  border-radius: 20px;
  padding: 24px;
  height: max-content;
  position: sticky;
  top: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.controls h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: -0.5px;
}

.controls p {
  color: #8e8e93;
  margin: 0 0 24px;
  line-height: 1.5;
  font-size: 14px;
}

.controls label {
  display: block;
  color: #a1a1a6;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.controls input {
  width: 100%;
  background: #0e0f13;
  color: #fff;
  border: 1px solid #383b44;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.controls input:focus {
  border-color: #fc4c02;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.controls button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.controls .primary-button {
  background: #fc4c02;
  color: #fff;
}

.controls .primary-button:hover {
  background: #e24300;
}

.controls .export-button {
  background: #fff;
  color: #111;
}

.controls .export-button:hover {
  background: #e5e5ea;
}

/* Phone Screen Mockup Container */
.phone-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.phone {
  width: 430px;
  height: 932px;
  position: relative;
  background: #121212;
  overflow: hidden;
  border-radius: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 12px #222;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
}

/* Map Container */
#map {
  height: 412px;
  width: 100%;
  background: #252b25;
  position: relative;
}

#mapExportSnapshot {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.route-editor {
  margin: 18px 0 4px;
  padding-top: 4px;
  border-top: 1px solid #2c2f38;
}

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

.controls .place-search button,
.controls .secondary-button,
.controls .route-actions button {
  width: auto;
  margin-top: 0;
  background: #2c2f38;
  color: #fff;
  border: 1px solid #424650;
}

.controls .place-search button {
  padding-inline: 14px;
}

.controls .secondary-button {
  width: 100%;
  margin-top: 8px;
}

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

.controls .route-actions button {
  width: 100%;
  margin: 0;
  padding: 10px 8px;
  font-size: 12px;
}

.controls .route-actions button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.controls .place-search button:hover,
.controls .secondary-button:hover,
.controls .secondary-button.is-active,
.controls .route-actions button:not(:disabled):hover {
  background: #424650;
}

.controls .map-hint {
  margin: 8px 0 0;
  min-height: 34px;
  font-size: 12px;
  color: #8e8e93;
}

.maplibregl-control-container {
  display: none;
}

/* iOS Status Bar styling */
.statusbar {
  position: absolute;
  top: 24px;
  left: 44px;
  right: 38px;
  z-index: 100;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  user-select: none;
}

.statusbar .time-container {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.1px;
  font-family: "SF Pro Display Local", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}

.statusbar .time-container svg {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
}

.statusbar .right-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.statusbar .right-icons svg {
  display: inline-block;
  width: auto;
  height: 14px;
}

/* Rounded Map Control Buttons */
.round {
  position: absolute;
  z-index: 10;
  border: 0;
  background: rgba(10, 10, 11, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.round:hover {
  background: rgba(18, 18, 20, 0.98);
}

.back {
  top: 54px;
  left: 16px;
  width: 44px;
  height: 44px;
}

.bookmark {
  top: 54px;
  right: 72px;
  width: 44px;
  height: 44px;
}

.menu {
  top: 54px;
  right: 16px;
  width: 44px;
  height: 44px;
}

.play {
  bottom: 550px;
  right: 16px;
  width: 56px;
  height: 56px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Bottom Sheet */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 535px;
  background: #121212;
  border-radius: 24px 24px 0 0;
  padding: 10px 24px 28px;
  z-index: 20;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: #3e3e40;
  margin: 0 auto 24px;
  flex-shrink: 0;
}

/* Profile Row */
.profile-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.avatar {
  flex-shrink: 0;
}

.avatar img {
  display: block;
  width: 60px;
  height: auto;
}

.profile-row .info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-row strong {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 2px;
  letter-spacing: -0.2px;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.meta {
  color: #ffffff;
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.meta .shoe-icon {
  margin-top: 5px;
  flex-shrink: 0;
  width: 22px;
  height: 25px;
  object-fit: contain;
}

.meta .meta-text {
  display: inline-block;
}

/* Activity Title */
h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 32px;
  color: #ffffff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  font-family: "SF Pro Display Local", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Stats Grid */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 27px;
  column-gap: 16px;
  text-align: center;
  margin-bottom: 20px;
}

.stats .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stats span {
  display: block;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  margin-bottom: 4px;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.stats .cadence-label {
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: -0.15px;
}

.stats strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
  font-family: "SF Pro Display Local", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Long text for cadence */
.stats .stat-item.full-width {
  grid-column: 1 / 3;
}

/* Invite Section */
.invite {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.invite span {
  color: #f5f5f7;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.invite button {
  white-space: nowrap;
  background: transparent;
  color: #fc4c02;
  border: 1.5px solid #a83d16;
  border-radius: 20px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.invite button:hover {
  background: rgba(252, 76, 2, 0.1);
  border-color: #fc4c02;
}

/* Footer Source info */
.source {
  margin-top: 16px;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #ffffff;
  font-weight: 400;
  flex-shrink: 0;
}

.source img {
  display: block;
  width: 35px;
  height: auto;
}

.source span {
  font-size: 16px;
  font-family: "SF Pro Text Local", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .controls {
    position: static;
  }
  .phone {
    transform: scale(0.85);
    transform-origin: top center;
  }
  .phone-wrap {
    height: 820px;
    padding: 0;
  }
}
