/* ============================================
   2026 世界杯全明星黑客级卡牌信息分析大屏
   深空监控舱 × 赛博朋克情报终端
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-base: #050508;
  --grid-line: rgba(18, 24, 38, 0.5);
  --neon-red: #ff3b30;
  --neon-green: #00ff41;
  --neon-cyan: #00f0ff;
  --panel-bg: rgba(10, 14, 20, 0.95);
  --panel-bg-hover: rgba(14, 20, 30, 0.98);
  --text-primary: #e0e0e0;
  --text-secondary: #8a8f98;
  --overlay-dark: rgba(0, 0, 0, 0.75);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', 'Monaco', monospace;
  --flip-duration: 0.6s;
  --flip-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-base);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 30px 30px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Language Switch --- */
.lang-switch {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  background: rgba(5, 5, 8, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 4px 10px;
  border-radius: 2px;
  user-select: none;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.2s, text-shadow 0.2s;
  outline: none;
}

.lang-btn:hover {
  color: var(--neon-cyan);
}

.lang-btn.active {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.lang-divider {
  color: rgba(0, 240, 255, 0.3);
  font-size: 11px;
  margin: 0 1px;
}

/* --- Ticker Bar --- */
.ticker-wrap {
  width: 100%;
  overflow: hidden;
  background: rgba(5, 5, 8, 0.95);
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  height: 32px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 10;
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-scroll 90s linear infinite;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ticker-content .tick-red { color: var(--neon-red); }
.ticker-content .tick-green { color: var(--neon-green); }
.ticker-content .tick-cyan { color: var(--neon-cyan); }

.ticker-wrap::before,
.ticker-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  width: 80px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.ticker-wrap::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg-base), transparent);
}

.ticker-wrap::after {
  right: 0;
  background: linear-gradient(-90deg, var(--bg-base), transparent);
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- Page Header --- */
.page-header {
  text-align: center;
  padding: 24px 20px 16px;
  position: relative;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.page-header h1::before {
  content: '// ';
  color: var(--neon-cyan);
}

.page-header h1::after {
  content: ' //';
  color: var(--neon-cyan);
}

.page-header .sub-line {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 6px;
}

.page-header .status-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 10px;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.status-bar .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 0;
  display: inline-block;
}

.status-dot.live {
  background: var(--neon-red);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.active {
  background: var(--neon-green);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.sync {
  background: var(--neon-cyan);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Matrix Grid --- */
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 8px 20px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Card Container --- */
.card-container {
  position: relative;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  perspective: 1200px;
  transition: transform 0.3s ease, filter 0.4s ease;
}

.card-container:hover {
  transform: translateY(-3px) scale(1.02);
  z-index: 5;
}

.card-container:hover .card-front {
  border-color: rgba(0, 240, 255, 0.25);
  background: var(--panel-bg-hover);
}

.card-container:hover .restricted-tag {
  animation: glitch 0.2s linear infinite;
}

.card-container:hover .scan-line {
  opacity: 0.6;
}

.card-container:hover .silhouette-svg {
  opacity: 0.35;
}

.card-container:hover .card-front .corner-mark {
  opacity: 0.8;
}

/* Grid blur when modal is open */
body.modal-open .card-container {
  filter: blur(6px) brightness(0.3);
  pointer-events: none;
  transition: filter 0.4s ease, brightness 0.4s ease;
}

body.modal-open .modal-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* --- Card Flipper --- */
.card-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--flip-duration) var(--flip-ease);
}

.card-flipper.is-flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* --- Card Front (A-Side: Locked) --- */
.card-front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--panel-bg);
  border: 1px solid rgba(0, 240, 255, 0.08);
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s ease, background 0.3s ease;
}

/* Scan line overlay */
.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.03) 2px,
    rgba(0, 240, 255, 0.03) 4px
  );
  opacity: 0.3;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Redaction diagonal lines */
.redaction-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 59, 48, 0.015) 10px,
    rgba(255, 59, 48, 0.015) 11px
  );
  pointer-events: none;
}

/* Corner marks - military targeting brackets */
.corner-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.corner-mark.tl { top: 6px; left: 6px; border-top: 1px solid var(--neon-cyan); border-left: 1px solid var(--neon-cyan); }
.corner-mark.tr { top: 6px; right: 6px; border-top: 1px solid var(--neon-cyan); border-right: 1px solid var(--neon-cyan); }
.corner-mark.bl { bottom: 6px; left: 6px; border-bottom: 1px solid var(--neon-cyan); border-left: 1px solid var(--neon-cyan); }
.corner-mark.br { bottom: 6px; right: 6px; border-bottom: 1px solid var(--neon-cyan); border-right: 1px solid var(--neon-cyan); }

/* Silhouette area */
.silhouette-area {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0;
  overflow: hidden;
}

.silhouette-svg {
  width: 60px;
  height: 80px;
  opacity: 0.15;
  color: var(--text-primary);
  transition: opacity 0.3s ease;
}

/* Player photo on card A-side */
.player-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.85;
  filter: grayscale(40%) brightness(0.6) contrast(1.3);
  transition: opacity 0.4s ease, filter 0.4s ease;
  pointer-events: none;
}

.card-container:hover .player-photo {
  opacity: 0.95;
  filter: grayscale(20%) brightness(0.65) contrast(1.3);
}

/* Modal photo - larger and slightly more visible */
.modal-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.55;
  filter: grayscale(50%) brightness(0.5) contrast(1.3);
}

/* Player ID code */
.player-id {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  font-weight: 700;
  opacity: 1;
}

/* Country badge - highly visible */
.country-badge {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--neon-green);
  font-weight: 700;
  padding: 1px 10px;
  border: 1px solid rgba(0, 255, 65, 0.4);
  background: rgba(0, 255, 65, 0.06);
}

/* Restricted tag */
.restricted-tag {
  font-size: 0.45rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--neon-red);
  opacity: 0.6;
  padding: 2px 6px;
  border: 1px solid rgba(255, 59, 48, 0.15);
}

/* Card info bar - bottom overlay on photo */
.card-info-bar {
  position: relative;
  z-index: 3;
  padding: 8px 8px 7px;
  background: linear-gradient(to bottom, rgba(5,5,8,0.7), rgba(5,5,8,0.95));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Glitch animation */
@keyframes glitch {
  0% { text-shadow: 2px -2px 0 var(--neon-red), -2px 2px 0 var(--neon-cyan); }
  50% { text-shadow: -2px -2px 0 var(--neon-red), 2px 2px 0 var(--neon-cyan); }
  100% { text-shadow: 2px 2px 0 var(--neon-red), -2px -2px 0 var(--neon-cyan); }
}

/* --- Card Back (B-Side: Decrypted) --- */
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--panel-bg);
  border: 1px solid rgba(0, 240, 255, 0.12);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  z-index: 10;
  overflow: hidden;
}

.modal-back-photo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.2;
  filter: grayscale(80%) brightness(0.4) contrast(1.2);
  z-index: 0;
  pointer-events: none;
}

.modal-back-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(5, 5, 8, 0.5) 0%,
    rgba(5, 5, 8, 0.7) 30%,
    rgba(5, 5, 8, 0.88) 60%,
    rgba(5, 5, 8, 0.95) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.modal-back-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 20px 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Ensure text is visible on the card back */
.card-back .modal-back-content {
  color: #e0e0e0;
}

.card-back .modal-back-content * {
  color: inherit;
}

.card-back .star-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--neon-cyan);
  text-transform: uppercase;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  padding-bottom: 12px;
}

.card-back .star-country {
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.card-back .star-tag {
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--neon-red);
  margin-bottom: 14px;
  line-height: 1.6;
  border-left: 2px solid var(--neon-red);
  padding-left: 10px;
}

.card-back .star-analysis {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
  flex: 1;
  word-break: break-all;
}

.card-back .star-analysis .cursor-blink {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--neon-green);
  margin-left: 2px;
  animation: blink-cursor 0.6s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.card-back .close-btn {
  margin-top: 12px;
  background: transparent;
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: var(--neon-red);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: flex-start;
  border-radius: 0;
}

.card-back .close-btn:hover {
  background: rgba(255, 59, 48, 0.1);
  border-color: var(--neon-red);
}

/* Neon highlight classes */
.text-neon-red { color: var(--neon-red); font-weight: 700; }
.text-neon-green { color: var(--neon-green); font-weight: 700; }
.text-neon-cyan { color: var(--neon-cyan); font-weight: 700; }

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-dark);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 101;
  width: 420px;
  max-width: 92vw;
  max-height: 90vh;
  perspective: 1200px;
}

.modal-card .card-flipper {
  width: 100%;
  height: 520px;
  max-height: 85vh;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--flip-duration) var(--flip-ease);
}

.modal-card .card-flipper.is-flipped {
  transform: rotateY(180deg);
}

.modal-card .card-front {
  background: var(--panel-bg);
  border: 1px solid rgba(0, 240, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  z-index: 2;
}

.modal-card .card-front .silhouette-svg {
  width: 100px;
  height: 130px;
}

.modal-card .card-front .restricted-tag {
  font-size: 0.65rem;
  animation: glitch 0.15s linear infinite;
}

.modal-card .card-front .player-id {
  font-size: 0.7rem;
}

.modal-card .card-back {
  background: transparent;
  border: 1px solid rgba(0, 240, 255, 0.2);
  transform: rotateY(180deg);
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  box-sizing: border-box;
  z-index: 10;
  overflow: hidden;
}

.modal-card .modal-back-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  padding-top: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-card .card-back .star-name {
  font-size: 1.8rem;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.modal-card .card-back .star-tag {
  font-size: 1.1rem;
}

.modal-card .card-back .star-analysis {
  font-size: 1.15rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.modal-card .card-back .close-btn {
  text-shadow: 0 0 6px rgba(255, 59, 48, 0.3);
}

/* Modal card glow effect */
.modal-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(0, 240, 255, 0.15),
    transparent 30%,
    rgba(255, 59, 48, 0.15),
    transparent 60%,
    rgba(0, 255, 65, 0.15),
    transparent 90%
  );
  background-size: 400% 400%;
  animation: border-glow 4s ease infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 0;
}

body.modal-open .modal-card::before {
  opacity: 1;
}

@keyframes border-glow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Page Footer --- */
.page-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.4;
  border-top: 1px solid rgba(0, 240, 255, 0.05);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.4);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .matrix-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 8px 16px 24px;
  }
}

@media (max-width: 900px) {
  .matrix-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 12px 20px;
  }
}

@media (max-width: 600px) {
  .matrix-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 8px 16px;
  }

  .page-header h1 {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
  }

  .page-header .sub-line {
    font-size: 0.5rem;
  }

  .modal-card {
    width: 96vw;
  }

  .modal-card .card-flipper {
    min-height: 460px;
  }

  .modal-card .card-front,
  .modal-card .card-back {
    min-height: 460px;
  }
}

/* --- Selection --- */
::selection {
  background: rgba(0, 240, 255, 0.2);
  color: var(--neon-cyan);
}
