/* Co Drive — mobile-first smoked glass. Always dark. Sunlight-first. */

:root {
  --bg: #000000;
  --theme: #05070A;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);
  --glass: rgba(12, 16, 22, 0.72);
  --glass-strong: rgba(10, 14, 20, 0.88);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.18);
  --blue: #1b6eff;
  --blue-press: #155fe0;
  --cyan: #3cd3fe;
  --danger: #ff4245;
  --topbar-h: 54px;
  --tabbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 22px;
  --radius-sm: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.2 var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 7, 10, 0.35) 0%, rgba(0, 0, 0, 0.82) 58%, #000 100%),
    url("assets/co-drive-dark-glass-background.png") center top / cover no-repeat;
  opacity: 0.42;
}

@media (prefers-reduced-transparency: reduce) {
  .atmosphere { display: none; }
}

.topbar, #app, .tabbar, .sheet { position: relative; z-index: 1; }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 8px 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.18) 90%, transparent);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon-btn,
.tab-btn,
.primary,
.ghost,
.row-btn,
.chip,
.car-opt,
.person,
.trip-item,
.dest-card {
  min-height: 44px;
  min-width: 44px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.icon-btn {
  display: grid;
  place-items: center;
  color: var(--fg);
  border-radius: 12px;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.08); }

#app {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 20px;
}

.tabbar {
  position: fixed;
  inset: auto 12px 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  margin-bottom: 8px;
  display: flex;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 10;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.tab-btn.is-active { color: var(--blue); }

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.glass + .glass { margin-top: 12px; }

.map-card {
  position: relative;
  height: 220px;
  overflow: hidden;
  padding: 0;
}

.map-art {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 22%, rgba(27, 110, 255, 0.28), transparent 28%),
    linear-gradient(180deg, #0b1018 0%, #07090d 100%);
}

.map-art svg { width: 100%; height: 100%; display: block; }

.dest-card,
.stats-card,
.status-card,
.people-row,
.settings-card {
  padding: 14px 16px;
}

.dest-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pin {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
}

.dest-row h2 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.dest-row p,
.muted { color: var(--muted); font-size: 13px; line-height: 1.3; }

.stats-card {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  text-align: center;
  gap: 8px;
}

.stats-card .v {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.stats-card .k {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.rule { background: var(--stroke); }

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(60, 211, 254, 0.14);
}

.people-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.person {
  width: 76px;
  flex: none;
  text-align: center;
  padding: 0;
  background: none;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  object-fit: cover;
  background: #161b22;
  border: 1px solid var(--stroke-strong);
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  font-weight: 600;
  color: #cfe3ff;
}

.avatar.invite {
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--muted);
}

.person .name { font-size: 13px; font-weight: 600; }
.badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(27, 110, 255, 0.18);
  color: #9ec3ff;
  font-size: 11px;
  font-weight: 600;
}

.primary {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 52px;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(27, 110, 255, 0.28);
}

.primary:active { background: var(--blue-press); }

.primary[disabled] { opacity: 0.45; }

.ghost {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-weight: 600;
}

.empty {
  text-align: center;
  padding: 36px 16px 20px;
}

.empty img {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  display: block;
}

.empty h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

.form input[type="text"],
.form input[type="file"] {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  padding: 0 14px;
  font: inherit;
}

.form input::placeholder { color: var(--faint); }

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

.car-opt {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.car-opt.is-on {
  border-color: rgba(27, 110, 255, 0.7);
  background: rgba(27, 110, 255, 0.16);
}

.trip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  color: inherit;
}

.trip-item h3 { font-size: 17px; font-weight: 600; }
.code-pill {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--cyan);
}

.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.member .avatar { width: 48px; height: 48px; margin: 0; border-radius: 24px; }

.grow { flex: 1; min-width: 0; }

.danger {
  color: var(--danger);
  font-weight: 600;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.sheet[hidden] { display: none; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  width: 100%;
}

.sheet-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  padding: 16px;
  border-radius: 22px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sheet-kicker {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.row-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 4px;
  border-bottom: 1px solid var(--stroke);
  font-weight: 600;
}

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

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  z-index: 40;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  text-align: center;
  font-weight: 600;
}

.offline-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
}

.route-step {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  padding: 8px 0;
}

.route-step .mark {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--blue);
}

.route-step .mark.end {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

@media (min-width: 540px) {
  #app { max-width: 430px; left: 50%; right: auto; transform: translateX(-50%); }
  .topbar, .tabbar { max-width: 430px; left: 50%; right: auto; transform: translateX(-50%); }
  .tabbar { width: calc(430px - 24px); }
}
