:root {
  --bg: #0a0a18;
  --bg-glow: #1a1a2e;
  --text: #f3eedb;
  --text-dim: #a0a0c0;
  --accent: #ffd23f;
  --accent-dim: #c9a82a;
  --kp-red: #e0393f;
  --kp-red-dim: #8b1e22;
  --kp-ember: #ff8850;
  --sw-blue: #3a5288;
  --sw-paper: #f4ecd4;
  --sw-ink: #1a1a2e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: radial-gradient(ellipse at 50% 30%, var(--bg-glow) 0%, var(--bg) 55%, #05050d 100%);
  color: var(--text);
  font-family: 'Press Start 2P', 'Handjet', system-ui, monospace;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 210, 63, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 210, 63, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridShift 24s linear infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(224, 57, 63, 0.12), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(58, 82, 136, 0.18), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

@keyframes gridShift {
  from { background-position: 0 0; }
  to { background-position: 40px 40px; }
}

.portal {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* === Header === */
.portal-header {
  text-align: center;
  margin-bottom: 56px;
}

.portal-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: 6px;
  text-shadow:
    0 0 12px rgba(255, 210, 63, 0.55),
    0 0 24px rgba(255, 210, 63, 0.35),
    4px 4px 0 rgba(0, 0, 0, 0.8);
  animation: titlePulse 3.5s ease-in-out infinite;
}

.accent {
  color: var(--accent);
  text-shadow:
    0 0 16px rgba(255, 210, 63, 0.8),
    0 0 32px rgba(255, 210, 63, 0.4),
    4px 4px 0 rgba(0, 0, 0, 0.8);
}

@keyframes titlePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.portal-tagline {
  margin-top: 18px;
  font-family: 'Handjet', 'VT323', monospace;
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.portal-tagline::before,
.portal-tagline::after {
  content: "◆";
  margin: 0 12px;
  color: var(--accent);
  opacity: 0.7;
}

/* === Game grid === */
.game-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  width: 100%;
  max-width: 900px;
}

/* === Game card === */
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  border-radius: 0;
  overflow: hidden;
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.3, 1.2),
              box-shadow 180ms ease;
  isolation: isolate;
  cursor: pointer;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  z-index: 3;
  pointer-events: none;
}

.game-card-frame {
  position: relative;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    8px 8px 0 rgba(0, 0, 0, 0.5),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(255, 210, 63, 0.15);
  display: flex;
  flex-direction: column;
  min-height: 360px;
  transition: box-shadow 180ms ease;
}

.game-card:hover { transform: translate(-3px, -6px); }

.game-card:hover .game-card-frame {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    12px 14px 0 rgba(0, 0, 0, 0.55),
    0 28px 60px rgba(0, 0, 0, 0.7),
    0 0 48px rgba(255, 210, 63, 0.35);
}

/* === Card art area (theme-specific) === */
.game-card-art {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 24px;
  overflow: hidden;
}

.game-card-art svg {
  width: 100%;
  height: 100%;
  max-width: 260px;
  max-height: 200px;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.game-card:hover .game-card-art svg {
  transform: scale(1.05);
}

.game-card-body {
  padding: 20px 22px 22px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  border-top: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-card-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--text);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.game-card-desc {
  font-family: 'Handjet', 'VT323', monospace;
  font-size: 18px;
  color: var(--text-dim);
  letter-spacing: 1px;
  min-height: 44px;
  line-height: 1.3;
}

.game-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  margin-top: 8px;
  text-transform: uppercase;
}

.game-card-cta::after {
  content: "▶";
  transition: transform 180ms ease;
  font-size: 14px;
}

.game-card:hover .game-card-cta::after {
  transform: translateX(6px);
}

/* === Klavye Patlar card: fiery revolver theme === */
.game-card.kp .game-card-art {
  background:
    radial-gradient(ellipse at 50% 55%, rgba(255, 136, 80, 0.35), transparent 65%),
    linear-gradient(160deg, #2a0e14 0%, #1a0910 55%, #0e0306 100%);
}

.game-card.kp .game-card-frame {
  border-color: var(--kp-red);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    8px 8px 0 rgba(0, 0, 0, 0.5),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(224, 57, 63, 0.22);
}

.game-card.kp:hover .game-card-frame {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    12px 14px 0 rgba(0, 0, 0, 0.55),
    0 28px 60px rgba(0, 0, 0, 0.7),
    0 0 56px rgba(224, 57, 63, 0.5);
}

.game-card.kp .game-card-body {
  background: linear-gradient(180deg, rgba(40, 10, 14, 0.85), rgba(20, 6, 10, 0.95));
  border-top-color: var(--kp-red);
}

.game-card.kp .game-card-cta { color: var(--kp-ember); }

/* === Sikhaz Words card: blueprint / paper theme === */
.game-card.sw .game-card-art {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(165deg, #2e4270 0%, #1e2d4f 60%, #141e36 100%);
}

.game-card.sw .game-card-frame {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    8px 8px 0 rgba(0, 0, 0, 0.5),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(255, 210, 63, 0.22);
}

.game-card.sw:hover .game-card-frame {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    12px 14px 0 rgba(0, 0, 0, 0.55),
    0 28px 60px rgba(0, 0, 0, 0.7),
    0 0 56px rgba(255, 210, 63, 0.45);
}

.game-card.sw .game-card-body {
  background: linear-gradient(180deg, rgba(18, 22, 40, 0.85), rgba(8, 12, 24, 0.95));
  border-top-color: var(--accent);
}

/* === Press Start — animated arcade sign === */
.press-start {
  position: relative;
  margin-top: 56px;
  width: 100%;
  max-width: 420px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  perspective: 1200px;
}

.press-stamp {
  position: relative;
  z-index: 2;
  width: clamp(120px, 18vw, 180px);
  height: auto;
  display: block;
  filter:
    drop-shadow(0 0 6px rgba(255, 140, 40, 0.45))
    drop-shadow(0 0 14px rgba(255, 60, 40, 0.25));
  animation: coinFlip 6s linear infinite, stampBlink 4s steps(1, end) infinite;
  transform-origin: center center;
  transform-style: preserve-3d;
  will-change: transform;
}

.press-stamp-glow {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: clamp(120px, 20vw, 200px);
  height: clamp(120px, 20vw, 200px);
  margin-top: calc(clamp(120px, 20vw, 200px) / -2);
  margin-left: calc(clamp(120px, 20vw, 200px) / -2);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 140, 40, 0.18) 0%,
    rgba(255, 60, 40, 0.08) 40%,
    transparent 70%
  );
  filter: blur(8px);
  animation: stampPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes coinFlip {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes stampBlink {
  0%, 97% { opacity: 1; }
  98%, 99% { opacity: 0.7; }
  100% { opacity: 1; }
}

@keyframes stampPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.08); }
}

/* Rotating double ring (fire halo) */
.press-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 260px;
  height: 260px;
  margin: -130px 0 0 -130px;
  border: 2px dashed rgba(255, 210, 63, 0.35);
  border-radius: 50%;
  animation: ringSpin 12s linear infinite;
  box-shadow:
    0 0 24px rgba(255, 140, 40, 0.25),
    inset 0 0 24px rgba(255, 210, 63, 0.12);
}

.press-ring--reverse {
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-style: dotted;
  border-color: rgba(255, 140, 40, 0.55);
  animation: ringSpin 7s linear infinite reverse;
  box-shadow:
    0 0 18px rgba(255, 60, 40, 0.3),
    inset 0 0 18px rgba(255, 140, 40, 0.2);
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Orbiting sparks */
.press-flame {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 22px;
  color: var(--accent);
  text-shadow:
    0 0 10px rgba(255, 210, 63, 1),
    0 0 22px rgba(255, 140, 40, 0.8);
  margin: -11px 0 0 -11px;
  animation: orbit 6s linear infinite;
  transform-origin: 11px 11px;
}

.press-flame--a { animation-delay: 0s;   color: #ffd23f; }
.press-flame--b { animation-delay: -1.5s; color: #ff8850; }
.press-flame--c { animation-delay: -3s;   color: #ffd23f; }
.press-flame--d { animation-delay: -4.5s; color: #ff8850; }

@keyframes orbit {
  from {
    transform: rotate(0deg) translateX(130px) rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) translateX(130px) rotate(-180deg) scale(1.3);
  }
  to {
    transform: rotate(360deg) translateX(130px) rotate(-360deg) scale(1);
  }
}

@media (max-width: 640px) {
  .press-start { height: 100px; }
  .press-ring { width: 200px; height: 200px; margin: -100px 0 0 -100px; }
  .press-ring--reverse { width: 150px; height: 150px; margin: -75px 0 0 -75px; }
  @keyframes orbit {
    from { transform: rotate(0deg) translateX(95px) rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) translateX(95px) rotate(-180deg) scale(1.3); }
    to   { transform: rotate(360deg) translateX(95px) rotate(-360deg) scale(1); }
  }
}

/* === Background music control (top-right) === */
.bgm-control {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 10, 24, 0.65);
  border: 3px solid var(--accent);
  border-radius: 0;
  padding: 8px 12px;
  box-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.55),
    0 0 16px rgba(255, 210, 63, 0.25);
  backdrop-filter: blur(6px);
}

.bgm-toggle {
  background: transparent;
  border: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.6));
  transition: transform 100ms ease;
}
.bgm-toggle:hover { transform: scale(1.12); }
.bgm-toggle:active { transform: scale(0.94); }
.bgm-toggle.bgm-off { opacity: 0.6; filter: none; }

.bgm-control.bgm-waiting {
  animation: bgmWaitPulse 1.1s ease-in-out infinite;
}
.bgm-control.bgm-waiting .bgm-toggle {
  animation: bgmIconPulse 1.1s ease-in-out infinite;
}
@keyframes bgmWaitPulse {
  0%, 100% { box-shadow: 4px 4px 0 rgba(0,0,0,0.55), 0 0 16px rgba(255, 210, 63, 0.3); }
  50%      { box-shadow: 4px 4px 0 rgba(0,0,0,0.55), 0 0 32px rgba(255, 140, 40, 0.85); }
}
@keyframes bgmIconPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.15); opacity: 1; }
}

.bgm-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 210, 63, 0.4);
  border-radius: 0;
  cursor: pointer;
  outline: none;
}
.bgm-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 16px;
  background: var(--accent);
  border: 2px solid #1a1a1a;
  cursor: pointer;
  box-shadow: 1px 1px 0 #1a1a1a;
}
.bgm-volume::-moz-range-thumb {
  width: 14px;
  height: 16px;
  background: var(--accent);
  border: 2px solid #1a1a1a;
  cursor: pointer;
  box-shadow: 1px 1px 0 #1a1a1a;
}

@media (max-width: 640px) {
  .bgm-control { top: 10px; right: 10px; padding: 6px 9px; gap: 6px; }
  .bgm-volume { width: 70px; }
}

/* === Kick badge (top-left, fixed) === */
.kick-badge {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  background: #0a0a0a;
  color: #53fc18;
  border: 3px solid #53fc18;
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  box-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.55),
    0 0 16px rgba(83, 252, 24, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.kick-badge:hover {
  transform: translate(-2px, -2px);
  box-shadow:
    6px 6px 0 rgba(0, 0, 0, 0.6),
    0 0 28px rgba(83, 252, 24, 0.6);
}

.kick-badge:active {
  transform: translate(2px, 2px);
  box-shadow:
    1px 1px 0 rgba(0, 0, 0, 0.5),
    0 0 12px rgba(83, 252, 24, 0.4);
}

.kick-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.kick-label {
  display: inline-flex;
  align-items: center;
  color: #f3eedb;
  font-size: 11px;
  letter-spacing: 1px;
}

.kick-label strong {
  color: #53fc18;
  font-weight: normal;
  margin-left: 1px;
}

.kick-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 4px 8px;
  background: #d92424;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  border: 2px solid #1a1a1a;
  box-shadow: 2px 2px 0 #1a1a1a;
  animation: livePulse 1.6s ease-in-out infinite;
}

.kick-live[hidden] { display: none; }

.kick-live-dot {
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: liveDotBlink 1s steps(1, end) infinite;
}

.kick-badge.live {
  border-color: #ff3030;
  box-shadow:
    4px 4px 0 rgba(0, 0, 0, 0.6),
    0 0 22px rgba(255, 48, 48, 0.6);
  animation: liveBadgeGlow 2.4s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

@keyframes liveDotBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.25; }
}

@keyframes liveBadgeGlow {
  0%, 100% {
    box-shadow:
      4px 4px 0 rgba(0, 0, 0, 0.6),
      0 0 18px rgba(255, 48, 48, 0.5);
  }
  50% {
    box-shadow:
      4px 4px 0 rgba(0, 0, 0, 0.6),
      0 0 32px rgba(255, 48, 48, 0.85);
  }
}

@media (max-width: 640px) {
  .kick-badge {
    top: 10px;
    left: 10px;
    padding: 6px 10px 6px 6px;
    gap: 7px;
  }
  .kick-icon { width: 22px; height: 22px; }
  .kick-label { font-size: 9px; }
}

/* === Footer === */
.portal-footer {
  margin-top: 72px;
  opacity: 0.5;
  font-family: 'Handjet', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.6;
}

.portal-credit {
  font-size: 11px;
  letter-spacing: 3px;
  opacity: 0.75;
  margin-top: 4px;
}

.portal-credit a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: opacity 0.2s ease;
}

.portal-credit a:hover {
  opacity: 0.6;
}

/* === Small screens === */
@media (max-width: 640px) {
  .portal { padding: 40px 16px 32px; }
  .portal-title { letter-spacing: 3px; }
  .game-grid { grid-template-columns: 1fr; gap: 24px; }
  .game-card-frame { min-height: 320px; }
}
