/* Underdogs Stage 1 — dark three-column compatibility shell */

/* The application retains its full-viewport classic-script DOM contract.
   Ambient layers remain the only dynamic wallpaper paint surface. */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: var(--pb-viewport-height);
  max-height: var(--pb-viewport-height);
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 12%, rgba(53, 18, 110, .16), transparent 36%),
    transparent;
}

/* Overlay, toast and day-banner hosts stay outside the flex flow. */
#app > *:not(.overlay):not(.toast-wrap):not(#day-banner) {
  position: relative;
}

/* ---------- premium operational header ---------- */
.hud {
  position: relative;
  z-index: 30;
  display: flex;
  height: var(--header-height);
  min-height: var(--header-height);
  flex: 0 0 var(--header-height);
  align-items: center;
  gap: clamp(12px, 1.4vw, 22px);
  padding: 0 clamp(14px, 1.5vw, 26px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 6, .96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hud::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: -1px;
  left: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 76, 242, .7), transparent);
  pointer-events: none;
}

.hud-identity {
  display: inline-flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-card);
  transition:
    border-color .16s ease,
    background .16s ease,
    transform .09s ease;
}

.hud-identity:hover {
  border-color: var(--line);
  background: rgba(167, 134, 255, .07);
}

.hud-identity:active { transform: scale(.97); }

.hud-identity .hud-crest {
  width: clamp(30px, 2.3vw, 36px);
  height: auto;
  flex: 0 0 auto;
}

.hud-club-name {
  position: relative;
  display: block;
  height: clamp(22px, 1.7vw, 28px);
  max-width: 154px;
}

.hud-club-name img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

.hud-club-name::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--purple);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .22s cubic-bezier(.2, .76, .24, 1);
}

.hud-identity:hover .hud-club-name::after { transform: scaleX(1); }

/* ---------- shared unread badge ---------- */
.unread-badge {
  position: absolute;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 1.5px solid var(--black-raised);
  border-radius: var(--r-pill);
  background: var(--red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .34);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.unread-badge.on-icon {
  top: -6px;
  right: -6px;
}

.hud-continue {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
}

.btn-continue,
.dashboard-action {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 18px;
  overflow: hidden;
  border: 1px solid rgba(167, 134, 255, .62);
  border-radius: var(--r-card);
  box-shadow:
    inset 0 1px 0 rgba(245, 243, 239, .16),
    0 8px 20px rgba(53, 18, 110, .28);
  font-family: var(--font-mono);
  font-size: .82em;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition:
    transform .08s ease,
    filter .12s ease,
    box-shadow .15s ease;
}

.btn-continue {
  flex: 0 0 auto;
  justify-content: center;
  background: linear-gradient(180deg, var(--purple-bright), var(--purple));
  color: var(--black);
}

.btn-continue:hover,
.dashboard-action:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(245, 243, 239, .2),
    0 10px 28px rgba(122, 76, 242, .34);
  transform: translateY(-1px);
}

.btn-continue:active,
.dashboard-action:active {
  transform: translateY(0) scale(.96);
}

/* Match-day and invitation states retain their existing selectors and
   behaviour; only the compatibility-shell presentation changes. */
.btn-continue.matchday {
  background: linear-gradient(180deg, var(--purple-bright), var(--purple));
  box-shadow:
    0 0 0 1px var(--purple-bright),
    0 0 24px rgba(122, 76, 242, .48);
  animation: pbContinueLand .55s cubic-bezier(.34, 1.4, .64, 1) 1;
}

@keyframes pbContinueLand {
  0% { transform: scale(.96); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.btn-continue.matchday::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 25%,
    rgba(245, 243, 239, .48) 50%,
    transparent 75%
  );
  pointer-events: none;
  transform: translateX(-120%);
  animation: pbContinueSweep 1.2s ease-out .35s 1 forwards;
}

@keyframes pbContinueSweep {
  to { transform: translateX(120%); }
}

.btn-continue.invite-pending {
  border-color: var(--purple-bright);
  background: rgba(122, 76, 242, .18);
  box-shadow: 0 0 0 1px rgba(167, 134, 255, .12);
  color: var(--purple-bright);
  cursor: pointer;
}

.btn-continue.invite-pending:hover { filter: brightness(1.08); }

/* ---------- three-column application grid ---------- */
.main {
  --shell-border: var(--line);
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 0;
  max-height: 100%;
  flex: 1 1 auto;
  grid-template-columns:
    clamp(240px, 17vw, 260px)
    minmax(0, 1fr)
    clamp(288px, 20vw, 320px);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--dashboard-gutter);
  padding: var(--dashboard-edge);
  overflow: hidden;
  background:
    linear-gradient(rgba(167, 134, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 134, 255, .018) 1px, transparent 1px);
  background-size: 64px 64px;
}

.col {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: var(--dashboard-gutter);
  overflow-y: hidden;
}

.messenger {
  grid-column: 2;
  grid-row: 1;
}

.col-right {
  display: flex;
  max-height: 100%;
  align-self: stretch;
  grid-column: 3;
  grid-row: 1;
  flex-direction: column;
  overflow-y: hidden;
}

.col-right .dashboard-panel {
  min-height: 0;
  max-height: 100%;
  flex: 1 1 auto;
}

/* ---------- permanent contact rail ---------- */
.people-rail {
  --rail-line: var(--line-subtle);
  display: flex;
  min-width: 0;
  min-height: 0;
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  contain: layout;
  padding: var(--dashboard-card-padding);
  border: 1px solid var(--shell-border);
  border-radius: var(--r-panel);
  background: var(--panel-contact);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(var(--panel-blur));
  -webkit-backdrop-filter: blur(var(--panel-blur));
}

.rail-list {
  --rail-avatar-size: clamp(36px, calc(8.2vh - 26px), 44px);
  --rail-row-inset-y: 6px;
  --rail-row-inset-x: 10px;
  --rail-card-height: calc(var(--rail-avatar-size) + var(--rail-row-inset-y) * 2);
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  padding-bottom: 0;
}

/* Compact desktop shell: preserve a usable Messenger while reducing the
   permanent companions. The contextual sidecar remains inside column two,
   so this grid cannot create horizontal page overflow. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .main {
    grid-template-columns:
      clamp(206px, 18vw, 228px)
      minmax(0, 1fr)
      240px;
    gap: 8px;
    padding: 8px;
  }

  .people-rail { padding: 9px; }

  .hud {
    gap: 10px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .hud-identity { padding-right: 6px; }
  .hud-club-name { max-width: 126px; }
  .hud-cal-viewport { width: min(330px, 35vw); }
}

@media (min-width: 1024px) and (max-width: 1100px) {
  .hud-cal-viewport { width: 250px; }

  .meetup-prompt-row {
    grid-auto-flow: row;
    grid-template-columns: 1fr 1fr;
    grid-auto-columns: auto;
  }

  .hud-date #status-season,
  .hud-date .hud-date-sep:last-of-type {
    display: none;
  }
}
