/* Map-first layout (frontend/maps_ui.js): icon rail, slide-out panel, map buttons, layer chips, assistant chat. */
body.gm { grid-template-columns: 0 minmax(0, 1fr) !important; }
body.gm #map { margin-left: 72px; }
body.gm #panel { position: fixed !important; top: 0; bottom: 0; left: 72px; width: 410px; max-width: calc(100vw - 72px);
                 box-sizing: border-box;
                 margin: 0 !important; border-radius: 0 !important; z-index: 14; box-shadow: 4px 0 18px #0009;
                 transform: translateX(calc(-100% - 80px)); transition: transform .22s ease; visibility: hidden; }
body.gm.drawer #panel { transform: none; visibility: visible; }
body.gm.drawer #marsSearch { left: 424px; }
#drawerClose { position: absolute; top: 10px; right: 10px; width: 32px !important; height: 32px; margin: 0 !important;
               padding: 0 !important; border-radius: 50% !important; background: #ffffff1a !important; color: var(--fg);
               font-size: 18px; line-height: 32px; z-index: 3; }

#gmRail { position: fixed; z-index: 16; top: 0; bottom: 0; left: 0; width: 72px; display: flex; flex-direction: column;
          align-items: center; gap: 4px; padding: 10px 0; box-sizing: border-box; background: #120c0a;
          border-right: 1px solid #ffffff14; font-family: inherit; }
#gmRail button { width: 64px !important; margin: 0 !important; padding: 7px 0 5px !important; background: transparent !important;
                 color: #e9d9cd; border-radius: 10px !important; display: flex; flex-direction: column; align-items: center;
                 gap: 3px; font-size: 10.5px; letter-spacing: 0; text-transform: none; font-weight: 500; min-height: 0; }
#gmRail button:hover { background: #ffffff14 !important; }
#gmRail button.on { background: #563a2b !important; color: #fff; }
#gmRail button:disabled { opacity: .35; cursor: default; }
#gmRail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
              stroke-linejoin: round; }
#gmRail .grow { flex: 1; }
#gmRail .logo { width: 34px; height: 34px; border-radius: 50%; margin: 2px 0 10px;
                background: radial-gradient(circle at 35% 35%, #f0a46a, #b2502a 55%, #5a2412); box-shadow: 0 0 12px #e0703a55; }

#gmChips { position: absolute; z-index: 7; top: 16px; left: 408px; right: 14px; display: flex; gap: 8px; overflow-x: auto;
           scrollbar-width: none; pointer-events: none; }
body.gm.drawer #gmChips { left: 818px; }
#gmChips::-webkit-scrollbar { display: none; }
#gmChips button { pointer-events: auto; flex: none; width: auto !important; margin: 0 !important; padding: 6px 12px 6px 9px !important;
                  display: inline-flex; align-items: center; gap: 6px; border-radius: 18px !important;
                  background: #fbf4ee !important; color: #2a1d17 !important; font-size: 12.5px; font-weight: 500;
                  text-transform: none; letter-spacing: 0; box-shadow: 0 1px 6px #0007; min-height: 0; }
#gmChips button.on { background: #e0703a !important; color: #fff !important; }
#gmChips button[hidden] { display: none; }
#gmChips svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
               stroke-linejoin: round; }

#gmControls { position: absolute; z-index: 7; right: 14px; bottom: 40px; display: flex; flex-direction: column; gap: 8px;
              align-items: center; }
#gmControls .stack { display: flex; flex-direction: column; background: #fbf4ee; border-radius: 10px; overflow: hidden;
                     box-shadow: 0 1px 8px #0008; }
#gmControls button { width: 40px !important; height: 40px; margin: 0 !important; padding: 0 !important; border-radius: 0 !important;
                     background: #fbf4ee !important; color: #3a2a22 !important; display: grid; place-items: center;
                     font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; min-height: 0; }
#gmControls .solo { border-radius: 10px !important; box-shadow: 0 1px 8px #0008; }
#gmControls .stack button + button { border-top: 1px solid #e3d3c6; }
#gmControls button:hover { background: #f1dccd !important; }
#gmControls button.on { background: #e0703a !important; color: #fff !important; }
#gmControls svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
                  stroke-linejoin: round; }
#helpFab { display: none; }

/* assistant chat, under the search bar */
#gmChat { margin-top: 8px; background: #fbf4ee; color: #2a1d17; border-radius: 14px; box-shadow: 0 4px 18px #000a;
          display: flex; flex-direction: column; max-height: min(56vh, 520px); overflow: hidden; }
#gmChat[hidden] { display: none; }
#gmChat header { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-bottom: 1px solid #ead9cc;
                 font-size: 13px; font-weight: 600; }
#gmChat header span { flex: 1; }
#gmChat header svg { width: 18px; height: 18px; flex: none; fill: none; stroke: #e0703a; stroke-width: 2;
                     stroke-linecap: round; stroke-linejoin: round; }
#gmChat header button { width: 28px !important; height: 28px; margin: 0 !important; padding: 0 !important; border-radius: 50% !important;
                        background: transparent !important; color: #6b5449 !important; font-size: 16px; min-height: 0; }
#gmChat header button:hover { background: #f1dccd !important; }
#gmChat .log { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
#gmChat .msg { max-width: 88%; padding: 8px 11px; border-radius: 14px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
#gmChat .msg.user { align-self: flex-end; background: #e0703a; color: #fff; border-bottom-right-radius: 4px; }
#gmChat .msg.bot { align-self: flex-start; background: #f1e3d8; border-bottom-left-radius: 4px; }
#gmChat .msg.bot.wait { color: #7d6a5f; font-style: italic; }
#gmChat .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
#gmChat .chips button { width: auto !important; margin: 0 !important; padding: 5px 11px !important; border-radius: 16px !important;
                        background: #fff !important; color: #8a3f1c !important; border: 1px solid #e0703a88 !important;
                        font-size: 12px; text-transform: none; letter-spacing: 0; min-height: 0; }
#gmChat .chips button:hover { background: #fde9dc !important; }
#gmChat form { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid #ead9cc; }
#gmChat form input { flex: 1; border: 1px solid #dcc6b6; border-radius: 18px; padding: 8px 12px; font-size: 13px;
                     background: #fff; color: #2a1d17; min-width: 0; }
#gmChat form button { width: auto !important; margin: 0 !important; padding: 6px 14px !important; border-radius: 18px !important;
                      text-transform: none; letter-spacing: 0; min-height: 0; }
@media (min-width: 761px) {
  body.gm.drawer #routePlayback { left: 424px; max-width: calc(100% - 438px); }
}
@media (max-width: 1100px) {
  #gmChips { top: 64px; left: 14px; }
  body.gm.drawer #gmChips { left: 424px; }
  body.gm.chat #gmChips { display: none; }
}
@media (max-width: 760px) {
  body.gm #panel { width: calc(100vw - 72px); }
  body.gm.drawer #marsSearch, body.gm.drawer #gmChips { left: 14px; }
}

/* ---- one section at a time from the rail ---- */
#panel[data-solo] > *:not(#drawerClose):not(h1):not(.soloKeep) { display: none !important; }
#panel[data-solo] > .soloKeep[hidden] { display: none !important; }

/* ---- team design: title between copper rules ---- */
#panel > h1 { background: none !important; border: 0 !important; border-radius: 0 !important;
              border-top: 2px solid #c98a5e !important; border-bottom: 2px solid #c98a5e !important;
              margin: 6px 36px 18px 0 !important; padding: 12px 4px !important; text-align: center;
              font-family: "Rajdhani", "Inter", system-ui, sans-serif; font-size: 23px !important; font-weight: 700 !important; white-space: nowrap;
              letter-spacing: .08em !important; text-transform: uppercase; color: #e8b48c !important; }

/* ---- team design: chamfered section cards with an icon and a V chevron ---- */
#panel .panel-section > summary, #panel #missionSettings > summary, #sourcesButton {
  --cut: 34px;
  position: relative; isolation: isolate; box-sizing: border-box;
  display: flex; align-items: center; gap: 16px; width: 100%;
  min-height: 62px; margin: 14px 0 8px; padding: 10px 20px 10px 24px;
  background: #c98a5e !important; border: 0 !important; border-radius: 0 !important;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% 30%, 100% 70%, calc(100% - var(--cut)) 100%,
                     var(--cut) 100%, 0 70%, 0 30%);
  font-family: "Rajdhani", "Inter", system-ui, sans-serif; font-size: 16px; font-weight: 500; line-height: 1.2;
  letter-spacing: .12em; text-transform: uppercase; color: #f3dfd1; cursor: pointer; list-style: none;
}
#panel .panel-section > summary::before, #panel #missionSettings > summary::before, #sourcesButton::before {
  content: ""; position: absolute; inset: 1px; z-index: -1; background: #2f2523;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% 30%, 100% 70%, calc(100% - var(--cut)) 100%,
                     var(--cut) 100%, 0 70%, 0 30%);
  transition: background .15s;
}
#panel .panel-section > summary:hover::before, #sourcesButton:hover::before { background: #3a2c28; }
#panel .panel-section[open] > summary, #sourcesButton[aria-expanded="true"] { background: #e0703a !important; }
#panel .panel-section[open] > summary::before, #sourcesButton[aria-expanded="true"]::before { background: #3b2b26; }
#panel .panel-section > summary::after, #panel #missionSettings > summary::after, #sourcesButton::after {
  content: "V" !important; margin-left: auto; flex: none; font-family: "Rajdhani", "Inter", sans-serif;
  font-size: 22px; font-weight: 400; letter-spacing: 0; color: #e8b48c; transition: transform .2s;
}
#panel .panel-section[open] > summary::after, #sourcesButton[aria-expanded="true"]::after { transform: rotate(180deg); }
#panel .secIcon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; }
#panel .secIcon svg { width: 32px; height: 32px; fill: none; stroke: #e8b48c; stroke-width: 1.3;
                      stroke-linecap: round; stroke-linejoin: round; }
#panel .secLabel { flex: 1; min-width: 0; }
#panel .secHelp { flex: none; }
#sourcesButton { color: #f3dfd1 !important; text-align: left; }
#panel #manual > summary, #panel #mapKey > summary { min-height: 52px; font-size: 14px; --cut: 26px; }
#panel #manual > summary .secIcon svg, #panel #mapKey > summary .secIcon svg { width: 26px; height: 26px; }
#panel > .panel-section[open] > summary { top: -2px; }

/* ---- autoplay tour (frontend/tour.js) ---- */
body.touring #gmRail, body.touring #marsSearch, body.touring #gmChips, body.touring #gmControls,
body.touring #routePlayback, body.touring #panel { visibility: hidden !important; }
body.touring.gm #map { margin-left: 0; }
#tourCard { position: absolute; z-index: 20; left: 50%; bottom: 46px; transform: translateX(-50%);
            min-width: min(520px, 86%); max-width: 86%; padding: 16px 26px 14px; text-align: center;
            background: #120c0acc; border-top: 2px solid #c98a5e; border-bottom: 2px solid #c98a5e;
            backdrop-filter: blur(6px); color: #f3dfd1; font-family: "Rajdhani", "Inter", system-ui, sans-serif; }
#tourCard[hidden] { display: none; }
#tourCard.show { animation: tourIn .6s ease; }
@keyframes tourIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
#tourCard .tourTitle { font-size: 26px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #e8b48c; }
#tourCard .tourLine { margin-top: 4px; font-size: 17px; font-weight: 500; letter-spacing: .03em; }
#tourCard .tourDots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
#tourCard .tourDots span { width: 7px; height: 7px; border-radius: 50%; background: #ffffff40; }
#tourCard .tourDots span.on { background: #e0703a; }
#tourCard .tourStop { position: absolute; top: -38px; right: 0; width: auto !important; margin: 0 !important;
                      padding: 5px 12px !important; border-radius: 14px !important; font-size: 11px;
                      background: #120c0acc !important; color: #e8b48c !important; border: 1px solid #c98a5e88 !important;
                      text-transform: none; letter-spacing: .04em; min-height: 0; }
@media (prefers-reduced-motion: reduce) { #tourCard.show { animation: none; } }
/* flythrough: keep the bar and panel visible so every section flashes by */
body.touring.flashing #gmRail, body.touring.flashing #panel, body.touring.flashing #routePlayback,
body.touring.flashing #gmChips, body.touring.flashing #marsSearch { visibility: visible !important; }
body.touring.flashing.gm #map { margin-left: 72px; }
body.flashing #tourCard { bottom: auto; top: 50%; transform: translate(-50%, -50%); min-width: 0; padding: 10px 22px;
                          background: #120c0add; pointer-events: none; }
body.flashing #tourCard .tourTitle { font-size: 30px; white-space: nowrap; }
body.flashing #tourCard .tourLine { font-size: 13px; color: #c9a58c; font-variant-numeric: tabular-nums; }
body.flashing #tourCard .tourDots, body.flashing #tourCard .tourStop { display: none; }
body.flashing #tourCard.show { animation: none; }
