/* Estrella — Ethereal Glass sur fond de ciel réel */
:root {
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --glass-bg: rgba(8, 12, 26, 0.55);
  --glass-line: rgba(255, 255, 255, 0.10);
  --txt: #e7ecfa;
  --txt-dim: rgba(210, 220, 245, 0.55);
  --accent: #9fc4ff;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #020308;
  color: var(--txt);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

#sky { position: fixed; inset: 0; touch-action: none; }

/* ---- Loader ---- */
#loader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  background: #020308;
  font-size: 0.95rem; letter-spacing: 0.05em; color: var(--txt-dim);
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}
#loader.done { opacity: 0; visibility: hidden; }
.star-pulse { color: var(--accent); animation: pulse 1.6s var(--ease) infinite; display: inline-block; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.35); opacity: 1; } }

/* ---- Glass base ---- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.08), 0 12px 40px rgba(0,0,0,0.35);
}

/* ---- Header pill ---- */
#topbar {
  position: fixed; top: 1.1rem; left: 50%; transform: translateX(-50%);
  z-index: 20;
  display: flex; align-items: center; gap: 1.1rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  background: rgba(8, 12, 26, 0.5);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.08), 0 8px 30px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.brand { display: flex; align-items: center; gap: 0.55rem; }
.logo { color: var(--accent); font-size: 1rem; }
.name {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 1.35rem; letter-spacing: 0.01em;
}
.sep { width: 1px; height: 1.1rem; background: var(--glass-line); }
.place { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--txt-dim); }
.when { display: flex; align-items: center; gap: 0.55rem; font-size: 0.85rem; }
#clock { font-weight: 400; font-variant-numeric: tabular-nums; }
.date { color: var(--txt-dim); font-size: 0.72rem; }
#live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #7dffb0; box-shadow: 0 0 8px #7dffb0;
  animation: pulse 2s var(--ease) infinite;
}
#live-dot.off { background: #ffb37d; box-shadow: 0 0 8px #ffb37d; animation: none; }

/* ---- Panels (double-bezel) ---- */
.panel {
  position: fixed; z-index: 15;
  width: 320px; max-height: calc(100dvh - 180px);
  border-radius: 1.6rem;
  padding: 0.4rem;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.7s var(--ease), opacity 0.7s var(--ease);
}
.panel-inner {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: calc(1.6rem - 0.4rem);
  padding: 1.15rem 1.25rem;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#tonight { top: 5.4rem; right: 1.2rem; }
#guide { bottom: 6.2rem; right: 1.2rem; max-height: 40dvh; }
#settings {
  bottom: 6.2rem; left: 50%; transform: translateX(-50%) translateY(20px);
  opacity: 0; pointer-events: none; width: 300px;
}
#settings.open { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
#settings label {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem; padding: 0.4rem 0; cursor: pointer;
}
#settings input { accent-color: var(--accent); }
#settings .hint { font-size: 0.72rem; color: var(--txt-dim); margin-top: 0.7rem; line-height: 1.5; }

.eyebrow {
  display: inline-block;
  font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(159,196,255,0.25);
  border-radius: 999px; padding: 0.18rem 0.65rem;
  margin-bottom: 0.85rem;
}

/* Tonight rows */
.row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.32rem 0; font-size: 0.86rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.row:last-child { border-bottom: none; }
.row .k { color: var(--txt-dim); }
.row .v { font-weight: 400; font-variant-numeric: tabular-nums; }
.moon-row .k { color: var(--txt); }
.sub-t {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--txt-dim); margin: 0.9rem 0 0.3rem;
}
.daily-con {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 0.35rem; padding: 0.55rem 0.55rem 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(159,196,255,0.08);
  border: 1px solid rgba(159,196,255,0.2);
  color: var(--txt); font-family: inherit; font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.5s var(--ease), background 0.5s var(--ease);
}
.daily-con:hover { background: rgba(159,196,255,0.16); }
.daily-con:active { transform: scale(0.98); }
.dc-name { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 1.05rem; }
.dc-go {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.5s var(--ease);
}
.daily-con:hover .dc-go { transform: translate(2px, -2px) scale(1.05); }
.dc-arrow { font-size: 0.8rem; }

/* Constellation panel */
#con-panel {
  top: 5.4rem; left: 1.2rem;
  transform: translateX(-24px); opacity: 0; pointer-events: none;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.08), 0 12px 40px rgba(0,0,0,0.35);
}
#con-panel.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
#con-panel h2 {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 1.9rem; line-height: 1.1; margin-bottom: 0.2rem;
}
#con-panel .latin { font-size: 0.78rem; color: var(--txt-dim); margin-bottom: 0.6rem; }
.con-now {
  font-size: 0.8rem; color: var(--accent);
  padding: 0.45rem 0.7rem; border-radius: 0.8rem;
  background: rgba(159,196,255,0.07); border: 1px solid rgba(159,196,255,0.15);
  margin-bottom: 0.8rem;
}
#con-panel .sec { margin-bottom: 0.8rem; }
#con-panel .sec-t {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--txt-dim); margin-bottom: 0.25rem;
}
#con-panel p { font-size: 0.86rem; line-height: 1.55; color: rgba(230,236,250,0.85); }
#con-panel .chip {
  display: inline-block; font-size: 0.75rem;
  padding: 0.3rem 0.7rem; border-radius: 999px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.8rem;
}
#con-panel .x {
  position: absolute; top: 0.9rem; right: 0.9rem;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  color: var(--txt-dim); font-size: 0.8rem; cursor: pointer;
  transition: background 0.4s var(--ease), transform 0.4s var(--ease);
}
#con-panel .x:hover { background: rgba(255,255,255,0.14); }
#con-panel .x:active { transform: scale(0.92); }

/* Guide */
#guide-body details { border-bottom: 1px solid rgba(255,255,255,0.06); }
#guide-body details:last-child { border-bottom: none; }
#guide-body summary {
  font-size: 0.86rem; font-weight: 400; padding: 0.55rem 0;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
#guide-body summary::after {
  content: '+'; color: var(--txt-dim);
  transition: transform 0.5s var(--ease);
}
#guide-body details[open] summary::after { transform: rotate(45deg); }
#guide-body p { font-size: 0.8rem; line-height: 1.55; color: var(--txt-dim); padding-bottom: 0.7rem; }

/* ---- Controls ---- */
#controls {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  z-index: 20;
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.45rem;
  border-radius: 999px;
  max-width: calc(100vw - 1.6rem);
  overflow-x: auto;
  scrollbar-width: none;
}
#controls::-webkit-scrollbar { display: none; }
#controls button {
  flex-shrink: 0;
  font-family: inherit; font-size: 0.8rem; font-weight: 400;
  color: var(--txt-dim);
  background: transparent; border: 1px solid transparent;
  border-radius: 999px; padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: all 0.5s var(--ease);
}
#controls button:hover { color: var(--txt); background: rgba(255,255,255,0.06); }
#controls button:active { transform: scale(0.96); }
#controls button.on {
  color: #0a1020; background: var(--accent);
  box-shadow: 0 0 16px rgba(159,196,255,0.4);
}
#controls .div { width: 1px; height: 1.2rem; background: var(--glass-line); flex-shrink: 0; }
#dt-input {
  font-family: inherit; font-size: 0.75rem;
  color: var(--txt-dim); background: transparent;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 999px;
  padding: 0.4rem 0.7rem;
  color-scheme: dark;
  transition: border-color 0.4s var(--ease);
}
#dt-input:hover, #dt-input:focus { border-color: rgba(159,196,255,0.4); outline: none; color: var(--txt); }

/* ---- Quiz bar ---- */
#quiz-bar {
  position: fixed; top: 5.4rem; left: 50%;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0; pointer-events: none;
  z-index: 25;
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  transition: transform 0.7s var(--ease), opacity 0.7s var(--ease);
  max-width: calc(100vw - 2rem);
}
#quiz-bar.open { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
#quiz-q { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 1.1rem; }
#quiz-fb.ok { color: #7dffb0; font-size: 0.85rem; }
#quiz-fb.ko { color: #ffb37d; font-size: 0.85rem; }
#quiz-bar .score {
  font-size: 0.8rem; color: var(--txt-dim);
  font-variant-numeric: tabular-nums;
}
#quiz-bar button {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  color: var(--txt-dim); font-size: 0.7rem; cursor: pointer;
}

/* ---- AR mode HUD ---- */
#ar-hud { display: none; pointer-events: none; }
#ar-hud.open { display: block; }
#ar-hud .cross {
  position: fixed; top: 50%; left: 50%; z-index: 12;
  width: 26px; height: 26px;
  transform: translate(-50%, -50%);
}
#ar-hud .cross::before, #ar-hud .cross::after {
  content: ''; position: absolute; background: rgba(159,196,255,0.6);
}
#ar-hud .cross::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
#ar-hud .cross::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
#ar-readout {
  position: fixed; bottom: 5.2rem; left: 50%; transform: translateX(-50%);
  z-index: 12;
  padding: 0.35rem 0.95rem; border-radius: 999px;
  font-size: 0.78rem; color: var(--txt-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#ar-hint {
  position: fixed; top: 5.6rem; left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 26;
  max-width: min(420px, calc(100vw - 2rem));
  text-align: center;
  padding: 0.5rem 1.1rem; border-radius: 999px;
  background: rgba(8,12,26,0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(159,196,255,0.25);
  font-size: 0.82rem; color: var(--accent);
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
#ar-hint.open { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Satellite tooltip ---- */
#sat-tip {
  position: fixed; z-index: 28;
  max-width: 220px;
  padding: 0.5rem 0.75rem; border-radius: 0.9rem;
  font-size: 0.76rem; line-height: 1.45; color: var(--txt);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
#sat-tip.open { opacity: 1; }
#sat-tip b { font-weight: 500; color: #ffe3b0; }
#sat-tip i { color: var(--txt-dim); }

/* ---- Mobile ---- */
#mobile-tabs { display: none; }

@media (max-width: 900px) {
  #tonight, #guide, #con-panel {
    left: 50%; right: auto; top: auto;
    bottom: 5.6rem;
    transform: translateX(-50%) translateY(30px);
    width: min(400px, calc(100vw - 1.6rem));
    max-height: 52dvh;
    opacity: 0; pointer-events: none;
  }
  #tonight.open, #guide.open {
    transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto;
  }
  #con-panel.open {
    transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto;
    z-index: 30;
  }
  #tonight.hidden-by-panel { opacity: 0; pointer-events: none; }
  .place { display: none; }
  .date { display: none; }
  #mobile-tabs {
    display: flex; gap: 0.4rem;
    position: fixed; bottom: 4.6rem; left: 50%; transform: translateX(-50%);
    z-index: 14;
  }
  #mobile-tabs button {
    font-family: inherit; font-size: 0.72rem; letter-spacing: 0.08em;
    color: var(--txt-dim);
    background: rgba(8,12,26,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-line);
    border-radius: 999px; padding: 0.4rem 0.9rem;
    cursor: pointer;
  }
  #controls { bottom: 0.8rem; }
  #quiz-bar { top: 4.6rem; flex-wrap: wrap; justify-content: center; border-radius: 1.2rem; }
  #ar-readout { bottom: 7.6rem; }
}
