* {
  box-sizing: border-box;
  font-family: ui-rounded, system-ui, sans-serif;
  margin: 0;
  padding: 0;
}

html {
  touch-action: manipulation;
}

:root {
  --black: #000000;
  --black-08: rgba(0, 0, 0, 0.08);
  --black-50: rgba(0, 0, 0, 0.5);
  --black-95: rgba(0, 0, 0, 0.95);
  --dark-grey: #222222;
  --grey: #333333;
  --white: #ffffff;
  --white-10: rgba(255, 255, 255, 0.1);
  --white-20: rgba(255, 255, 255, 0.2);
  --white-50: rgba(255, 255, 255, 0.5);
  --orange: #ff8800;
  --orange-dark: #c16700;
  --orange-highlight: #ffe7cc;
  --orange-shadow: #c96b01;
}

body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  background: var(--grey);
  color: var(--white);
  font-family: ui-rounded, system-ui, sans-serif;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  width: 100dvw;
}

body.viewing-directions {
  background: var(--black);
}

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

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: transform 0.3s ease;
  width: 100%;
}

.landing-screen {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 2rem;
  position: relative;
  width: 100%;
}

@media (hover: hover) {
  .landing-screen::before {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='8' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    bottom: 0;
    content: "";
    left: 0;
    mix-blend-mode: overlay;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 0;
  }
}

.landing-content {
  max-height: 100%;
  max-width: 500px;
  overflow-y: auto;
  padding: 0 2px;
  position: relative;
  text-align: center;
  width: 100%;
  z-index: 1;
}

.landing-title {
  color: var(--white);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px var(--black-50);
}

.landing-input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.landing-input {
  background: var(--dark-grey);
  border: none;
  border-radius: 9999px;
  box-shadow: 2px 4px 4px -2px var(--black-50) inset,
    0 -1px 2px 0 var(--white-50) inset;
  color: var(--white);
  font-size: 1.125rem;
  padding: 1.25rem 1.5rem;
  width: 100%;
}

.landing-input:-webkit-autofill,
.landing-input:-webkit-autofill:hover,
.landing-input:-webkit-autofill:focus,
.landing-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--dark-grey) inset !important;
  -webkit-text-fill-color: var(--white) !important;
}

.landing-input:focus {
  outline: none;
}

.landing-input::placeholder {
  color: var(--white);
  opacity: 0.8;
}

.landing-input:hover::placeholder,
.landing-input:focus::placeholder {
  opacity: 0.5;
}

.address-history {
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 2rem;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: none;
}

.address-history-item {
  align-items: center;
  border-bottom: 1px solid var(--white-10);
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
}

.address-history-item:last-child {
  border-bottom: none;
}

.address-history-content {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex: 1;
  gap: 0.75rem;
  transition: opacity 0.2s ease;
}

.address-history-content:hover .address-history-text {
  color: var(--orange);
}

.address-history-content:hover .address-history-icon {
  color: var(--orange);
}

.address-history-icon {
  color: var(--white);
  flex-shrink: 0;
  height: 18px;
  width: 18px;
}

.address-history-text {
  color: var(--white);
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
}

.address-history-delete {
  align-items: center;
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 0.5rem;
  transition: color 0.2s ease;
}

.address-history-delete:hover {
  color: var(--orange);
}

.address-history-delete svg {
  height: 18px;
  width: 18px;
}

.navigation-screen {
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-select: none;
  backface-visibility: hidden;
  display: flex;
  flex-direction: row;
  height: 100%;
  left: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  user-select: none;
  width: 100%;
  will-change: transform;
}

.map-container {
  flex-shrink: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 50%;
}

.map {
  bottom: 0;
  height: 100%;
  left: 0;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
}

.directions-panel {
  background: var(--black);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  position: relative;
  width: 50%;
}

.quit-btn {
  align-items: center;
  background: var(--white-10);
  border: none;
  border-radius: 50%;
  color: var(--white);
  cursor: pointer;
  display: flex;
  font-size: 2rem;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 1rem;
  top: 1rem;
  transition: background 0.2s ease;
  width: 40px;
  z-index: 10;
}

.quit-btn:hover {
  background: var(--white-20);
}

.quit-btn svg {
  height: 24px;
  stroke-width: 2;
  width: 24px;
}

.current-step {
  align-items: center;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 200px;
  padding: 2rem 0;
  text-align: center;
}

.step-arrow {
  align-items: center;
  display: flex;
  justify-content: center;
  line-height: 1;
  margin-bottom: 1rem;
}

.maneuver-icon {
  filter: brightness(0) invert(1);
  height: 96px;
  object-fit: contain;
  width: 96px;
}

.step-instruction {
  color: var(--white);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.step-distance-time {
  color: var(--white);
  font-size: 1.75rem;
  font-weight: 600;
}

.placeholder-text {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
}

.orientation-fullscreen {
  align-items: center;
  backface-visibility: hidden;
  background: var(--black);
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  will-change: transform;
  z-index: 10000;
}

.orientation-content {
  max-width: 600px;
  padding: 2rem;
  text-align: center;
}

.orientation-content h1 {
  color: var(--white);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.orientation-content p {
  color: var(--white);
  font-size: 1.125rem;
  line-height: 1.6;
}

.loading-indicator {
  align-items: center;
  background: var(--black-95);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  justify-content: center;
  left: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  position: fixed;
  top: 0;
  width: 100dvw;
  z-index: 10001;
}

.spinner {
  animation: spin 1s linear infinite;
  border: 4px solid var(--white);
  border-radius: 50%;
  border-top-color: var(--orange);
  height: 50px;
  margin-bottom: 1rem;
  width: 50px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn {
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(180deg, var(--orange) 0, var(--orange-dark) 100%)
      padding-box,
    linear-gradient(
        var(--orange-highlight) 0%,
        var(--orange-shadow) 50%,
        var(--orange-highlight) 100%
      )
      border-box;
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px var(--orange-dark), 0 0 4px 0 var(--black-08),
    0 4px 8px 0 var(--black-08), 0 1px 2px 0 var(--black-08),
    0 0 4px 0 var(--black-08), 0 4px 8px 0 var(--black-08),
    0 1px 2px 0 var(--black-08);
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  background: linear-gradient(180deg, var(--orange-dark) 0, var(--orange) 100%)
      padding-box,
    linear-gradient(
        var(--orange-highlight) 0%,
        var(--orange-shadow) 50%,
        var(--orange-highlight) 100%
      )
      border-box;
}

.btn-primary .txt {
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-image: linear-gradient(var(--white), var(--white));
  filter: drop-shadow(0 -1px 0px hsl(0, 0%, 0%, 0.25));
  position: relative;
}

.btn-large {
  font-size: 1.125rem;
  padding: 1.25rem 1.5rem;
}

.address-history::-webkit-scrollbar,
.hidden,
.landing-screen.hidden,
.loading-indicator.hidden,
.navigation-screen.hidden,
.orientation-fullscreen.hidden,
.portrait-warning,
.portrait-warning.hidden {
  display: none;
}

@media (orientation: portrait) {
  .portrait-warning:not(.hidden) {
    display: flex;
  }

  .orientation-fullscreen.force-landscape {
    height: 100vw;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    width: 100vh;
  }

  .navigation-screen.force-landscape {
    height: 100vw;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    width: 100vh;
  }

  .navigation-screen.force-landscape.landscape-secondary {
    transform: translate(-50%, -50%) rotate(-90deg);
  }
}

@media (orientation: landscape) {
  .orientation-fullscreen.force-landscape,
  .portrait-warning {
    display: none;
  }

  .map-container {
    order: 1;
  }

  .directions-panel {
    order: 2;
  }
}

@media (max-width: 768px) {
  .step-instruction {
    font-size: 2rem;
  }
}

.mapboxgl-ctrl-group,
.mapboxgl-ctrl-zoom-in,
.mapboxgl-ctrl-zoom-out,
.mapboxgl-ctrl-compass,
.mapboxgl-ctrl-geolocate,
.mapboxgl-ctrl-scale,
.mapboxgl-ctrl-attrib {
  display: none !important;
}

.mapboxgl-ctrl-logo {
  display: none !important;
}
