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

html, body {
  height: 100%;
  overflow: hidden;
  background: #070b1c;
  color: #e8eaf2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#arvideo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#sky:active { cursor: grabbing; }

#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(rgba(7,11,28,.92), rgba(7,11,28,0));
  pointer-events: none;
}
#topbar > div, #topbar button { pointer-events: auto; }

h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
}

#meta {
  font-size: 12.5px;
  color: #9aa3bd;
  margin-top: 2px;
}

#gps {
  flex-shrink: 0;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #e8eaf2;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
#gps:active { background: rgba(255,255,255,.22); }

#topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-about {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #e8eaf2;
  cursor: pointer;
}
#btn-about:active { background: rgba(255,255,255,.22); }

#daynote {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 88vw;
  font-size: 12px;
  color: #ffd98a;
  background: rgba(60,42,8,.75);
  border: 1px solid rgba(255,210,62,.25);
  padding: 6px 12px;
  border-radius: 999px;
  text-align: center;
}

#panel {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
#panel-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #8e97b3;
  padding: 0 16px 6px;
}
#chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
  pointer-events: auto;
}
#chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(20,28,55,.85);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: #e8eaf2;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.chip:active { background: rgba(50,62,105,.9); }
.chip .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
}
.chip .dir {
  color: #9aa3bd;
  font-size: 12px;
}
.chip-empty {
  font-size: 12.5px;
  color: #8e97b3;
  padding: 8px 16px;
}

#card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: min(92vw, 380px);
  background: rgba(15,21,44,.94);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 16px;
  padding: 16px 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

#card-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: #8e97b3;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

#card h2 {
  font-size: 19px;
  font-weight: 650;
  padding-right: 28px;
}

#card-sub {
  font-size: 12.5px;
  color: #ffd23e;
  margin: 3px 0 10px;
}

#card-rows { font-size: 13.5px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  border-top: 1px solid rgba(255,255,255,.07);
}
.row:first-child { border-top: none; }
.row .k { color: #9aa3bd; flex-shrink: 0; }
.row .v { text-align: right; }

#card-fact {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #c2c9de;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 9px 12px;
}

#fabs {
  position: fixed;
  right: 12px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#fabs button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20,28,55,.85);
  border: 1px solid rgba(255,255,255,.18);
  color: #c2c9de;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
#fabs button.on {
  background: rgba(255,210,62,.18);
  border-color: rgba(255,210,62,.7);
  color: #ffd23e;
}

#armode {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: rgba(20,28,55,.85);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(6px);
  z-index: 15;
}
#armode button {
  border: none;
  background: none;
  color: #c2c9de;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
}
#armode button.arm-on {
  background: rgba(255,210,62,.18);
  color: #ffd23e;
}

#search {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 400px);
  background: rgba(15,21,44,.96);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 10px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  z-index: 20;
}

#search-input {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  color: #e8eaf2;
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
}
#search-input::placeholder { color: #707a96; }

#search-results { max-height: 40vh; overflow-y: auto; }

.sr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid rgba(255,255,255,.07);
  color: #e8eaf2;
  font-size: 14.5px;
  text-align: left;
  padding: 11px 6px;
  cursor: pointer;
}
.sr-item:first-child { border-top: none; }
.sr-item .sr-kind { color: #9aa3bd; font-size: 12px; flex-shrink: 0; }
.sr-item.sr-down { opacity: .55; }

#nightveil {
  position: fixed;
  inset: 0;
  background: #ff1a1a;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 50;
}

#sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3,6,20,.6);
  backdrop-filter: blur(3px);
}
#sheet[hidden] { display: none; }

.sheet-card {
  position: relative;
  width: min(92vw, 400px);
  max-height: 86vh;
  overflow-y: auto;
  background: rgba(15,21,44,.97);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.sheet-card h2 { font-size: 20px; font-weight: 650; padding-right: 28px; }

.sheet-desc {
  font-size: 13.5px;
  color: #c2c9de;
  line-height: 1.55;
  margin: 8px 0 14px;
}

.sheet-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  color: #e8eaf2;
  font-size: 14.5px;
  font-weight: 500;
  padding: 13px 16px;
  margin-top: 8px;
  cursor: pointer;
  text-align: left;
}
.sheet-btn:active { background: rgba(255,255,255,.16); }
.sheet-btn svg { flex-shrink: 0; color: #9aa3bd; }
.sheet-btn.primary {
  background: rgba(255,210,62,.16);
  border-color: rgba(255,210,62,.55);
  color: #ffd23e;
}
.sheet-btn.primary svg { color: #ffd23e; }

.ios-tip {
  font-size: 12.5px;
  color: #ffd98a;
  line-height: 1.5;
  background: rgba(60,42,8,.55);
  border: 1px solid rgba(255,210,62,.2);
  border-radius: 10px;
  padding: 9px 12px;
  margin: 8px 0 0;
}

#sheet-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: none;
  color: #8e97b3;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}

.sheet-sep { height: 1px; background: rgba(255,255,255,.1); margin: 16px 0; }
.sheet-foot { font-size: 11.5px; color: #707a96; line-height: 1.5; margin-top: 16px; }

#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(120px + env(safe-area-inset-bottom));
  background: rgba(232,234,242,.95);
  color: #14182b;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  max-width: 86vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
