/* panel.css: country panel (agent #8). Desktop: right side panel. Mobile (<=720px): bottom sheet.
   Override --gp-top from another stylesheet if the top bar is taller/shorter. */
.gp-panel {
  --gp-top: 76px;
  --gp-w: 400px;
  position: fixed;
  top: var(--gp-top); right: 16px; bottom: 16px;
  width: var(--gp-w); max-width: calc(100vw - 32px);
  z-index: 30;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(242, 199, 102, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(18, 39, 63, 0.82), rgba(6, 13, 24, 0.88));
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 236, 190, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.35);
  color: var(--text);
  overflow: hidden;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.35s ease, visibility 0s linear 0.55s;
}
.gp-panel.gp-open {
  transform: none; opacity: 1; visibility: visible;
  pointer-events: auto !important;
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.3s ease, visibility 0s;
}
/* thin gold light along the inner edge */
.gp-panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(242, 199, 102, 0.55), rgba(242, 199, 102, 0) 22%) top / 100% 1px no-repeat;
}

.gp-grip { display: none; }

/* ---------- header ---------- */
.gp-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 18px 14px 20px;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.gp-flag {
  flex: none; width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 30px; line-height: 1;
  background: rgba(242, 199, 102, 0.07);
  border: 1px solid rgba(242, 199, 102, 0.22);
  box-shadow: inset 0 0 14px rgba(242, 199, 102, 0.08);
}
.gp-flag.gp-flag-code {
  font: 700 15px/1 var(--font-title); letter-spacing: 0.08em; color: var(--gold);
  text-shadow: 0 0 10px rgba(242, 199, 102, 0.45);
}
.gp-flag.gp-flag-none::after {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--gold-3); box-shadow: 0 0 10px rgba(242, 199, 102, 0.35);
}
.gp-titles { flex: 1; min-width: 0; }
.gp-name {
  margin: 0;
  font: 700 26px/1.12 var(--font-title);
  letter-spacing: 0.04em;
  color: var(--gold);
  background: linear-gradient(180deg, #FFE9AE 0%, var(--gold) 45%, var(--gold-3) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(242, 199, 102, 0.28));
  overflow-wrap: anywhere;
}
.gp-name.gp-long-name { font-size: 21px; }
.gp-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  margin-top: 6px; font-size: 13px; color: var(--muted);
}
.gp-dn { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.gp-dn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.gp-dn.is-day { color: var(--gold); filter: drop-shadow(0 0 6px rgba(242, 199, 102, 0.6)); }
.gp-dn.is-night { color: #A9C4E8; }
.gp-dn.is-night svg { fill: currentColor; stroke: none; }
.gp-time {
  font-weight: 600; font-size: 15px; color: var(--cream);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.gp-zone { font-size: 12px; letter-spacing: 0.02em; }

.gp-close {
  flex: none; align-self: flex-start;
  width: 36px; height: 36px; margin: -4px -2px 0 0;
  display: grid; place-items: center;
  border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(242, 199, 102, 0.2);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.25s;
}
.gp-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.gp-close:hover { background: rgba(242, 199, 102, 0.14); border-color: var(--gold); color: var(--gold); transform: rotate(90deg); }
.gp-close:focus-visible, .gp-thumb:focus-visible, .gp-yt:focus-visible, .gp-cta:focus-visible, .gp-chip:focus-visible, .gp-more:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

.gp-rule {
  height: 1px; margin: 0 20px;
  background: linear-gradient(90deg, rgba(242, 199, 102, 0), rgba(242, 199, 102, 0.6) 30%, rgba(242, 199, 102, 0.6) 70%, rgba(242, 199, 102, 0));
  box-shadow: 0 0 8px rgba(242, 199, 102, 0.4);
}

/* ---------- body ---------- */
.gp-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 22px;
  scrollbar-width: thin; scrollbar-color: rgba(242, 199, 102, 0.35) transparent;
  transition: opacity 0.14s ease;
}
.gp-body::-webkit-scrollbar { width: 6px; }
.gp-body::-webkit-scrollbar-thumb { background: rgba(242, 199, 102, 0.3); border-radius: 3px; }
.gp-panel.gp-swap .gp-body, .gp-panel.gp-swap .gp-head { opacity: 0; }
.gp-panel.gp-swap .gp-head { transform: translateY(-4px); }

.gp-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-3); margin: 0 0 12px;
}
.gp-list { display: flex; flex-direction: column; gap: 22px; }

/* entrance: cards rise in one after another */
.gp-body.gp-enter .gp-card, .gp-body.gp-enter .gp-empty, .gp-body.gp-enter .gp-suggest {
  animation: gp-rise 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: calc(0.08s + var(--i, 0) * 0.07s);
}
@keyframes gp-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- video card ---------- */
.gp-card { display: flex; flex-direction: column; gap: 10px; }
.gp-frame {
  position: relative; width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden;
  background: #02060c;
  border: 1px solid rgba(242, 199, 102, 0.22);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.gp-short .gp-frame {
  aspect-ratio: 9 / 16;
  width: min(100%, 270px, calc((100vh - 300px) * 0.5625));
  min-width: 170px;
  align-self: center;
}
.gp-short .gp-info { text-align: center; }
.gp-short .gp-sub { justify-content: center; }
.gp-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.gp-frame.gp-playing { border-color: rgba(242, 199, 102, 0.55); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 22px rgba(242, 199, 102, 0.18); }

.gp-thumb {
  all: unset; box-sizing: border-box;
  position: absolute; inset: 0; cursor: pointer; display: block;
}
.gp-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.04);
  transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.gp-thumb.gp-loaded img { opacity: 1; transform: scale(1.0); }
.gp-thumb:hover img { transform: scale(1.04); }
/* poster shown while loading or when there is no thumbnail */
.gp-poster {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 14px;
  background:
    radial-gradient(90% 70% at 30% 20%, rgba(242, 199, 102, 0.20), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(242, 199, 102, 0.06) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(242, 199, 102, 0.06) 23px 24px),
    linear-gradient(160deg, var(--navy-3), var(--navy-0));
  transition: opacity 0.4s;
}
.gp-poster span {
  font: 700 15px/1.25 var(--font-title); color: var(--gold); letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(242, 199, 102, 0.35);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  opacity: 0; transition: opacity 0.3s;
}
.gp-thumb.gp-loaded .gp-poster { opacity: 0; }
.gp-thumb.gp-nothumb .gp-poster span { opacity: 1; }
.gp-thumb.gp-nothumb img { display: none; }
.gp-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 15, 0) 55%, rgba(4, 8, 15, 0.55));
}
.gp-play {
  position: absolute; left: 50%; top: 50%;
  width: 62px; height: 62px; margin: -31px 0 0 -31px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(4, 8, 15, 0.55);
  border: 1.5px solid rgba(242, 199, 102, 0.85);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 0 0 0 rgba(242, 199, 102, 0.45), 0 0 24px rgba(242, 199, 102, 0.3);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1), background 0.25s;
  animation: gp-pulse 2.6s ease-out infinite;
}
.gp-play svg { width: 26px; height: 26px; margin-left: 3px; fill: var(--gold); filter: drop-shadow(0 0 6px rgba(242, 199, 102, 0.6)); }
.gp-thumb.gp-nothumb .gp-play { top: 42%; }
.gp-thumb:hover .gp-play { transform: scale(1.1); background: rgba(242, 199, 102, 0.2); }
@keyframes gp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 199, 102, 0.45), 0 0 24px rgba(242, 199, 102, 0.3); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(242, 199, 102, 0), 0 0 24px rgba(242, 199, 102, 0.3); }
}
.gp-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--navy-0); background: linear-gradient(180deg, #FFE3A0, var(--gold));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.gp-long .gp-badge { color: var(--gold); background: rgba(4, 8, 15, 0.7); border: 1px solid rgba(242, 199, 102, 0.5); }

.gp-title { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.35; color: var(--text); }
.gp-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.gp-yt {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--gold); text-decoration: none; font-weight: 600;
  padding: 3px 0; border-bottom: 1px solid rgba(242, 199, 102, 0);
  transition: border-color 0.2s, color 0.2s;
}
.gp-yt svg { width: 17px; height: 17px; fill: currentColor; }
.gp-yt:hover { color: #FFE3A0; border-bottom-color: rgba(242, 199, 102, 0.6); }

.gp-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 24px; padding: 11px; border-radius: 10px;
  font-size: 13px; color: var(--muted); text-decoration: none;
  border: 1px dashed rgba(242, 199, 102, 0.22);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.gp-more svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gp-more:hover { color: var(--gold); border-color: rgba(242, 199, 102, 0.5); background: rgba(242, 199, 102, 0.05); }

/* ---------- empty state ---------- */
.gp-empty { text-align: center; padding: 18px 6px 8px; }
.gp-empty-art { width: 96px; height: 96px; margin: 0 auto 16px; }
.gp-empty-art svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--gold); stroke-width: 1.2; filter: drop-shadow(0 0 8px rgba(242, 199, 102, 0.45)); }
.gp-empty-art .gp-orbit { stroke: rgba(242, 199, 102, 0.3); stroke-dasharray: 2 4; }
.gp-empty-art .gp-sat { fill: var(--gold); stroke: none; }
.gp-empty-art .gp-orbit, .gp-empty-art .gp-sat { transform-origin: 32px 32px; animation: gp-spin 9s linear infinite; }
@keyframes gp-spin { to { transform: rotate(360deg); } }
.gp-empty-title { margin: 0 0 8px; font: 700 19px/1.3 var(--font-title); color: var(--cream); letter-spacing: 0.02em; }
.gp-empty-text { margin: 0 auto 20px; max-width: 290px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.gp-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 700; text-decoration: none;
  color: var(--navy-0); background: linear-gradient(180deg, #FFE3A0, var(--gold) 55%, var(--gold-2));
  box-shadow: 0 4px 18px rgba(242, 199, 102, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}
.gp-cta svg { width: 19px; height: 19px; fill: currentColor; }
.gp-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 26px rgba(242, 199, 102, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5); }

.gp-suggest { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(242, 199, 102, 0.14); --i: 2; }
.gp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gp-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px 7px 13px; border-radius: 999px; cursor: pointer;
  font-size: 13px; color: var(--text);
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(242, 199, 102, 0.22);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.gp-chip span {
  min-width: 18px; padding: 1px 5px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--navy-0); background: var(--gold);
}
.gp-chip:hover { background: rgba(242, 199, 102, 0.12); border-color: var(--gold); color: var(--gold); }

/* ---------- mobile bottom sheet ---------- */
@media (max-width: 720px) {
  .gp-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: none;
    max-height: 74vh;
    max-height: min(74vh, 74dvh);
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(calc(100% + 24px));
    background:
      radial-gradient(120% 50% at 50% 0%, rgba(242, 199, 102, 0.10), transparent 60%),
      linear-gradient(180deg, rgba(18, 39, 63, 0.9), rgba(6, 13, 24, 0.95));
  }
  .gp-panel.gp-open { transform: translateY(0); }
  .gp-panel.gp-dragging { transition: none; }
  .gp-grip { display: flex; justify-content: center; padding: 10px 0 2px; touch-action: none; }
  .gp-grip span { width: 42px; height: 4px; border-radius: 2px; background: rgba(242, 199, 102, 0.45); }
  .gp-head { padding: 8px 14px 12px 16px; gap: 12px; touch-action: none; }
  .gp-flag { width: 42px; height: 42px; font-size: 26px; border-radius: 10px; }
  .gp-name { font-size: 22px; }
  .gp-name.gp-long-name { font-size: 18px; }
  .gp-rule { margin: 0 16px; }
  .gp-body { padding: 14px 16px 20px; }
  .gp-short .gp-frame { width: min(100%, 230px, calc((74vh - 210px) * 0.5625)); width: min(100%, 230px, calc((74dvh - 210px) * 0.5625)); min-width: 150px; }
  .gp-empty { padding-top: 8px; }
  .gp-empty-art { width: 76px; height: 76px; margin-bottom: 12px; }
}
