/* =================================================================
   SchoolBros — game-player.css
   Emulator Player UI — Marathon Protocol Theme
   Acid green #CCFF00 × black #050505 brutalist
   ================================================================= */

/* ── Player Layout ──────────────────────────────────────────────── */
.emu-page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.emu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
}

.emu-main-col  { padding: 1.5rem 1.5rem 3rem 2rem; }
.emu-side-col  {
  padding: 1.5rem 2rem 3rem 1.5rem;
  border-left: 1px solid var(--border);
}

/* ── Player Card ─────────────────────────────────────────────────── */
.emu-player-card {
  position: relative;
  background: #000;
  border: 1px solid rgba(204,255,0,0.2);
  aspect-ratio: 4/3;
  width: 100%;
  transition: border-color 0.4s ease;
  transform: translateZ(0);
  will-change: transform;
}
.emu-player-card:hover {
  border-color: rgba(204,255,0,0.5);
}

.emu-player-card:fullscreen {
  aspect-ratio: unset;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.emu-player-card:fullscreen .emu-narrow-overlay { display: none; }

/* EmulatorJS mounts here */
#emu-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateZ(0);
  will-change: transform;
}

/* ── Overlays (shared base) ────────────────────────────────────── */
.emu-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.emu-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Play Overlay ────────────────────────────────────────────────── */
#emu-play-overlay {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.88) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.emu-play-overlay-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(204,255,0,0.06) 0%, transparent 70%);
  animation: subtle-pulse 4s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.emu-play-poster {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  opacity: 0.12;
  user-select: none;
}

.emu-play-content {
  position: relative;
  z-index: 2;
}

.emu-play-title {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.emu-play-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.emu-play-btn-large {
  width: 80px;
  height: 80px;
  background: #CCFF00;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(204,255,0,0.4);
  animation: play-pulse 2.5s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin: 0 auto 1.25rem;
}

.emu-play-btn-large:hover {
  transform: scale(1.05);
  animation: none;
  box-shadow: 0 0 40px rgba(204,255,0,0.5);
}

@keyframes play-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204,255,0,0.5); }
  50%       { box-shadow: 0 0 0 20px rgba(204,255,0,0); }
}

.emu-play-btn-large svg {
  width: 32px; height: 32px; fill: #000; margin-left: 5px;
}

.emu-play-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ── Legal / Upload Overlays ─────────────────────────────────────── */
#emu-legal-section,
#emu-upload-section,
#emu-bios-upload-section {
  background: rgba(13, 15, 20, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.emu-modal-inner {
  background: var(--surface);
  border: 1px solid rgba(204,255,0,0.2);
  border-radius: 0;
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.9), 0 0 0 1px rgba(204,255,0,0.1);
  animation: modal-in 0.3s ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.emu-modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.emu-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.emu-modal-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* Legal notice box inside modal */
.emu-legal-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  color: #fbbf24;
  line-height: 1.6;
  text-align: left;
}

.emu-legal-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.emu-legal-check-row input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.emu-legal-check-row label {
  font-size: 0.875rem;
  color: var(--text-soft);
  cursor: pointer;
  line-height: 1.5;
}

/* ── Dropzone ─────────────────────────────────────────────────────── */
.emu-dropzone {
  border: 1px dashed rgba(204,255,0,0.25);
  border-radius: 0;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-alt);
  margin-bottom: 1.25rem;
}

.emu-dropzone:hover, .emu-dropzone.drag-over {
  border-color: #CCFF00;
  background: rgba(204,255,0,0.05);
}

.emu-dropzone.success {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.emu-dropzone.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.dropzone-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.dropzone-label {
  font-size: 0.875rem;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.dropzone-hint { font-size: 0.75rem; color: var(--text-muted); }

/* Hidden file input */
.emu-file-input-hidden { display: none; }

/* ── Loading Overlay ─────────────────────────────────────────────── */
#emu-loading-overlay {
  background: rgba(13, 15, 20, 0.97);
}

.emu-loading-spinner {
  width: 56px; height: 56px;
  border: 3px solid var(--surface-alt);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 1.25rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.emu-loading-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

#emu-loading-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  min-height: 1.2em;
}

.emu-loading-bar-wrap {
  width: 240px;
  height: 4px;
  background: var(--surface-alt);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
}

#emu-loading-bar {
  height: 100%;
  width: 0%;
  background: #CCFF00;
  border-radius: 0;
  transition: width 0.5s ease;
}

/* ── Error Overlay ───────────────────────────────────────────────── */
#emu-error-overlay, #wasm-error-overlay {
  background: rgba(13, 15, 20, 0.98);
  z-index: 999;
}

.emu-error-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.emu-error-title { font-size: 1.1rem; font-weight: 800; color: #ef4444; margin-bottom: 0.5rem; }
#emu-error-msg, #wasm-error-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 360px;
  white-space: pre-line;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* ── Narrow / Portrait Overlay ───────────────────────────────────── */
#emu-narrow-overlay {
  background: rgba(13, 15, 20, 0.97);
}

.emu-narrow-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  animation: rotate-phone 2s ease-in-out infinite;
}

@keyframes rotate-phone {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(90deg); }
}

.emu-narrow-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.emu-narrow-body  { font-size: 0.85rem; color: var(--text-muted); }

/* ── Toolbar (below player card) ── */
.emu-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid rgba(204,255,0,0.15);
  border-radius: 0;
  margin-top: 0.5rem;
  box-shadow: none;
}

.emu-toolbar-left  { display: flex; align-items: center; gap: 0.4rem; }
.emu-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }

.emu-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  color: #737373;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.emu-tool-btn:hover {
  border-color: rgba(204,255,0,0.4);
  color: #CCFF00;
}

.emu-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.emu-tool-btn.primary {
  background: #CCFF00;
  border-color: #CCFF00;
  color: #000;
  font-weight: 700;
}

.emu-tool-btn.primary:hover {
  background: #aaff00;
  border-color: #aaff00;
}

.emu-slot-select {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

/* ── Settings Panel ── */
.emu-side-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(204,255,0,0.15);
  border-radius: 0;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
  box-shadow: none;
  animation: panel-in 0.2s ease both;
}

.emu-side-panel.hidden { display: none; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.emu-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.emu-panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.emu-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.emu-panel-close:hover { color: var(--text); }

/* Settings rows */
.emu-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
}
.emu-setting-row:last-child { border-bottom: none; }
.emu-setting-label { color: var(--text-soft); }
.emu-setting-value {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
}

/* Controls table */
#controls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
#controls-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
}
#controls-table td {
  padding: 0.45rem 0.5rem 0.45rem 0;
  color: var(--text-soft);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#controls-table tr:last-child td { border-bottom: none; }

.kbd {
  display: inline-flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.emu-sidebar-section {
  margin-bottom: 1.75rem;
}

.emu-sidebar-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Related game cards */
.emu-related-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: none;
}

.emu-related-card:hover {
  border-color: rgba(204,255,0,0.4);
  background: var(--surface-alt);
}

.emu-related-thumb {
  width: 60px;
  height: 38px;
  border-radius: 0;
  overflow: hidden;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.emu-related-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.emu-related-info { flex: 1; min-width: 0; }
.emu-related-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emu-related-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ── Toast ───────────────────────────────────────────────────────── */
.emu-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #CCFF00;
  border: none;
  border-radius: 0;
  padding: 0.6rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.emu-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Article Content ─────────────────────────────────────────────── */
.emu-article {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.emu-article-section {
  margin-bottom: 2.5rem;
}

.emu-article-section h2 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.emu-article-section h2::before {
  content: '';
  display: block;
  width: 3px;
  height: 1.2em;
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  border-radius: 3px;
  flex-shrink: 0;
}

.emu-article-section p,
.emu-article-section li {
  color: var(--text-soft);
  font-size: 0.94rem;
  line-height: 1.8;
}

.emu-article-section ul,
.emu-article-section ol {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

.emu-article-section li { margin-bottom: 0.3rem; }

/* Legal notice box */
.emu-legal-notice {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: #fbbf24;
  line-height: 1.7;
}

.emu-legal-notice strong { color: #fde047; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .emu-layout {
    grid-template-columns: 1fr;
  }
  .emu-side-col {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 2rem;
  }
  .emu-player-card { aspect-ratio: 4/3; }
}

@media (max-width: 640px) {
  .emu-main-col { padding: 1rem; }
  .emu-toolbar {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .emu-toolbar-right { margin-left: 0; }
  .emu-tool-btn { font-size: 0.78rem; padding: 0.4rem 0.65rem; }
}
