/* FOBA OS Theme */
:root {
  --foba-bg: #07090e;
  --foba-bg-gradient: radial-gradient(circle at 50% 20%, #151b27 0%, #090c13 70%, #05070b 100%);
  --foba-surface: #121722;
  --foba-surface-hover: #1b2333;
  --foba-surface-active: #232d42;
  --foba-border: rgba(255, 255, 255, 0.08);
  
  --foba-cyan: #00f0ff;
  --foba-cyan-glow: rgba(0, 240, 255, 0.4);
  --foba-accent: #ff0055;
  --foba-accent-glow: rgba(255, 0, 85, 0.4);
  
  --foba-green: #00ff88;
  --foba-green-dark: #008f4c;
  --foba-green-glow: rgba(0, 255, 136, 0.35);
  
  --foba-text: #e2e8f0;
  --foba-text-muted: #8b9baa;
  --foba-text-dim: #556272;
  
  --foba-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --foba-font-mono: 'Share Tech Mono', monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--foba-bg);
  background-image: var(--foba-bg-gradient);
  color: var(--foba-text);
  font-family: var(--foba-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Optional CRT Scanlines Filter */
body.crt-enabled::before {
  content: " ";
  display: block;
  position: fixed;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  z-index: 9999;
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
}

/* Ambient Background Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 480px;
  background: radial-gradient(circle at 40% 15%, var(--foba-cyan-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
  transition: all 0.5s ease;
}

/* FOBA OS Topbar */
.foba-topbar {
  height: 54px;
  background: rgba(9, 12, 18, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--foba-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.foba-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.foba-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--foba-cyan) 0%, #0077ff 100%);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #05070b;
  box-shadow: 0 0 14px var(--foba-cyan-glow);
}
.foba-brand-text {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-transform: uppercase;
}
.foba-brand-text span {
  color: var(--foba-cyan);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  margin-left: 12px;
}
.nav-tab {
  background: transparent;
  border: none;
  color: var(--foba-text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}
.nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.nav-tab.active {
  color: #fff;
  background: rgba(0, 240, 255, 0.15);
  border-bottom: 2px solid var(--foba-cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.system-status {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--foba-text-muted);
}
.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.battery-pill {
  width: 22px;
  height: 11px;
  border: 1.5px solid var(--foba-text-muted);
  border-radius: 2px;
  padding: 1px;
  display: flex;
  align-items: center;
}
.battery-fill {
  width: 90%;
  height: 100%;
  background: var(--foba-green);
  border-radius: 1px;
}
.battery-cap {
  width: 2px;
  height: 5px;
  background: var(--foba-text-muted);
  border-radius: 0 1px 1px 0;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--foba-border);
  cursor: pointer;
  transition: border-color 0.2s;
}
.profile-chip:hover {
  border-color: var(--foba-cyan);
}
.profile-avatar {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--foba-cyan), #ff0055);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
}
.profile-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

/* Page Containers */
.foba-main {
  flex: 1;
  padding: 24px 32px 100px;
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-page {
  display: none;
  animation: fadeIn 0.2s ease-out;
}
.tab-page.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero "Currently Focused" Game (Home Page) */
.foba-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--foba-surface);
  border: 2px solid transparent;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  margin-bottom: 36px;
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 380px;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1);
}
.foba-hero:hover, .foba-hero:focus-within {
  border-color: var(--foba-cyan);
  box-shadow: 0 0 35px var(--foba-cyan-glow), 0 25px 60px rgba(0, 0, 0, 0.8);
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) blur(2px);
  transform: scale(1.05);
  transition: all 0.5s ease;
  z-index: 0;
}
.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11, 15, 23, 0.98) 0%, rgba(11, 15, 23, 0.88) 50%, rgba(11, 15, 23, 0.45) 100%);
  z-index: 1;
}

.hero-info {
  position: relative;
  z-index: 2;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.foba-verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.35);
  color: var(--foba-green);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.verified-icon {
  width: 16px;
  height: 16px;
  background: var(--foba-green);
  color: #07090e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 11px;
}

.hero-game-title {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 12px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}
.hero-game-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--foba-text-muted);
  max-width: 580px;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.foba-play-btn {
  background: linear-gradient(135deg, var(--foba-green) 0%, var(--foba-green-dark) 100%);
  color: #05070b;
  font-size: 15px;
  font-weight: 900;
  padding: 14px 34px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 8px 24px var(--foba-green-glow);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.foba-play-btn:hover {
  transform: scale(1.04);
  background: linear-gradient(135deg, #26ff9a 0%, #00a85a 100%);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.55);
}
.foba-play-btn:active {
  transform: scale(0.98);
}

.foba-secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--foba-text);
  font-size: 14px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
}
.foba-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.hero-stats-panel {
  position: relative;
  z-index: 2;
  background: rgba(9, 12, 18, 0.9);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--foba-border);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 12px;
}
.stat-label {
  font-size: 12px;
  color: var(--foba-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

/* Shelf & Capsules */
.shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}
.shelf-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.shelf-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--foba-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

.foba-capsules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.foba-capsule {
  position: relative;
  background: var(--foba-surface);
  border-radius: 12px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.foba-capsule:hover, .foba-capsule.focused {
  transform: translateY(-8px) scale(1.03);
  border-color: var(--foba-cyan);
  box-shadow: 0 0 25px var(--foba-cyan-glow), 0 16px 36px rgba(0, 0, 0, 0.7);
  z-index: 10;
}

.capsule-artwork {
  flex: 1;
  position: relative;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  overflow: hidden;
}
.capsule-artwork::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(9, 12, 18, 0.95) 100%);
}

.capsule-badge-verified {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: rgba(9, 12, 18, 0.85);
  border: 1px solid var(--foba-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foba-green);
  font-weight: 900;
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.capsule-title {
  position: relative;
  z-index: 2;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}
.capsule-sub {
  position: relative;
  z-index: 2;
  font-size: 11px;
  color: var(--foba-text-muted);
  font-weight: 600;
}

/* ================== LIBRARY VIEW ================== */
.library-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.lib-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lib-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--foba-border);
  color: var(--foba-text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.lib-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.lib-pill.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--foba-cyan);
  color: var(--foba-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

.lib-search-box {
  position: relative;
  min-width: 260px;
}
.lib-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--foba-border);
  color: #fff;
  padding: 8px 16px 8px 36px;
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}
.lib-search-input:focus {
  border-color: var(--foba-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}
.lib-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--foba-text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ================== SETTINGS VIEW ================== */
.settings-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  background: var(--foba-surface);
  border: 1px solid var(--foba-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.settings-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--foba-border);
  padding-right: 24px;
}
.settings-menu-btn {
  background: transparent;
  border: none;
  color: var(--foba-text-muted);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-menu-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.settings-menu-btn.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--foba-cyan);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border-bottom: 1px solid var(--foba-border);
  padding-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--foba-border);
  padding: 14px 18px;
  border-radius: 10px;
}
.setting-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.setting-info p {
  font-size: 12px;
  color: var(--foba-text-muted);
}
.setting-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--foba-border);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.setting-input:focus {
  border-color: var(--foba-cyan);
}
.setting-toggle {
  width: 44px;
  height: 24px;
  background: #252d3d;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.setting-toggle.on {
  background: var(--foba-cyan);
}
.setting-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.setting-toggle.on::after {
  transform: translateX(20px);
}

.setting-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--foba-border);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.setting-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.setting-btn.danger {
  color: #ff5566;
  border-color: rgba(255, 85, 102, 0.3);
}
.setting-btn.danger:hover {
  background: rgba(255, 85, 102, 0.2);
}

/* Bottom Bar */
.foba-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(9, 12, 18, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--foba-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  font-size: 12px;
  font-weight: 700;
  color: var(--foba-text-muted);
}
.controller-prompts {
  display: flex;
  align-items: center;
  gap: 20px;
}
.prompt-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-prompt {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e2638;
  border: 1px solid #364461;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-prompt.btn-a { border-color: var(--foba-green); color: var(--foba-green); }
.btn-prompt.btn-b { border-color: #ff3366; color: #ff3366; }
.btn-prompt.btn-x { border-color: var(--foba-cyan); color: var(--foba-cyan); }
.btn-prompt.btn-y { border-color: #ffb703; color: #ffb703; }

.footer-info {
  font-size: 11px;
  font-family: var(--foba-font-mono);
  color: var(--foba-text-dim);
}

/* Modal Player (FOBA Overlay) */
.foba-overlay-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.95);
  backdrop-filter: blur(20px);
  z-index: 1000;
  flex-direction: column;
}
.foba-overlay-modal.open {
  display: flex;
}
.overlay-topbar {
  height: 48px;
  background: #090c13;
  border-bottom: 1px solid var(--foba-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.overlay-game-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.overlay-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.overlay-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--foba-border);
  color: var(--foba-text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.overlay-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.overlay-btn.btn-exit {
  background: rgba(255, 51, 102, 0.18);
  border-color: rgba(255, 51, 102, 0.4);
  color: #ff6b8b;
}
.overlay-btn.btn-exit:hover {
  background: #ff3366;
  color: #fff;
}
.overlay-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

@media (max-width: 900px) {
  .foba-hero {
    grid-template-columns: 1fr;
  }
  .hero-stats-panel {
    display: none;
  }
  .settings-container {
    grid-template-columns: 1fr;
  }
  .settings-menu {
    border-right: none;
    border-bottom: 1px solid var(--foba-border);
    padding-bottom: 16px;
    padding-right: 0;
    flex-direction: row;
    overflow-x: auto;
  }
}
