/* Comet: game-specific styles. */

#game,
#sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- HUD (dock) */

.comet-hud {
  justify-content: space-between;
  gap: 12px;
  align-self: center;
  width: 100%;
  max-width: 640px;
  min-height: 58px;
  padding: 2px 16px 10px;
  pointer-events: none;
}
.hud-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.hud-eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-name {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[lang="ar"] .hud-eyebrow { letter-spacing: 0; text-transform: none; font-size: 12px; }

.hud-pips {
  display: flex;
  align-items: center;
  flex: none;
  gap: 3px;
}
.pip { display: block; width: 15px; height: 15px; }
.pip svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(180, 186, 219, 0.55);
  stroke-width: 1.7;
  stroke-linejoin: round;
  transition: fill 0.25s linear, stroke 0.25s linear;
}
.pip.is-lit svg { fill: var(--gold); stroke: var(--gold); }
.pip.is-next svg {
  fill: rgba(242, 234, 216, 0.22);
  stroke: var(--parchment);
  transform-origin: 50% 50%;
  animation: pip-pulse 1.15s ease-in-out infinite;
}
@keyframes pip-pulse { 50% { transform: scale(1.2); } }
.hud-count {
  display: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
}

@media (max-width: 359px) {
  .comet-hud { padding: 2px 12px 8px; gap: 10px; }
  .pip { width: 12px; height: 12px; }
  .hud-pips { gap: 2px; }
  .hud-name { font-size: 1.1rem; }
}

/* Short landscape phones: the HUD moves into the middle of the top bar so the sky gets the height. */
@media (orientation: landscape) and (max-height: 520px) {
  .comet-hud {
    position: absolute;
    top: var(--safe-t);
    left: 50%;
    z-index: 6;
    height: var(--bar-h);
    min-height: 0;
    width: auto;
    max-width: calc(100% - 430px);
    justify-content: center;
    padding: 0;
    gap: 14px;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
  }
  .hud-name { font-size: 1.1rem; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 699px) {
  .hud-eyebrow, .hud-pips .pip { display: none; }
  .hud-count { display: inline; }
}

/* ---------------------------------------------------------------- constellation figures (SVG) */

.con-svg { display: block; overflow: visible; }
.con-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.3;
  stroke-linecap: round;
  opacity: 0.85;
}
.con-star { fill: var(--mist); opacity: 0.38; }
.con-svg.is-lit .con-star { fill: #FFF7E6; opacity: 1; }
.con-glow { fill: var(--gold); opacity: 0.09; }
.con-glow.t-r { fill: #FF9C7A; }
.con-glow.t-b { fill: var(--sky); opacity: 0.12; }
.con-svg.is-anim .con-line {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation: con-draw 0.55s var(--ease-out) forwards;
}
.con-svg.is-anim .con-star {
  transform-box: fill-box;
  transform-origin: center;
  animation: con-twinkle 0.5s var(--ease-out) both;
}
@keyframes con-draw { to { stroke-dashoffset: 0; } }
@keyframes con-twinkle { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- level card */

.comet-card .fa-panel__art { margin: -6px 0 10px; }
.comet-card .con-line { stroke-width: 1.7; }
.card-sub { margin: -2px 0 10px; color: var(--gold-soft); font-weight: 600; }
.card-sub span { display: inline-block; white-space: nowrap; }
.card-sub span + span::before { content: "\00B7\00A0"; }
/* Long pairs (Ursa Major, the Great Bear / Arabic name) would break awkwardly: give each name its own line. */
.card-sub.is-long span { display: block; }
.card-sub.is-long span + span::before { content: none; }
.card-fact { max-width: 30em; margin: 0 auto; color: var(--mist); text-wrap: pretty; }

/* ---------------------------------------------------------------- start & game over */

.start-art { display: block; width: 220px; max-width: 72%; height: auto; }
@media (max-height: 700px) { .start-art { width: 170px; } }
@media (max-height: 600px) { .start-art { width: 130px; } }
.comet-resume .fa-panel__text { white-space: pre-line; }
.over-traced { margin: -2px auto 0; max-width: 28em; color: var(--mist); font-size: 0.93rem; text-wrap: pretty; }

/* ---------------------------------------------------------------- star atlas */

.comet-atlas .fa-panel { max-width: 420px; }
.atlas { display: grid; gap: 8px; text-align: start; }
.atlas-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  background: rgba(242, 234, 216, 0.04);
}
[dir="rtl"] .atlas-row { padding: 8px 8px 8px 12px; }
.atlas-row.is-traced {
  background: rgba(232, 182, 90, 0.07);
  box-shadow: inset 0 0 0 1px rgba(232, 182, 90, 0.18);
}
.atlas-fig { flex: none; width: 76px; height: 64px; }
.atlas-text { flex: 1 1 auto; min-width: 0; }
.atlas-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.2;
}
.atlas-row:not(.is-traced) .atlas-name { color: var(--mist); }
.atlas-times { flex: none; font-family: var(--font-text); font-size: 12px; font-weight: 700; color: var(--gold); }
.atlas-alt { font-size: 0.86rem; color: var(--gold-soft); }
.atlas-fact { margin-top: 2px; font-size: 0.82rem; line-height: 1.4; color: var(--mist); }

/* ---------------------------------------------------------------- short landscape phones */
/* Start, card, resume and game-over panels must show their main button without scrolling (740x360). */
@media (orientation: landscape) and (max-height: 520px) {
  .comet-start .fa-panel,
  .comet-card .fa-panel,
  .comet-over .fa-panel,
  .comet-resume .fa-panel { max-width: 520px; padding: 14px 22px 14px; }
  .comet-start .start-art,
  .comet-resume .start-art { display: none; }
  .comet-card .fa-panel__art { margin: -2px 0 2px; }
  .comet-card .con-svg { width: auto; height: 62px; }
  .comet-start .fa-panel__title,
  .comet-card .fa-panel__title,
  .comet-over .fa-panel__title,
  .comet-resume .fa-panel__title { margin: 2px 0 6px; font-size: 1.55rem; }
  .comet-start .fa-panel__body,
  .comet-over .fa-panel__body,
  .comet-card .fa-panel__body,
  .comet-card .fa-stats,
  .comet-over .fa-stats,
  .comet-resume .fa-panel__text { margin-bottom: 10px; }
  .card-sub { margin-bottom: 4px; }
  .card-sub.is-long span { display: inline-block; }
  .card-sub.is-long span + span::before { content: "\00B7\00A0"; }
  .card-fact, .over-traced { font-size: 0.86rem; line-height: 1.4; }
  .comet-start .fa-btn,
  .comet-card .fa-btn,
  .comet-over .fa-btn,
  .comet-resume .fa-btn { min-height: 44px; padding-top: 0.55em; padding-bottom: 0.55em; }
  .comet-start .fa-panel__actions,
  .comet-card .fa-panel__actions,
  .comet-over .fa-panel__actions,
  .comet-resume .fa-panel__actions { gap: 8px; }
}
