/* WorldTrace · Frag den Globus (Prototyp): Moduswechsel Live ↔ Frage, Chat, Szenen-Anzeige */
html, body { height: 100%; margin: 0; background: #020306; overflow: hidden; }
[hidden] { display: none !important; }
/* Im Live-Globus lädt app.css statt site.css: dort fehlende Werte hier ergänzen (gleiche Werte wie site.css) */
.globe-page { --line: rgba(255, 255, 255, .08); --line2: rgba(255, 255, 255, .14); --tint: rgba(255, 255, 255, .04); --tint2: rgba(255, 255, 255, .08);
  --card: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)); --font-head: 'Inter Tight', 'Inter', system-ui, sans-serif; --btn-ink: #04120d; }
#globe { position: fixed; inset: 0; transition: transform .9s cubic-bezier(.2, .7, .1, 1); }
.cesium-viewer-bottom { opacity: .5; }
.glass, .ag-top .ag-mode, .topbar .ag-mode, .ag-live, .ag-chat, .ag-hud, .ag-time, .ag-caption {
  background: rgba(7, 10, 16, .74); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--line2);
}

/* ───────── Kopfzeile mit Modus-Schalter */
.ag-top { position: fixed; top: 14px; left: 16px; right: 16px; z-index: 20; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ag-brand { position: absolute; left: 0; pointer-events: auto; color: var(--text); text-decoration: none; }
.ag-mode { position: relative; display: flex; padding: 4px; border-radius: 99px; pointer-events: auto; }
.ag-mode button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer;
  font: 600 13.5px var(--font); color: var(--muted); padding: 9px 16px; border-radius: 99px; transition: color .3s; white-space: nowrap; }
.ag-mode button[aria-selected="true"] { color: var(--btn-ink); }
.ag-mode button[aria-selected="true"] .dot { background: var(--btn-ink); box-shadow: none; animation: none; }
.ag-mode-ink { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 99px; background: linear-gradient(135deg, var(--accent), #44d6f0);
  box-shadow: 0 6px 24px -6px rgba(94, 240, 195, .6); transition: transform .45s cubic-bezier(.3, .8, .2, 1), width .45s cubic-bezier(.3, .8, .2, 1); }
.mode-ask .ag-mode-ink { background: linear-gradient(135deg, #b593ff, #7aa2ff); box-shadow: 0 6px 24px -6px rgba(181, 147, 255, .6); }
.ag-spark { display: inline-block; }
.mode-live .ag-mode button[data-mode="ask"] .ag-spark { animation: twinkle 3s ease-in-out infinite; color: #c9b3ff; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: .8 } 50% { transform: scale(1.3) rotate(25deg); opacity: 1 } }

/* ───────── Live-Modus: Ebenen unten */
.ag-live { position: fixed; left: 50%; bottom: 22px; z-index: 10; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; border-radius: 99px;
  transition: opacity .45s, transform .6s cubic-bezier(.2, .7, .1, 1); max-width: calc(100vw - 32px); overflow-x: auto; scrollbar-width: none; }
.mode-ask .ag-live { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; }
.ag-layer, .ag-askcta { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 99px; padding: 8px 14px; white-space: nowrap;
  font: 500 13px var(--font); color: var(--dim); background: none; transition: color .2s, background .2s; }
.ag-layer i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .35; }
.ag-layer b { font: 600 12px var(--mono); color: var(--dim); }
.ag-layer.on { color: var(--text); }
.ag-layer.on i { opacity: 1; box-shadow: 0 0 10px var(--c); }
.ag-layer.on b { color: var(--muted); }
.ag-layer:hover { background: var(--tint2); }
.ag-askcta { color: #e6dcff; background: rgba(181, 147, 255, .14); font-weight: 600; }
.ag-askcta:hover { background: rgba(181, 147, 255, .24); }

/* ───────── Frage-Modus: Chat rechts (Handy: unten) */
.ag-chat { position: fixed; z-index: 15; top: 72px; right: 16px; bottom: 16px; width: 400px; border-radius: 22px; display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 40px)); opacity: 0; transition: transform .7s cubic-bezier(.2, .7, .1, 1), opacity .4s; }
.mode-ask .ag-chat { transform: none; opacity: 1; }
.mode-ask #globe { transform: translateX(-200px); }
.ag-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.ag-chat-head b { font: 600 15px var(--font-head); display: block; }
.ag-quota { font: 500 11px var(--mono); color: var(--muted); letter-spacing: .02em; }
.ag-quota.none { color: var(--warn); }
.ag-x { border: 0; background: var(--tint); color: var(--muted); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.ag-x:hover { background: var(--tint2); color: var(--text); }
.ag-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.ag-msg { font-size: 14px; line-height: 1.55; animation: msgIn .45s cubic-bezier(.2, .7, .1, 1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) } }
.ag-msg.me { align-self: flex-end; max-width: 85%; background: linear-gradient(135deg, rgba(181, 147, 255, .25), rgba(122, 162, 255, .2)); border: 1px solid rgba(181, 147, 255, .3);
  padding: 9px 13px; border-radius: 16px 16px 4px 16px; }
.ag-msg.bot { background: var(--card); border: 1px solid var(--line); padding: 13px 14px; border-radius: 4px 16px 16px 16px; }
.ag-msg.bot.hello { color: var(--muted); }
.ag-msg.bot h3 { font: 600 15.5px var(--font-head); margin: 0 0 6px; letter-spacing: -.01em; }
.ag-msg.bot p { margin: 0; }
.ag-msg.bot.err { border-color: rgba(255, 93, 108, .35); color: #ffc2c8; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ag-chip { border: 1px solid var(--line2); background: var(--tint); color: var(--text); font: 500 12.5px var(--font); padding: 6px 11px; border-radius: 99px; cursor: pointer; text-align: left; transition: background .2s, border-color .2s; }
.ag-chip:hover { background: rgba(181, 147, 255, .16); border-color: rgba(181, 147, 255, .45); }
.ag-chip:disabled { opacity: .45; cursor: not-allowed; }
.ag-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.ag-steps li { display: flex; gap: 8px; align-items: center; animation: msgIn .35s both; }
.ag-steps li::before { content: ''; width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid rgba(181, 147, 255, .35); border-top-color: #c9b3ff; animation: spin .8s linear infinite; }
.ag-steps li.ok { color: var(--text); }
.ag-steps li.ok::before { border: 0; background: var(--accent); animation: none; box-shadow: 0 0 8px var(--accent); width: 8px; height: 8px; margin: 0 2px; }
@keyframes spin { to { transform: rotate(360deg) } }
.ag-collect { display: flex; align-items: center; gap: 8px; font: 600 13.5px var(--font); }
.ag-collect .shimmer { background: linear-gradient(90deg, var(--muted), #fff, var(--muted)); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shim 1.6s linear infinite; }
@keyframes shim { to { background-position: -200% 0 } }
.ag-meta { margin-top: 10px; font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.ag-actions { display: flex; gap: 6px; margin-top: 10px; }
.ag-act { border: 1px solid var(--line2); background: none; color: var(--muted); font: 500 12px var(--font); padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.ag-act:hover { color: var(--text); background: var(--tint); }
.ag-msg.bot.playing { border-color: rgba(181, 147, 255, .4); box-shadow: 0 0 0 1px rgba(181, 147, 255, .15), 0 10px 30px -12px rgba(181, 147, 255, .35); }
.ag-compose { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.ag-compose textarea { flex: 1; resize: none; max-height: 110px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); color: var(--text); border-radius: 14px;
  padding: 11px 13px; font: 14px/1.4 var(--font); outline: none; transition: border-color .2s; }
.ag-compose textarea:focus { border-color: rgba(181, 147, 255, .6); }
.ag-compose button { width: 42px; height: 42px; border: 0; border-radius: 50%; cursor: pointer; font: 700 18px var(--font); color: #0b0618;
  background: linear-gradient(135deg, #c9b3ff, #7aa2ff); transition: transform .15s, opacity .2s; flex: none; }
.ag-compose button:hover { transform: scale(1.06); }
.ag-compose button:disabled, .ag-compose textarea:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.ag-upsell { display: inline-block; margin-top: 8px; color: #c9b3ff; font-weight: 600; font-size: 13px; }

/* Wartezeit-Karten („Wusstest du schon?“) */
.ag-facts { margin-top: 12px; transition: opacity .4s, transform .4s; }
.ag-facts.done { opacity: 0; transform: translateY(-6px); }
.ag-fact-stage { position: relative; display: grid; }
.ag-fact { grid-area: 1 / 1; border-radius: 14px; overflow: hidden; background: rgba(255, 255, 255, .035); border: 1px solid var(--line);
  opacity: 0; transform: translateY(8px) scale(.985); transition: opacity .55s, transform .55s cubic-bezier(.2, .7, .1, 1); }
.ag-fact.on { opacity: 1; transform: none; }
.ag-fact figure { margin: 0; aspect-ratio: 16 / 9; overflow: hidden; background: #0b0f17; }
.ag-fact figure img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kenburns 9s ease-out both; }
@keyframes kenburns { from { transform: scale(1.12) } to { transform: scale(1) } }
.ag-fact-body { padding: 10px 12px 11px; }
.ag-fact-k { font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #c9b3ff; }
.ag-fact.k-data .ag-fact-k, .ag-fact.k-live .ag-fact-k { color: var(--accent); }
.ag-fact.k-cam .ag-fact-k { color: var(--danger); }
.ag-fact.k-cam .ag-fact-k::before { content: '● '; }
.ag-fact.k-data, .ag-fact.k-live { border-left: 3px solid var(--accent); }
.ag-fact.k-data p, .ag-fact.k-live p { font: 500 15px/1.45 var(--font-head); }
.ag-fact p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; }
.ag-fact small { display: block; margin-top: 6px; font-size: 10.5px; color: var(--dim); }
.ag-fact-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.ag-fact-dots { display: flex; gap: 4px; }
.ag-fact-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line2); transition: width .3s, background .3s; }
.ag-fact-dots i.on { width: 14px; border-radius: 3px; background: #c9b3ff; }
.ag-fact-next { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.ag-fact-next:hover { color: var(--text); }

/* ───────── Szene: Anzeige links oben, Erzähltext, Zeitachse */
.ag-hud { position: fixed; z-index: 12; left: 16px; top: 72px; width: 290px; padding: 14px 16px; border-radius: 18px; animation: msgIn .6s both; }
.ag-hud-t { font: 600 13px var(--font); color: var(--muted); }
.ag-hud-big { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin-top: 4px; }
.ag-hud-v { font-size: 13px; color: var(--muted); min-height: 20px; }
.ag-hud-v b { font: 600 19px var(--mono); color: var(--text); }
.ag-hud-chart { width: 100%; height: 64px; margin-top: 8px; overflow: visible; }
.ag-hud-chart .a { fill: rgba(181, 147, 255, .14); }
.ag-hud-chart .l { fill: none; stroke: #c9b3ff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.ag-hud-chart circle { fill: #fff; filter: drop-shadow(0 0 6px #c9b3ff); }
.ag-legend { margin-top: 10px; font: 500 10.5px var(--mono); color: var(--dim); }
.ag-legend .bar { height: 6px; border-radius: 3px; margin-bottom: 4px; }
.ag-legend .ends { display: flex; justify-content: space-between; }
.ag-legend .sw { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }
.ag-legend .sw i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.ag-rank { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.ag-rank:empty { display: none; }
.ag-rank li { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 8px; color: var(--muted); }
.ag-rank li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-rank li i { height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(201, 179, 255, .35), #c9b3ff); min-width: 3px; transition: width .25s; }
.ag-rank li b { font: 600 11.5px var(--mono); color: var(--text); }
.ag-rank li.lit span, .ag-rank li.lit b { color: #fff; }
.ag-rank li.lit i { background: linear-gradient(90deg, #fff6, #fff); }
.ag-legend .bubbles { display: flex; align-items: flex-end; gap: 6px; }
.ag-legend .bubbles i { width: var(--s); height: var(--s); border-radius: 50%; background: rgba(255, 197, 77, .55); box-shadow: 0 0 10px rgba(255, 197, 77, .5); border: 1px solid rgba(255, 255, 255, .5); }
.ag-legend .bubbles span { margin-left: 4px; line-height: 1.3; }
.ag-hud-src { margin-top: 8px; font-size: 10.5px; color: var(--dim); }
.ag-caption { position: fixed; z-index: 12; left: 50%; bottom: 86px; transform: translateX(-50%); max-width: min(620px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 16px;
  font: 500 16px/1.45 var(--font-head); text-align: center; animation: capIn .6s cubic-bezier(.2, .7, .1, 1) both; }
.mode-ask .ag-caption { left: calc(50% - 216px); }
@keyframes capIn { from { opacity: 0; transform: translate(-50%, 14px) } }
.ag-caption b { color: #c9b3ff; font-family: var(--mono); font-weight: 600; margin-right: 8px; }
.ag-time { position: fixed; z-index: 12; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px;
  padding: 7px 14px 7px 7px; border-radius: 99px; animation: msgIn .5s both; }
.mode-ask .ag-time { left: calc(50% - 216px); width: min(520px, calc(100vw - 480px)); }
.ag-time button { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(181, 147, 255, .2); color: #e6dcff; font-size: 11px; flex: none; }
.ag-time input { flex: 1; accent-color: #b593ff; }
.ag-time span { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }

/* Sonar-Ping, während der Globus sammelt (Position setzt askglobe.js) */
.ag-ping { position: fixed; left: 0; top: 0; z-index: 5; width: 0; height: 0; pointer-events: none; transition: opacity .3s; }
.ag-ping::before, .ag-ping::after, .ag-ping i { content: ''; position: absolute; left: -90px; top: -90px; width: 180px; height: 180px; border-radius: 50%;
  border: 1.5px solid rgba(201, 179, 255, .8); animation: ping 2.4s cubic-bezier(.1, .6, .3, 1) infinite; opacity: 0; }
.ag-ping::after { animation-delay: .8s; }
.ag-ping i { animation-delay: 1.6s; }
.ag-ping span { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); white-space: nowrap; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #e6dcff;
  text-shadow: 0 0 12px rgba(181, 147, 255, .9); }
@keyframes ping { 0% { transform: scale(.1); opacity: 1 } 100% { transform: scale(1.4); opacity: 0 } }

@media (max-width: 820px) {
  .ag-brand span { display: none; }
  .ag-chat { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 52vh; transform: translateY(calc(100% + 30px)); }
  .mode-ask #globe { transform: translateY(-22vh); }
  .ag-hud { top: 64px; left: 8px; right: 8px; width: auto; padding: 10px 12px; }
  .ag-hud-chart, .ag-legend, .ag-hud-src { display: none; }
  .ag-hud-big { font-size: 26px; }
  .mode-ask .ag-caption { left: 50%; bottom: calc(52vh + 70px); font-size: 14px; }
  .mode-ask .ag-time { left: 50%; width: calc(100vw - 16px); bottom: calc(52vh + 16px); }
  .ag-mode button { padding: 8px 12px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  #globe, .ag-chat, .ag-live, .ag-mode-ink { transition: none; }
  .ag-ping::before, .ag-ping::after, .ag-ping i, .ag-spark, .ag-fact figure img { animation: none; }
}

/* ───────── Im Live-Globus (globe.php): Umschalter in der Kopfzeile, im Frage-Modus tritt die Live-Oberfläche zurück */
.topbar .ag-mode { flex: none; height: 40px; box-sizing: border-box; padding: 3px; }
.topbar .ag-mode button { padding: 7px 13px; }
.topbar .ag-mode .ag-mode-ink { top: 3px; bottom: 3px; left: 3px; }
.ag-beta { display: inline-block; font: 700 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 5px; border-radius: 5px;
  background: rgba(181, 147, 255, .2); color: #d9c9ff; vertical-align: 2px; }
.ag-mode button[aria-selected="true"] .ag-beta { background: rgba(11, 6, 24, .25); color: #0b0618; }
@media (min-width: 821px) { .globe-page #agChat, .globe-page .ag-hud { top: 64px; } }
.globe-page #panel, .globe-page #drawer, .globe-page .mapctl, .globe-page .statusbar, .globe-page .topbar .search, .globe-page #btnLayers, .globe-page .preview-bar,
.globe-page .zoom-lock, .globe-page #vignette { transition: opacity .45s, visibility .45s; }
.mode-ask #panel, .mode-ask #drawer, .mode-ask .mapctl, .mode-ask .statusbar, .mode-ask .topbar .search, .mode-ask #btnLayers, .mode-ask #hud,
.mode-ask .preview-bar, .mode-ask .zoom-lock, .mode-ask #tip { opacity: 0; visibility: hidden; pointer-events: none; }
.zoom-lock { position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 16; padding: 8px 14px; font-size: 12.5px; border-radius: 10px; white-space: nowrap; }
.zoom-lock a { color: var(--accent); font-weight: 600; }
@media (max-width: 820px) {
  .topbar .ag-mode [data-mode="ask"] .ag-lbl, .topbar .ag-mode .ag-beta { display: none; }
  .topbar .ag-mode button { padding: 7px 11px; }
  .mode-ask .topbar .search { display: none; }
}
