/* WS ZHANG — Cyberpunk entry modals v2 */

@keyframes cp-modal-in {
  0% { opacity: 0; transform: translateY(24px) scale(0.92) rotateX(6deg); }
  70% { transform: translateY(-4px) scale(1.01) rotateX(0deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0deg); }
}

@keyframes cp-border-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes cp-scan-sweep {
  0% { transform: translateY(-120%); opacity: 0; }
  15% { opacity: 0.7; }
  100% { transform: translateY(220%); opacity: 0; }
}

@keyframes cp-pulse-glow {
  0%, 100% { opacity: 0.55; filter: blur(0); }
  50% { opacity: 1; filter: blur(1px); }
}

@keyframes cp-live-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #00ff9d; }
  50% { opacity: 0.35; box-shadow: 0 0 2px #00ff9d; }
}

@keyframes cp-shine-sweep {
  0% { transform: translateX(-140%) skewX(-18deg); }
  100% { transform: translateX(260%) skewX(-18deg); }
}

@keyframes cp-float-badge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes cp-title-flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.82; }
  97% { opacity: 1; }
  98% { opacity: 0.9; }
}

@keyframes cp-backdrop-grid {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 40px 40px, -40px -20px; }
}

/* ── Overlay ── */
.cp-entry-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 255, 242, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255, 46, 196, 0.1), transparent 55%),
    rgba(2, 4, 10, 0.82);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.cp-entry-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 255, 242, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 46, 196, 0.03) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  animation: cp-backdrop-grid 20s linear infinite;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black 20%, transparent 75%);
}

.cp-entry-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Modal shell ── */
.cp-entry-modal {
  position: relative;
  width: min(94vw, 460px);
  max-height: min(88vh, 580px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: visible;
  font-family: 'Rajdhani', sans-serif;
  perspective: 900px;
  transform: translateY(16px) scale(0.94);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.cp-entry-overlay.is-open .cp-entry-modal {
  animation: cp-modal-in 0.55s cubic-bezier(0.22, 1.15, 0.36, 1) forwards;
}

/* Animated neon border ring */
.cp-entry-border {
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cp-entry-border::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    #00fff2 60deg,
    #ff2ec4 120deg,
    #00ff9d 180deg,
    #00fff2 240deg,
    transparent 300deg
  );
  animation: cp-border-spin 4s linear infinite;
}

.cp-entry-border::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 16px;
  background: linear-gradient(168deg, #0f1628 0%, #080c16 45%, #0a101c 100%);
}

.cp-entry-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 580px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(0, 255, 242, 0.15),
    0 0 100px rgba(255, 46, 196, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.75);
}

/* Scanline sweep */
.cp-entry-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  border-radius: 16px;
}

.cp-entry-scan::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 255, 242, 0.06) 45%,
    rgba(0, 255, 242, 0.12) 50%,
    rgba(0, 255, 242, 0.06) 55%,
    transparent 100%
  );
  animation: cp-scan-sweep 3.5s ease-in-out infinite;
}

/* Static CRT lines */
.cp-entry-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  border-radius: inherit;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.07) 3px,
    rgba(0, 0, 0, 0.07) 4px
  );
  opacity: 0.35;
}

.cp-entry-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.cp-entry-corners i {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--auth-cyan, #00fff2);
  border-style: solid;
  filter: drop-shadow(0 0 6px rgba(0, 255, 242, 0.6));
  animation: cp-pulse-glow 2.5s ease-in-out infinite;
}

.cp-entry-corners i:nth-child(1) { top: 10px; left: 10px; border-width: 2px 0 0 2px; animation-delay: 0s; }
.cp-entry-corners i:nth-child(2) { top: 10px; right: 10px; border-width: 2px 2px 0 0; animation-delay: 0.4s; border-color: #ff2ec4; filter: drop-shadow(0 0 6px rgba(255, 46, 196, 0.6)); }
.cp-entry-corners i:nth-child(3) { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; animation-delay: 0.8s; }
.cp-entry-corners i:nth-child(4) { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; animation-delay: 1.2s; border-color: #ff2ec4; filter: drop-shadow(0 0 6px rgba(255, 46, 196, 0.6)); }

/* ── Header ── */
.cp-entry-head {
  position: relative;
  z-index: 3;
  padding: 24px 24px 20px;
  padding-right: 58px;
  background: linear-gradient(180deg, rgba(0, 255, 242, 0.07) 0%, transparent 100%);
  border-bottom: 1px solid rgba(0, 255, 242, 0.15);
}

.cp-entry-head::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 242, 0.5), rgba(255, 46, 196, 0.5), transparent);
}

.cp-entry-head-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.cp-entry-icon-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(0, 255, 242, 0.15), rgba(255, 46, 196, 0.1));
  border: 1px solid rgba(0, 255, 242, 0.3);
  box-shadow: 0 0 24px rgba(0, 255, 242, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: cp-float-badge 3s ease-in-out infinite;
  font-size: 1.35rem;
  margin-top: 2px;
}

.cp-entry-head-text {
  flex: 1;
  min-width: 0;
}

.cp-entry-eyebrow {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(0, 255, 242, 0.75);
  text-transform: uppercase;
  margin: 0 0 10px;
}

.cp-entry-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.1);
  border: 1px solid rgba(0, 255, 157, 0.35);
  color: #00ff9d;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.cp-entry-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00ff9d;
  animation: cp-live-blink 1.4s ease-in-out infinite;
}

.cp-entry-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.02rem, 3.8vw, 1.18rem);
  font-weight: 900;
  margin: 0;
  line-height: 1.35;
  background: linear-gradient(135deg, #ffffff 0%, #00fff2 45%, #ff6bdc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: cp-title-flicker 8s linear infinite;
  filter: drop-shadow(0 0 12px rgba(0, 255, 242, 0.3));
}

.cp-entry-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 46, 196, 0.45);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 46, 196, 0.12), rgba(255, 46, 196, 0.04));
  color: #ff6bdc;
  font-size: 1.35rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  box-shadow: 0 0 0 0 rgba(255, 46, 196, 0);
}

.cp-entry-close:hover {
  background: linear-gradient(145deg, rgba(255, 46, 196, 0.25), rgba(255, 46, 196, 0.1));
  border-color: rgba(255, 46, 196, 0.7);
  box-shadow: 0 0 20px rgba(255, 46, 196, 0.35), 0 0 40px rgba(255, 46, 196, 0.15);
  transform: rotate(90deg) scale(1.05);
}

.cp-entry-close:active {
  transform: rotate(90deg) scale(0.92);
}

/* ── Body ── */
.cp-entry-body {
  position: relative;
  z-index: 3;
  padding: 24px 24px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.cp-entry-text {
  color: #b8cce6;
  font-size: clamp(0.92rem, 3.2vw, 1rem);
  line-height: 1.65;
  margin: 0 0 28px;
  padding: 14px 16px;
  border-left: 3px solid rgba(0, 255, 242, 0.5);
  background: linear-gradient(90deg, rgba(0, 255, 242, 0.06), transparent);
  border-radius: 0 8px 8px 0;
}

.cp-entry-text strong {
  color: #00fff2;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 255, 242, 0.4);
}

.cp-entry-admin-body {
  white-space: pre-wrap;
  word-break: break-word;
  border-left-color: rgba(255, 46, 196, 0.55);
  background: linear-gradient(90deg, rgba(255, 46, 196, 0.07), transparent);
}

.cp-entry-links-section {
  margin-top: 4px;
}

.cp-entry-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cp-entry-links-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(92, 114, 144, 0.95);
  margin: 0 0 14px;
  padding-top: 4px;
}

/* ── 3D Telegram buttons ── */
.cp-tg-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(155deg, #4fd0ff 0%, #229ed9 38%, #1578b8 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 4px 0 #0e5a94,
    0 8px 20px rgba(34, 158, 217, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.12);
  transform: perspective(600px) rotateX(3deg);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, filter 0.18s ease;
}

.cp-tg-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255,255,255,0.22) 0%, transparent 40%, transparent 60%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
}

.cp-tg-btn::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  pointer-events: none;
  transform: translateX(-140%) skewX(-18deg);
}

.cp-tg-btn:hover {
  filter: brightness(1.08);
  transform: perspective(600px) rotateX(3deg) translateY(-2px);
  box-shadow:
    0 6px 0 #0e5a94,
    0 12px 28px rgba(34, 158, 217, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.cp-tg-btn:hover::after {
  animation: cp-shine-sweep 0.65s ease forwards;
}

.cp-tg-btn:active {
  transform: perspective(600px) rotateX(3deg) translateY(3px);
  box-shadow:
    0 1px 0 #0e5a94,
    0 4px 12px rgba(34, 158, 217, 0.28),
    inset 0 2px 5px rgba(0, 0, 0, 0.18);
}

.cp-tg-btn--group {
  background: linear-gradient(155deg, #52e0b8 0%, #1fa87a 38%, #128a62 100%);
  box-shadow:
    0 4px 0 #0a5c44,
    0 8px 20px rgba(31, 168, 122, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -2px 6px rgba(0, 0, 0, 0.1);
}

.cp-tg-btn--group:hover {
  box-shadow:
    0 6px 0 #0a5c44,
    0 12px 28px rgba(31, 168, 122, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.cp-tg-btn--group:active {
  box-shadow:
    0 1px 0 #0a5c44,
    0 4px 12px rgba(31, 168, 122, 0.25),
    inset 0 2px 5px rgba(0, 0, 0, 0.15);
}

.cp-tg-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(255,255,255,0.25), rgba(255,255,255,0.08));
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    inset 0 -4px 8px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 16px rgba(255, 255, 255, 0.1);
}

.cp-tg-icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.cp-tg-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.cp-tg-label span:first-child {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  opacity: 0.9;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.cp-tg-label span:last-child {
  font-size: clamp(0.86rem, 3vw, 0.96rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cp-tg-arrow {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
  opacity: 0.85;
  transition: transform 0.18s ease;
}

.cp-tg-btn:hover .cp-tg-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* ── Footer ── */
.cp-entry-foot {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 22px;
  margin-top: 8px;
  border-top: 1px solid rgba(0, 255, 242, 0.1);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.22), transparent);
}

.cp-entry-foot-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(92, 114, 144, 0.85);
  line-height: 1.4;
}

.cp-entry-skip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 242, 0.25);
  background: rgba(0, 255, 242, 0.06);
  color: rgba(0, 255, 242, 0.85);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.cp-entry-skip:hover {
  background: rgba(0, 255, 242, 0.12);
  box-shadow: 0 0 16px rgba(0, 255, 242, 0.2);
}

.cp-entry-skip:active {
  transform: scale(0.96);
}

/* Admin modal accent */
.cp-entry-modal--admin .cp-entry-border::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    #ff2ec4 60deg,
    #ff6bdc 120deg,
    #00fff2 180deg,
    #ff2ec4 240deg,
    transparent 300deg
  );
}

.cp-entry-modal--admin .cp-entry-icon-wrap {
  background: linear-gradient(145deg, rgba(255, 46, 196, 0.18), rgba(255, 46, 196, 0.06));
  border-color: rgba(255, 46, 196, 0.35);
  box-shadow: 0 0 24px rgba(255, 46, 196, 0.2);
}

@media (max-width: 400px) {
  .cp-entry-head { padding: 20px 20px 18px; padding-right: 52px; }
  .cp-entry-head-main { gap: 12px; }
  .cp-entry-body { padding: 20px 20px 6px; }
  .cp-entry-text { margin-bottom: 24px; padding: 12px 14px; }
  .cp-entry-links { gap: 14px; }
  .cp-entry-foot { flex-direction: column; align-items: stretch; text-align: center; padding: 16px 20px 20px; gap: 12px; }
  .cp-entry-icon-wrap { width: 42px; height: 42px; font-size: 1.2rem; }
  .cp-entry-close { top: 14px; right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-entry-border::before,
  .cp-entry-scan::after,
  .cp-entry-corners i,
  .cp-entry-icon-wrap,
  .cp-entry-live i,
  .cp-entry-title,
  .cp-entry-overlay::before {
    animation: none !important;
  }
  .cp-entry-overlay.is-open .cp-entry-modal {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
