/* ===== Overlay Panels ===== */
.overlay-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 2, 10, 0.72);
  backdrop-filter: blur(3px);
  padding: 1rem;
  animation: panelFade 0.25s ease-out;
  pointer-events: auto;
}

@keyframes panelFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel-frame {
  background: var(--panel-bg);
  border: 3px solid var(--panel-border);
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.3),
    0 0 40px rgba(255, 45, 149, 0.25),
    inset 0 0 60px rgba(0, 0, 0, 0.4);
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  position: relative;
  color: var(--cream);
}

.panel-title {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--neon-pink);
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 45, 149, 0.5);
  margin-bottom: 0.5rem;
}

.panel-sub {
  text-align: center;
  color: rgba(245, 230, 200, 0.6);
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.neon-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0.6rem auto;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 0.9rem 1rem;
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}

.neon-btn:hover {
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
  color: #fff;
}

.neon-btn:active { transform: scale(0.98); }

.close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 45, 149, 0.5);
  color: var(--neon-pink);
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-family: var(--font-mono);
  line-height: 1;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(255, 45, 149, 0.2);
  box-shadow: 0 0 10px rgba(255, 45, 149, 0.4);
}

.info-box {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(0, 240, 255, 0.3);
  background: rgba(0, 0, 0, 0.35);
  font-size: 1.15rem;
  line-height: 1.6;
}

.info-box p { margin-bottom: 0.4rem; }
.info-box .hint { color: var(--neon-orange); margin-top: 0.75rem; }

/* ===== Media Library ===== */
.media-frame {
  max-width: 960px;
  padding: 0;
  border-color: #2a4a6a;
  box-shadow:
    0 0 0 4px #1a1a1a,
    0 0 0 8px #4a3728,
    0 0 50px rgba(80, 140, 255, 0.2);
  background: #0c1018;
}

.media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #1a2540, #0e1525);
  border-bottom: 2px solid #3a5a8a;
}

.media-brand {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--neon-cyan);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3333;
  box-shadow: 0 0 8px #ff3333;
  animation: blink 1.5s step-end infinite;
}

.media-tabs {
  display: flex;
  gap: 0;
  background: #0a0e18;
  border-bottom: 1px solid #2a3a5a;
}

.media-tab {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.85rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(245, 230, 200, 0.5);
  cursor: pointer;
  transition: all 0.15s;
}

.media-tab:hover { color: var(--cream); background: rgba(0, 240, 255, 0.05); }
.media-tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.media-body {
  min-height: 340px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 1rem;
  position: relative;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}

.media-card {
  background: linear-gradient(160deg, #1a2030, #0e121c);
  border: 1px solid #2a3a55;
  padding: 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.media-card:hover {
  border-color: var(--neon-pink);
  box-shadow: 0 0 16px rgba(255, 45, 149, 0.3);
  transform: translateY(-2px);
}

.media-card-art {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: rgba(0, 0, 0, 0.4);
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.media-card-title {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: var(--cream);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.media-card-meta {
  font-size: 0.95rem;
  color: rgba(245, 230, 200, 0.45);
}

.media-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #0a0e18;
  border-top: 1px solid #2a3a5a;
  font-size: 1rem;
  color: rgba(245, 230, 200, 0.4);
}

/* Media player */
.media-player {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-screen {
  aspect-ratio: 4/3;
  max-height: 320px;
  background: #000;
  border: 3px solid #333;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-static {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: noiseMove 0.3s steps(3) infinite;
}

.player-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1.5rem;
}

.player-content .big-emoji { font-size: 4rem; margin-bottom: 0.75rem; }
.player-content h3 {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}
.player-content p {
  font-size: 1.2rem;
  color: rgba(245, 230, 200, 0.75);
  line-height: 1.5;
  max-width: 400px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem;
  background: #111820;
  border: 1px solid #2a3a55;
}

.tape-btn {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  padding: 0.6rem 0.9rem;
  background: #1a2535;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  cursor: pointer;
}

.tape-btn:hover { background: rgba(0, 240, 255, 0.15); }

.player-title {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--cream);
}

.player-status {
  font-size: 1rem;
  color: var(--crt-green);
  font-family: var(--font-mono);
}

/* ===== Chat Room ===== */
.chat-frame {
  max-width: 800px;
  padding: 0;
  border-color: #3366cc;
  background: #c0c0c0;
  color: #000;
  box-shadow: 4px 4px 0 #000, 0 0 40px rgba(51, 102, 204, 0.3);
}

.chat-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  padding: 0.4rem 0.75rem;
  font-family: 'Tahoma', 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-titlebar .close-btn {
  position: static;
  background: #c0c0c0;
  color: #000;
  border: 2px outset #fff;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.75rem;
  font-weight: bold;
}

.chat-body {
  display: flex;
  height: 380px;
  border: 2px inset #808080;
  margin: 4px;
  background: #fff;
}

.chat-sidebar {
  width: 160px;
  border-right: 2px solid #808080;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  font-family: 'Tahoma', sans-serif;
  font-size: 0.8rem;
}

.chat-sidebar-title {
  padding: 0.4rem;
  background: #d4d0c8;
  border-bottom: 1px solid #808080;
  font-weight: bold;
  font-size: 0.75rem;
}

.chat-users {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem;
}

.chat-users li {
  padding: 0.2rem 0.3rem;
  cursor: default;
}

.chat-users li:hover { background: #000080; color: #fff; }
.chat-users .host { color: #000080; font-weight: bold; }
.chat-users .you { color: #008000; font-weight: bold; }

.chat-sidebar-footer {
  padding: 0.3rem;
  font-size: 0.7rem;
  background: #d4d0c8;
  border-top: 1px solid #808080;
  color: #444;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  background: #fff;
  color: #000;
}

.chat-msg { margin-bottom: 0.25rem; word-wrap: break-word; }
.chat-msg .user { font-weight: bold; color: #000080; }
.chat-msg .user.you { color: #008000; }
.chat-msg .user.system { color: #808080; font-style: italic; }
.chat-msg.system-line { color: #808080; font-style: italic; }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  background: #d4d0c8;
  border-top: 2px solid #808080;
}

.chat-prompt {
  font-family: monospace;
  font-weight: bold;
  color: #000;
}

#chat-input {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 2px inset #808080;
  background: #fff;
  color: #000;
  outline: none;
}

.chat-send {
  font-family: 'Tahoma', sans-serif;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  background: #d4d0c8;
  border: 2px outset #fff;
  cursor: pointer;
}

.chat-send:active { border-style: inset; }

.chat-status {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0.6rem;
  font-family: 'Tahoma', sans-serif;
  font-size: 0.75rem;
  background: #d4d0c8;
  color: #333;
  border-top: 1px solid #808080;
}

/* ===== Market ===== */
.market-frame {
  max-width: 880px;
  border-color: var(--neon-orange);
  box-shadow: 0 0 40px rgba(255, 140, 66, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.market-header {
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
}

.market-header h2 {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: var(--neon-orange);
  text-shadow: 0 0 12px rgba(255, 140, 66, 0.5);
  margin-bottom: 0.35rem;
}

.market-header p {
  color: rgba(245, 230, 200, 0.55);
  font-size: 1.15rem;
}

.market-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.market-tab {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  padding: 0.7rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 140, 66, 0.4);
  color: rgba(245, 230, 200, 0.55);
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

.market-tab.active, .market-tab:hover {
  border-color: var(--neon-orange);
  color: var(--neon-orange);
  background: rgba(255, 140, 66, 0.1);
}

.market-body {
  min-height: 280px;
  max-height: 50vh;
  overflow-y: auto;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.market-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 140, 66, 0.3);
  padding: 0.85rem;
  transition: border-color 0.15s;
}

.market-item:hover { border-color: var(--neon-orange); }

.market-item-emoji { font-size: 2rem; margin-bottom: 0.4rem; }
.market-item-name {
  font-family: var(--font-pixel);
  font-size: 0.42rem;
  color: var(--cream);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.market-item-price {
  color: var(--crt-green);
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}
.market-item-seller {
  font-size: 0.95rem;
  color: rgba(245, 230, 200, 0.4);
  margin-bottom: 0.5rem;
}
.market-item-desc {
  font-size: 1rem;
  color: rgba(245, 230, 200, 0.55);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.buy-btn {
  width: 100%;
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  padding: 0.55rem;
  background: transparent;
  border: 1px solid var(--crt-green);
  color: var(--crt-green);
  cursor: pointer;
}

.buy-btn:hover {
  background: rgba(51, 255, 102, 0.12);
  box-shadow: 0 0 10px rgba(51, 255, 102, 0.25);
}

.buy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sell-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  margin: 0 auto;
}

.sell-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: rgba(245, 230, 200, 0.6);
}

.sell-form input,
.sell-form select,
.sell-form textarea {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 140, 66, 0.4);
  color: var(--cream);
  outline: none;
}

.sell-form input:focus,
.sell-form select:focus,
.sell-form textarea:focus {
  border-color: var(--neon-orange);
}

.sell-form textarea { min-height: 70px; resize: vertical; }

.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.inv-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(180, 74, 255, 0.35);
  padding: 0.7rem;
  font-size: 1.05rem;
}

.inv-item strong {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  display: block;
  margin-bottom: 0.3rem;
  color: var(--neon-purple);
}

.market-note {
  text-align: center;
  color: var(--neon-cyan);
  font-size: 1.2rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.market-empty {
  text-align: center;
  color: rgba(245, 230, 200, 0.4);
  padding: 2rem;
  font-size: 1.2rem;
}

/* ===== Arcade / Console ===== */
.arcade-frame, .console-frame {
  max-width: 560px;
  text-align: center;
  border-color: var(--neon-purple);
}

.arcade-header {
  position: relative;
  margin-bottom: 0.75rem;
}

.arcade-decade {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--neon-green, #33ff66);
  letter-spacing: 0.15em;
  border: 1px solid rgba(51, 255, 102, 0.4);
  padding: 0.25rem 0.6rem;
  margin-bottom: 0.5rem;
}

.arcade-frame h2, .console-frame h2 {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--neon-purple);
  text-shadow: 0 0 12px rgba(180, 74, 255, 0.5);
  margin-bottom: 0.35rem;
}

.arcade-tagline {
  font-size: 1.05rem;
  color: rgba(245, 230, 200, 0.55);
  margin: 0 0 0.25rem;
}

.arcade-pick-label {
  font-family: var(--font-pixel);
  font-size: 0.38rem;
  color: rgba(245, 230, 200, 0.5);
  margin: 0.75rem 0 0.5rem;
  letter-spacing: 0.06em;
}

.arcade-game-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.45rem;
  margin-bottom: 1rem;
  text-align: left;
}

.arcade-game-btn {
  appearance: none;
  border: 2px solid rgba(180, 74, 255, 0.35);
  background: rgba(20, 10, 28, 0.9);
  color: var(--cream);
  border-radius: 6px;
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  font-family: inherit;
  text-align: left;
}

.arcade-game-btn:hover {
  border-color: var(--neon-pink);
  transform: translateY(-1px);
}

.arcade-game-btn.active {
  border-color: var(--neon-green, #33ff66);
  box-shadow: 0 0 14px rgba(51, 255, 102, 0.25);
  background: rgba(20, 40, 28, 0.95);
}

.arcade-game-btn .ag-emoji {
  font-size: 1.25rem;
  display: block;
  margin-bottom: 0.2rem;
}

.arcade-game-btn .ag-title {
  font-family: var(--font-pixel);
  font-size: 0.36rem;
  line-height: 1.35;
  color: #fff;
}

.arcade-game-btn .ag-year {
  font-size: 0.85rem;
  color: rgba(245, 230, 200, 0.45);
  margin-top: 0.15rem;
}

.arcade-screen {
  background: #000;
  border: 4px solid #222;
  padding: 1.1rem 1.25rem 1.25rem;
  margin-bottom: 1rem;
  min-height: 160px;
  box-shadow: inset 0 0 30px rgba(180, 74, 255, 0.2);
  text-align: left;
}

.arcade-now-playing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.arcade-now-playing > span {
  font-size: 1.8rem;
}

.arcade-game-title {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--crt-green);
  line-height: 1.3;
}

.arcade-game-meta {
  font-size: 0.95rem;
  color: rgba(245, 230, 200, 0.5);
  margin-top: 0.2rem;
}

.arcade-screen pre {
  font-family: var(--font-pixel);
  font-size: 0.32rem;
  color: var(--crt-green);
  line-height: 1.25;
  white-space: pre;
  overflow: hidden;
  text-align: center;
  margin: 0.5rem 0;
}

.arcade-screen p {
  margin-top: 0.65rem;
  font-size: 1.1rem;
  color: var(--cream);
}

.arcade-blurb {
  color: rgba(245, 230, 200, 0.55) !important;
  font-size: 1rem !important;
  font-style: italic;
}

.arcade-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.arcade-actions .neon-btn {
  width: auto;
  margin: 0;
  min-width: 140px;
}

.cartridge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}

.cart-chip {
  font-family: var(--font-pixel);
  font-size: 0.38rem;
  padding: 0.5rem 0.7rem;
  background: #1a1020;
  border: 1px solid var(--neon-purple);
  color: var(--neon-purple);
}

.console-frame p {
  font-size: 1.2rem;
  color: rgba(245, 230, 200, 0.7);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

/* Scrollbars */
.media-body::-webkit-scrollbar,
.market-body::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.media-body::-webkit-scrollbar-thumb,
.market-body::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: #808080;
}

@media (max-width: 600px) {
  .chat-body { flex-direction: column; height: 420px; }
  .chat-sidebar { width: 100%; max-height: 100px; border-right: none; border-bottom: 2px solid #808080; }
  .chat-users { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
