:root {
  color-scheme: dark;
  --bg: #07090c;
  --panel: rgba(9, 15, 20, 0.9);
  --cyan: #2de1c2;
  --cyan-soft: rgba(45, 225, 194, 0.35);
  --red: #ff3b30;
  --amber: #ffb020;
  --violet: #b18cff;
  --text: #f2f7f6;
  --muted: #8ea29f;
  --line: rgba(89, 224, 204, 0.14);
  --edge: clamp(24px, 3vw, 58px);
  /* ความสูงแถบสถิติล่าง — caption อยู่เหนือแถบนี้ */
  --globe-stats-band: 116px;
  /* ระยะจากขอบบนถึงการ์ด spotlight (videowall override ได้) */
  --globe-header-band: 96px;
  --globe-spotlight-gap: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: "Noto Sans Thai", "Leelawadee UI", "Tahoma", system-ui, sans-serif;
  font-size: 20px;
}

.globe-app {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100dvh;
  min-height: 620px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(22, 61, 57, 0.16), transparent 46%),
    linear-gradient(180deg, #080b0e 0%, var(--bg) 68%);
}

.globe-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(45, 225, 194, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 225, 194, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 48%, #000 10%, transparent 82%);
}

.globe-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.globe-brand {
  position: absolute;
  top: var(--edge);
  left: var(--edge);
  right: var(--edge);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.globe-brand__home {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.globe-brand__mark {
  width: var(--header-brand-mark, 52px);
  height: var(--header-brand-mark, 52px);
  overflow: visible;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.globe-brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.globe-brand__name {
  font-size: var(--header-brand-name, 22px);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.globe-brand__tagline {
  max-width: 520px;
  margin-top: 3px;
  font-size: var(--header-brand-sub, 12.5px);
  line-height: 1.45;
}

.globe-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 17, 22, 0.72);
  pointer-events: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 6;
}

.globe-clock time {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.globe-clock span {
  color: var(--muted);
  font-size: 12px;
}

.scene-caption {
  position: absolute;
  left: var(--edge);
  bottom: calc(var(--edge) + var(--globe-stats-band));
  z-index: 4;
  max-width: min(420px, 28vw);
  pointer-events: none;
}

.scene-caption__kicker {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--cyan-soft);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.scene-caption--ransom .scene-caption__kicker {
  border-color: rgba(255, 59, 48, 0.45);
  color: #ff6b63;
}

.scene-caption--ransom .scene-caption__title {
  text-shadow: 0 0 34px rgba(255, 59, 48, 0.28);
}

.scene-caption__title {
  margin: 12px 0 6px;
  font-size: clamp(15px, 1.5vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  text-shadow: 0 0 34px rgba(45, 225, 194, 0.28);
  word-break: keep-all;
}

.scene-caption__detail {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.spotlight-card {
  position: absolute;
  top: calc(
    var(--edge) + var(--globe-header-band) + var(--globe-spotlight-gap)
  );
  right: var(--edge);
  z-index: 5;
  width: min(360px, 32vw);
  max-height: calc(
    100dvh - var(--edge) - var(--globe-header-band) - var(--globe-spotlight-gap) -
    var(--edge) - var(--globe-stats-band)
  );
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: auto;
}

.spotlight-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.spotlight-card__eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.spotlight-card__origin {
  color: var(--muted);
  letter-spacing: 0.06em;
}

.spotlight-card h2 {
  margin: 8px 0 4px;
  font-size: 22px;
  line-height: 1.15;
}

.spotlight-card__aliases {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.spotlight-card__block {
  margin-top: 10px;
}

.spotlight-card__block h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.spotlight-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.spotlight-card__chips li {
  padding: 2px 8px;
  border: 1px solid var(--cyan-soft);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 11px;
}

.spotlight-card__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
}

.spotlight-card__list li {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.spotlight-card__list li::before {
  content: "▸";
  margin-right: 8px;
  color: var(--cyan);
}

.spotlight-card__meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.spotlight-card__meta strong {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 18px;
  color: var(--cyan);
}

.spotlight-card__meta span {
  color: var(--muted);
  font-size: 11px;
}

.spotlight-card__latest {
  display: none;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
  background: rgba(45, 225, 194, 0.05);
}

.spotlight-card__latest:not([hidden]) {
  display: block;
}

.spotlight-card__latest:hover {
  border-color: var(--cyan-soft);
}

.spotlight-card__latest-label {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.spotlight-card__profile {
  display: none;
  margin-top: 14px;
  color: var(--cyan);
  font: 650 15px/1.3 "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  text-decoration: none;
}

.spotlight-card__profile:not([hidden]) {
  display: inline-flex;
}

.spotlight-card__profile:hover,
.spotlight-card__profile:focus {
  text-decoration: underline;
}

.globe-stats {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  bottom: var(--edge);
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: clamp(18px, 3vw, 44px);
  pointer-events: none;
}

.globe-stat strong {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(26px, 2.6vw, 38px);
  font-weight: 600;
  color: var(--cyan);
}

.globe-stat--alert strong {
  color: var(--red);
  text-shadow: 0 0 22px rgba(255, 59, 48, 0.35);
}

.globe-stat span {
  color: var(--muted);
  font-size: 12.5px;
}

.globe-stat--scene {
  margin-left: auto;
  text-align: right;
  max-width: min(280px, 28vw);
  min-width: 0;
  flex-shrink: 1;
}

.globe-stat--scene strong {
  font-size: clamp(18px, 1.7vw, 24px);
  letter-spacing: 0.14em;
}

.globe-stat--scene span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
}

.globe-help {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11.5px;
  text-align: right;
}

.globe-help kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  color: var(--cyan);
  background: rgba(10, 17, 22, 0.72);
}

.globe-mobile-controls {
  position: absolute;
  right: var(--edge);
  bottom: calc(var(--edge) + 8px);
  z-index: 5;
  display: none;
  gap: 10px;
}

.globe-mobile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: rgba(10, 17, 22, 0.85);
}

.globe-mobile-btn__icon {
  color: var(--cyan);
}

.data-error {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  color: var(--red);
  font-size: 20px;
  background: rgba(7, 9, 12, 0.88);
}

.data-error[hidden] {
  display: none !important;
}

@media (max-width: 1080px) {
  .spotlight-card {
    width: min(360px, 44vw);
  }
}

@media (max-width: 860px) {
  body {
    font-size: 17px;
  }

  .globe-brand__tagline {
    display: none;
  }

  .scene-caption {
    max-width: 78vw;
    bottom: calc(var(--edge) + 150px);
  }

  .spotlight-card {
    top: auto;
    right: var(--edge);
    left: var(--edge);
    bottom: calc(var(--edge) + 64px);
    width: auto;
    max-height: 40dvh;
    overflow-y: auto;
  }

  .spotlight-card__block,
  .spotlight-card__latest {
    display: none;
  }

  .globe-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .globe-help {
    display: none;
  }

  .globe-mobile-controls {
    display: flex;
  }
}
