/* galaxy-map.css - Styles for the Constellation Map view */

.mt-galaxy-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mt-galaxy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mt-galaxy-header h2 {
  margin: 0 0 4px;
}

.mt-galaxy-header p {
  color: var(--text-muted, #64748b);
  margin: 0;
}

.mt-galaxy-canvas-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#mtGalaxyCanvas {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.mt-galaxy-infobox {
  position: absolute;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mt-galaxy-card-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mt-galaxy-card-icon {
  font-size: 2.2rem;
}

.mt-galaxy-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.mt-galaxy-card p {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
}

.mt-galaxy-card button {
  margin-left: auto;
  white-space: nowrap;
}

/* real-mastery version (24 Oct 2026): legend, text list, line icon, phone layout */
.mt-galaxy-infobox[hidden] { display: none; }
.mt-galaxy-header { flex-wrap: wrap; gap: 10px; }
#mtGalaxyCanvas { cursor: default; }
.mt-galaxy-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .85rem; color: var(--ink-soft, #46546a); }
.mt-galaxy-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.mt-galaxy-legend .is-dim { background: rgba(96, 165, 250, .45); }
.mt-galaxy-legend .is-mid { background: #60a5fa; }
.mt-galaxy-legend .is-gold { background: #fbbf24; }
.mt-galaxy-list { background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px var(--line, #e1e6ee); padding: 12px 16px; }
.mt-galaxy-list summary { cursor: pointer; font-weight: 600; }
.mt-galaxy-list h3 { font-size: .95rem; margin: 12px 0 6px; }
.mt-galaxy-list ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.mt-galaxy-list li span { color: var(--ink-soft, #46546a); }
.mt-galaxy-card-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #e9eef7; color: #1f3a68; font-size: 1rem; }
.mt-galaxy-card-icon svg { width: 26px; height: 26px; }
@media (max-width: 600px) { .mt-galaxy-card-inner { flex-wrap: wrap; } .mt-galaxy-card button { margin-left: 0; } }
.mt-galaxy-card-inner { flex-wrap: wrap; }
.mt-galaxy-card-inner > div { flex: 1 1 160px; min-width: 0; }

/* all-courses view: course buttons and the text list */
.mt-galaxy-courses { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-galaxy-list .link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--violet, #1f3a68); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }

/* ---------- Galaxy mode on Subjects & topics (one course): regions = terms, stars = topics, moons = subtopics */
.gx { --subj: #60a5fa; --gold: #fbbf24; }
.gx-subj-english { --subj: #5eead4; }
.gx-subj-science { --subj: #86efac; }
.gx-subj-pshe { --subj: #d8b4fe; }

.gx-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; margin-bottom: 14px; }
.gx-head-text { flex: 1 1 320px; min-width: 0; }
.gx-head-text h2 { margin: 0 0 6px; }
.gx-head-text p { margin: 0; color: var(--ink-soft, #46546a); max-width: 62ch; }
.gx-head-text .gx-note { margin-top: 8px; font-size: .88rem; color: var(--muted, #5f6b7d); }
.gx-head-side { flex: 0 1 280px; display: grid; gap: 8px; justify-items: start; }
.gx-head-side .st-bar { width: 100%; }
.gx-head-side p { margin: 0; font-size: .9rem; color: var(--ink-soft, #46546a); }
.gx-head-side .btn { white-space: normal; text-align: left; }

.gx-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; font-size: .84rem; color: var(--ink-soft, #46546a); }
.gx-legend span { display: inline-flex; align-items: center; gap: 7px; }
.gx-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #94a3b8; }
.gx-key-new { background: #94a3b8; opacity: .7; }
.gx-key-going { background: var(--subj); box-shadow: 0 0 0 1px rgba(15, 23, 42, .25); }
.gx-key-secure { background: var(--gold); box-shadow: 0 0 0 1px rgba(122, 90, 0, .35); }
.gx-subj-pshe .gx-key-secure { background: var(--subj); }
.gx-key-next { background: none; border: 2px solid #d9a400; width: 14px; height: 14px; }
.gx-key-lit { border-radius: 4px; background: #24325a; box-shadow: 0 0 0 1px #8b9cf8, 0 0 8px 2px rgba(139, 156, 248, .7); }

.gx-layout { display: block; }
.gx-map { container: gxmap / inline-size; }
.gx-regions { --top: 82px; --row: 80px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@container gxmap (min-width: 640px) {
  .gx-regions { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); --row: 86px; }
}

/* a term's region: a nebula whose strength follows the term's mastery (--b, 0 to 1) */
.gx-region {
  --neb: 96, 165, 250; --neb2: 129, 140, 248;
  position: relative; overflow: hidden; border-radius: var(--r-lg, 14px);
  min-height: calc(var(--top) + var(--n, 1) * var(--row) + 8px);
  background-color: #070c18;
  background-image:
    radial-gradient(ellipse 85% 55% at 50% 42%, rgba(var(--neb), calc(.07 + var(--b, 0) * .34)), transparent 72%),
    radial-gradient(ellipse 55% 40% at 22% 78%, rgba(var(--neb2), calc(.05 + var(--b, 0) * .24)), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(1px 1px at 82% 9%, rgba(255, 255, 255, .45), transparent 60%),
    radial-gradient(1.4px 1.4px at 64% 36%, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(1px 1px at 36% 61%, rgba(255, 255, 255, .45), transparent 60%),
    radial-gradient(1px 1px at 90% 72%, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(1.2px 1.2px at 8% 90%, rgba(255, 255, 255, .4), transparent 60%),
    linear-gradient(180deg, #0b1324, #050811);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 26px rgba(5, 8, 17, .25);
  transition: box-shadow .5s ease;
}
.gx-term-autumn { --neb: 251, 146, 60; --neb2: 244, 114, 182; }
.gx-term-spring { --neb: 45, 212, 191; --neb2: 96, 165, 250; }
.gx-term-summer { --neb: 129, 140, 248; --neb2: 192, 132, 252; }
/* lit up: most of the term's topics are Secure */
.gx-region.is-lit { box-shadow: 0 0 0 1px rgba(var(--neb), .6), 0 0 34px rgba(var(--neb), .35), inset 0 0 70px rgba(var(--neb), .2); }

.gx-region-head { position: relative; z-index: 1; padding: 14px 16px 0; }
.gx-region-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: #cfd8e6; }
.gx-region-head p { margin: 3px 0 0; font-size: .8rem; color: #9fb0c6; }
.gx-region.is-lit .gx-region-head h3 { color: #fff; text-shadow: 0 0 14px rgba(var(--neb), .95); }
.gx-region.is-lit .gx-region-head p { color: #e2e8f0; }

.gx-lines { position: absolute; left: 0; width: 100%; top: calc(var(--top) + 14px); height: calc((var(--n, 1) - 1) * var(--row)); overflow: visible; pointer-events: none; }
.gx-lines polyline { fill: none; stroke: rgba(var(--neb), calc(.22 + var(--b, 0) * .45)); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

.gx-stars { list-style: none; margin: 0; padding: 0; }
.gx-li { position: absolute; z-index: 1; left: var(--x, 50%); top: calc(var(--top) + var(--i, 0) * var(--row)); width: 46%; transform: translateX(-50%); }

/* a topic's star: a real button holding the dot and the topic's name */
.gx-star {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px;
  margin: 0; padding: 0 2px 4px; border: 0; border-radius: 10px; background: none; color: inherit;
  font: inherit; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gx-star:focus { outline: none; }
.gx-star:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(96, 165, 250, .55); }
.gx-dot { position: relative; flex: none; width: 28px; height: 28px; display: grid; place-items: center; }
.gx-core {
  width: calc(9px + var(--lv, 0) * 10px); height: calc(9px + var(--lv, 0) * 10px); border-radius: 50%;
  background: var(--subj); box-shadow: 0 0 calc(5px + var(--lv, 0) * 14px) calc(var(--lv, 0) * 3px) var(--subj);
  transition: transform .2s ease;
}
.gx-star.is-new .gx-core { background: #94a3b8; opacity: .62; box-shadow: none; }
.gx-star.is-secure .gx-core { background: var(--gold); box-shadow: 0 0 18px 4px rgba(251, 191, 36, .7); }
.gx-subj-pshe .gx-star.is-secure .gx-core { background: var(--subj); box-shadow: 0 0 14px 3px var(--subj); }
.gx-star:hover .gx-core { transform: scale(1.18); }
.gx-star.is-selected .gx-dot::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; border: 2px solid #fff; }

.gx-name {
  max-width: 100%; font-size: .78rem; line-height: 1.3; font-weight: 500; color: #d3dbe7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.gx-star:hover .gx-name, .gx-star.is-selected .gx-name, .gx-star.is-secure .gx-name { color: #fff; }
.gx-star:hover .gx-name { text-decoration: underline; text-underline-offset: 2px; }

/* the suggested next topic: a ring that pulses gently (still when motion is reduced) */
.gx-ring { position: absolute; inset: -5px; border-radius: 50%; border: 2px solid rgba(253, 224, 71, .85); pointer-events: none; }
.gx-ring::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(253, 224, 71, .7); animation: gxPulse 2.8s ease-out infinite; }
@keyframes gxPulse { 0% { transform: scale(.85); opacity: .9; } 70% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1.6); opacity: 0; } }
.gx-next-tag {
  position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%);
  padding: 1px 7px; border-radius: 99px; background: #fde68a; color: #3d2c00;
  font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}

/* subtopics orbiting a chosen star */
.gx-orbit { position: absolute; inset: 0; pointer-events: none; }
.gx-orbit-ring { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px dashed rgba(226, 232, 240, .35); }
.gx-moon { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #64748b; animation: gxMoonIn .45s ease-out var(--d, 0ms) both; }
.gx-moon.gx-lv-1 { background: #93c5fd; }
.gx-moon.gx-lv-2 { background: #86efac; box-shadow: 0 0 5px #86efac; }
.gx-moon.gx-lv-3 { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
@keyframes gxMoonIn { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }

/* the topic panel: beside the map on wide screens, a floating card on laptops, a bottom sheet on phones */
.gx-panel { background: #fff; border: 1px solid var(--line, #e1e6ee); border-radius: var(--r-lg, 14px); box-shadow: var(--shadow-md); padding: 18px; color: var(--ink, #1b2537); }
.gx-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gx-panel h3 { margin: 0; font-size: 1.15rem; }
.gx-kicker { margin: 0 0 3px; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--muted, #5f6b7d); }
.gx-intro { margin: 10px 0 0; font-size: .9rem; color: var(--ink-soft, #46546a); }
.gx-prog { display: grid; gap: 6px; margin: 12px 0 4px; font-size: .86rem; color: var(--ink-soft, #46546a); }
.gx-subs { list-style: none; margin: 12px 0 14px; padding: 0; display: grid; gap: 6px; }
.gx-sub {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 0;
  background: #f7f9fc; border: 1px solid var(--line, #e1e6ee); border-radius: var(--r-md, 10px);
  font: inherit; color: var(--ink, #1b2537); text-align: left; cursor: pointer;
}
.gx-sub:hover { border-color: var(--violet, #1f3a68); background: #fff; }
.gx-sub-title { flex: 1; min-width: 0; font-size: .9rem; font-weight: 500; }
.gx-sub-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #c3cad5; }
.gx-sub-dot.gx-lv-1 { background: #3b6fb6; }
.gx-sub-dot.gx-lv-2 { background: #2d7a55; }
.gx-sub-dot.gx-lv-3 { background: #c9a227; }
.gx-panel-empty p { margin: 8px 0 12px; color: var(--ink-soft, #46546a); font-size: .9rem; }
.gx-panel h3:focus { outline: none; }
.gx-panel h3:focus-visible { outline: 2px solid var(--sea, #2b6cb0); outline-offset: 3px; border-radius: 4px; }

@media (min-width: 1300px) {
  .gx-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
  .gx-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}
@media (max-width: 1299.98px) {
  .gx-panel {
    position: fixed; z-index: 26; right: 24px; bottom: 24px; width: min(390px, calc(100vw - 48px));
    max-height: min(72vh, 600px); overflow: auto; box-shadow: var(--shadow-lg);
    transform: translateY(calc(100% + 40px)); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
  }
  .gx-panel.is-open { transform: none; visibility: visible; transition: transform .25s ease; }
}
@media (max-width: 860px) {
  .gx-panel {
    left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .gx-panel::before { content: ""; display: block; width: 40px; height: 4px; margin: -6px auto 12px; border-radius: 99px; background: #d5dbe4; }
  .gx-head-side { flex-basis: 100%; }
}

.gx-textlist { margin-top: 14px; }
.gx-textlist summary { cursor: pointer; font-weight: 600; }
.gx-textlist h3 { margin: 14px 0 6px; font-size: .95rem; }
.gx-textlist h3 small { font-weight: 400; color: var(--muted, #5f6b7d); }
.gx-textlist ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.gx-textlist li span { color: var(--ink-soft, #46546a); }
.gx-link { background: none; border: 0; padding: 0; font: inherit; color: var(--violet, #1f3a68); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  .gx-ring::after { animation: none; display: none; }
  .gx-moon { animation: none; }
  .gx-core, .gx-region { transition: none; }
  .gx-panel, .gx-panel.is-open { transition: none; }
}
