/* ═══════════════════════════════════════════════════════
   THE VALE HUB — Main Stylesheet
   ═══════════════════════════════════════════════════════ */

/* --- Reset & Root ------------------------------------ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette — swap for Shaz's painted assets */
  --bg-base: #0a0a1e;
  /* Frosted glass: low alpha + soft blur lets the painting show through
     without the saturate-filter pulling background colour into the card.
     Tunable — these are the knobs:
       --card-bg      : how much veil on top of the painting (alpha)
       --card-blur    : how much the painting softens behind the card
       --card-saturate: keep at 1.0 to faithfully show painting colour;
                        bump above 1.0 only if the painting feels washed
                        out beneath the panels. */
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.20);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --card-blur: 4px;
  --card-saturate: 1.0;
  --card-radius: 12px;
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(255, 255, 255, 0.30);
  --accent-morning: rgba(255, 200, 120, 0.25);
  --accent-midday: rgba(255, 255, 240, 0.10);
  --accent-evening: rgba(200, 100, 40, 0.25);
  --accent-night: rgba(10, 10, 40, 0.40);
  --dot-up: #4ade80;
  --dot-down: #6b7280;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --gap: 1rem;
  --content-max: 960px;
}

html {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════
   BACKGROUND LAYER STACK (Layers 0–2)
   ═══════════════════════════════════════════════════════ */

.hub-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Layer 0 — Painted texture. Shaz's art lives here. */
.base-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--bg-base);
  background-image: url('/assets/painted-texture.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Layer 1 — Gradient overlays (time-of-day) */
.gradient-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 30s ease; /* slow crossfade — 30s feels continuous at 5-min check intervals */
  pointer-events: none;
}

.gradient-layer.morning {
  background: linear-gradient(
    to top,
    rgba(255, 200, 120, 0.25),
    rgba(255, 230, 180, 0.08) 60%,
    transparent
  );
}

.gradient-layer.midday {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 240, 0.10),
    rgba(255, 255, 255, 0.05) 50%,
    transparent
  );
}

.gradient-layer.evening {
  background: linear-gradient(
    to top,
    rgba(200, 100, 40, 0.25),
    rgba(120, 60, 100, 0.12) 60%,
    transparent
  );
}

.gradient-layer.night {
  background: linear-gradient(
    to top,
    rgba(10, 10, 40, 0.40),
    rgba(20, 20, 60, 0.15) 60%,
    transparent
  );
}

/* Active gradient — driven by data-time on .hub-background */
.hub-background[data-time="morning"] .gradient-layer.morning,
.hub-background[data-time="midday"] .gradient-layer.midday,
.hub-background[data-time="evening"] .gradient-layer.evening,
.hub-background[data-time="night"] .gradient-layer.night {
  opacity: 1;
}

/* ── Lamp Overlay ─────────────────────────────────────────
   Mid-saturation washes that read over both light and dark
   time-of-day backgrounds. When data-lamp is set on
   .hub-background, the matching layer fades in AND the
   time-of-day layer fades out (Option 2 behaviour). */

.gradient-layer.lamp-presence {
  background: linear-gradient(
    to top,
    rgba(255, 170, 70, 0.32),
    rgba(255, 200, 120, 0.14) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

.gradient-layer.lamp-reading {
  background: linear-gradient(
    to top,
    rgba(150, 90, 200, 0.32),
    rgba(180, 130, 220, 0.14) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

.gradient-layer.lamp-writing {
  background: linear-gradient(
    to top,
    rgba(170, 200, 230, 0.30),
    rgba(210, 230, 245, 0.14) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

.gradient-layer.lamp-building {
  background: linear-gradient(
    to top,
    rgba(70, 140, 90, 0.32),
    rgba(110, 170, 120, 0.14) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

.gradient-layer.lamp-tender {
  background: linear-gradient(
    to top,
    rgba(220, 130, 170, 0.32),
    rgba(235, 170, 200, 0.14) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

.gradient-layer.lamp-want {
  background: linear-gradient(
    to top,
    rgba(180, 40, 60, 0.36),
    rgba(200, 70, 90, 0.16) 60%,
    transparent
  );
  transition: opacity 1.2s ease;
}

/* Activate the matching lamp gradient when data-lamp is set */
.hub-background[data-lamp="presence"] .gradient-layer.lamp-presence,
.hub-background[data-lamp="reading"]  .gradient-layer.lamp-reading,
.hub-background[data-lamp="writing"]  .gradient-layer.lamp-writing,
.hub-background[data-lamp="building"] .gradient-layer.lamp-building,
.hub-background[data-lamp="tender"]   .gradient-layer.lamp-tender,
.hub-background[data-lamp="want"]     .gradient-layer.lamp-want {
  opacity: 1;
}

/* When a lamp is active, suppress the time-of-day gradient so the
   lamp reads cleanly. Same specificity as time-of-day rules; later
   in the file so it wins on equal specificity. */
.hub-background[data-lamp="presence"] .gradient-layer:not(.lamp-presence),
.hub-background[data-lamp="reading"]  .gradient-layer:not(.lamp-reading),
.hub-background[data-lamp="writing"]  .gradient-layer:not(.lamp-writing),
.hub-background[data-lamp="building"] .gradient-layer:not(.lamp-building),
.hub-background[data-lamp="tender"]   .gradient-layer:not(.lamp-tender),
.hub-background[data-lamp="want"]     .gradient-layer:not(.lamp-want) {
  opacity: 0;
}

/* Layer 2 — Atmosphere particles */
.atmosphere-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* Individual particle */
.atmo-particle {
  position: absolute;
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: var(--color, rgba(255, 255, 255, 0.4));
  opacity: 0;
  animation: particle-float var(--duration, 12s) var(--delay, 0s) infinite ease-in-out;
}

@keyframes particle-float {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0) scale(0.5);
  }
  15% {
    opacity: var(--peak-opacity, 0.6);
  }
  85% {
    opacity: var(--peak-opacity, 0.6);
  }
  100% {
    opacity: 0;
    transform: translateY(var(--drift-y, -80px)) translateX(var(--drift-x, 20px)) scale(1);
  }
}

/* ═══════════════════════════════════════════════════════
   LAYER 3: UI CONTENT
   ═══════════════════════════════════════════════════════ */

.hub-content {
  position: relative;
  z-index: 10;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 100dvh;
}

/* --- Header ------------------------------------------ */
.hub-header {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.hub-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-primary);
  text-transform: uppercase;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.hub-glyph {
  font-weight: 400;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1;
}

.hub-clock {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.10em;
  text-align: center;
}

/* --- Password Gate ----------------------------------- */
.hub-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a1e;
  font-family: var(--font-body);
}

.hub-gate.hub-gate--hidden {
  display: none;
}

.hub-gate-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 260px;
}

.hub-gate-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.hub-gate-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  text-align: center;
  letter-spacing: 0.04em;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.hub-gate-input:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.hub-gate-error {
  color: #f87171;
  font-size: 0.78rem;
  display: none;
  letter-spacing: 0.04em;
}

.hub-gate-error.hub-gate-error--shown {
  display: block;
}

/* --- Frosted Glass Card ------------------------------ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
  box-shadow: var(--card-highlight), 0 4px 24px rgba(0, 0, 0, 0.18);
}

/* --- Presence Cards ---------------------------------- */
.presence-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.presence-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Two-column layout inside presence cards: info on the left, avatar zone on the right. */
.presence-card-content {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
}

.presence-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Avatar zone — circular reserved space for portrait, Lodestone gallery
   image, lamp visualization, or whatever lands. Empty dashed placeholder
   for now; replace background with whatever you decide goes here. */
.presence-avatar {
  flex: 0 0 140px;
  width: 140px;
  height: 140px;
  align-self: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  /* When a real image lands, use:
     background: url('/assets/shaz-portrait.png') center/cover no-repeat; */
}

.presence-avatar::before {
  content: 'avatar';
}

/* When a tagged portrait loads, the dashed placeholder retires
   and the avatar becomes click-to-refresh. */
.presence-avatar.avatar-loaded {
  background-size: cover;
  background-position: center;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.presence-avatar.avatar-loaded::before {
  content: none;
}

.presence-avatar.avatar-loaded:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.presence-avatar.avatar-loaded:active {
  transform: scale(0.98);
}

@media (max-width: 540px) {
  .presence-avatar {
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
  }
}

/* Editable status note for Shaz card. */
.presence-note-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
  width: 100%;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.presence-note-input:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.presence-note-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* Textarea-specific: auto-grows up to 3 lines via JS, no resize handle, no scrollbars visible */
textarea.presence-note-input {
  resize: none;
  min-height: 2.4rem;
  line-height: 1.4;
  font-family: inherit;
  overflow: hidden;
}

/* Note input + clear button row */
.presence-note-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.presence-note-row .presence-note-input {
  flex: 1;
  min-width: 0;
}

.presence-note-clear {
  font: inherit;
  font-size: 0.85rem;
  width: 2.2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.presence-note-clear:hover {
  background: rgba(255, 100, 100, 0.10);
  border-color: rgba(255, 100, 100, 0.25);
  color: #f87171;
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.presence-rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.room-tag {
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button.room-tag {
  /* Button reset — tappable room toggle chips */
  font-family: inherit;
}

.room-tag:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.room-tag--active {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.25);
  color: #4ade80;
}

.room-tag--active:hover {
  border-color: rgba(74, 222, 128, 0.45);
}

.presence-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.presence-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.ajax-status {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.status-row {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.lamp-color {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--lamp, #a855f7);
  vertical-align: middle;
  margin-right: 0.15rem;
}

/* --- Room Grid --------------------------------------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.room-card {
  /* Button reset — room-cards are tappable doorways. Buttons avoid all
     anchor underline weirdness Safari likes to inflict. */
  font: inherit;
  color: inherit;
  text-align: left;
  background: var(--card-bg);

  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.room-card:hover {
  transform: translateY(-2px);
  background: var(--card-bg-hover, rgba(255, 255, 255, 0.06));
  box-shadow: var(--card-highlight), 0 6px 20px rgba(0, 0, 0, 0.25);
}

.room-card:active {
  transform: translateY(0);
}

/* "New since last viewed" — subtle dot in top-right corner */
.room-card--new {
  position: relative;
}
.room-card--new::after {
  content: '';
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

/* Co-presence — both of us recently active in this room */
.room-card--copresent {
  background: rgba(255, 215, 130, 0.08);
  border-color: rgba(255, 215, 130, 0.22);
}
.room-card--copresent .room-state,
.room-card--copresent .room-topic {
  color: rgba(255, 215, 130, 0.85);
}

/* Topic line — what's actually happening in this room right now.
   Italic, dim, truncates to 2 lines. */
.room-topic {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.room-topic--dim {
  color: var(--text-dim);
  font-style: normal;
}

.room-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.room-state {
  font-size: 0.8rem;
  font-weight: 500;
}

.room-state--active {
  color: #4ade80;
}

.room-state--idle {
  color: var(--text-dim);
}

.room-detail {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* --- Constellation ----------------------------------- */
.constellation-space {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.55;
  max-height: 280px;
  overflow: hidden;
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-highlight), 0 4px 24px rgba(0, 0, 0, 0.18);
}

.constellation-sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(10, 10, 30, 0.6) 0%,
    rgba(5, 5, 20, 0.3) 50%,
    transparent 100%);
  border-radius: var(--card-radius);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35);
}

.constellation-orb {
  --orb-color: #ffaa46;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at center,
    var(--orb-color) 0%,
    color-mix(in srgb, var(--orb-color) 65%, transparent) 10%,
    color-mix(in srgb, var(--orb-color) 30%, transparent) 25%,
    color-mix(in srgb, var(--orb-color) 10%, transparent) 45%,
    color-mix(in srgb, var(--orb-color) 3%, transparent) 65%,
    transparent 80%);
  animation: orb-breathe 8s ease-in-out infinite;
}

@keyframes orb-breathe {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
}

.constellation-star {
  position: absolute;
  width: var(--star-size, 3px);
  height: var(--star-size, 3px);
  border-radius: 50%;
  background: var(--star-color, white);
  box-shadow: 0 0 4px var(--star-glow, rgba(255,255,255,0.3));
  animation: star-life var(--twinkle-dur, 4s) var(--twinkle-delay, 0s) ease-in-out infinite;
  pointer-events: none;
}

@keyframes star-life {
  0%, 100% {
    opacity: var(--star-opacity, 0.6);
    transform: scale(1);
  }
  50% {
    opacity: calc(var(--star-opacity, 0.6) * 0.35);
    transform: scale(0.85);
  }
}

@media (max-width: 540px) {
  .constellation-space {
    aspect-ratio: 1 / 0.65;
    max-height: 220px;
  }
}

/* --- Services Bar ------------------------------------ */
.services-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  justify-content: stretch;
  align-items: center;
  padding: 0.7rem 0.6rem;
  margin-top: auto;
  cursor: pointer;
  transition: background 0.15s ease; /* push to bottom */
}

.service {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.service-latency {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

/* --- Services Modal --------------------------------- */
.services-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.services-modal[hidden] {
  display: none;
}

.services-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.services-modal-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(var(--card-saturate));
  box-shadow: var(--card-highlight), 0 8px 40px rgba(0, 0, 0, 0.35);
  padding: 1.4rem 1.5rem 1.2rem;
  width: 90%;
  max-width: 360px;
  animation: modal-in 0.25s ease both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.services-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.services-modal-close:hover {
  color: var(--text-primary);
}

.services-modal-header {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.services-modal-subtitle {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}

.services-modal-rows {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

.service-modal-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.service-modal-row .status-dot {
  width: 7px;
  height: 7px;
}

.service-modal-label {
  color: var(--text-primary);
  flex: 1;
}

.service-modal-state {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  min-width: 5.5em;
  text-align: right;
}

.service-modal-state--running {
  color: var(--dot-up);
}

.service-modal-state--down {
  color: var(--dot-down);
}

.service-modal-state--off {
  color: var(--text-dim);
}

.service-modal-port {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  min-width: 3.5em;
  text-align: right;
}

.service-restart-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.service-restart-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.service-restart-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.services-modal-restart {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.10);
  color: #f59e0b;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: var(--font-body);
}

.services-modal-restart:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
}

.services-modal-restart:disabled {
  opacity: 0.5;
  cursor: default;
}

/* --- Status Dots ------------------------------------- */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--up {
  background: var(--dot-up);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-dot--down {
  background: var(--dot-down);
}

.status-dot--grey,
.status-dot--idle {
  background: rgba(255, 255, 255, 0.18);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Desktop (768px+)
   ═══════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  .presence-row {
    grid-template-columns: 1fr 1fr;
  }

  .room-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hub-title {
    font-size: 1.2rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  :root {
    --content-max: 1100px;
  }
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS & UTILITIES
   ═══════════════════════════════════════════════════════ */

/* Subtle card entrance */
.card {
  animation: card-in 0.5s ease both;
}

.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }
.card:nth-child(6) { animation-delay: 0.40s; }

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
