/* public/styles.css */

:root {
  --bg: #ffffff;
  --turq: #14b8a6;
  --turq-soft: #e0fbf8;
  --text: #020617;
  --muted: #64748b;
  --border: #e2e8f0;
  --exp-bar: #39ff14; /* neon green */
  --hp-bar: #ff4d4d;
  --hp-bg: #ffe4e4;
  --exp-bg: #c7f6be;
  --card-bg: #ffffff;
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

/* NAVBAR */

#topNav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.nav-left .logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--turq);
}

.nav-left .tagline {
  font-size: 12px;
  color: var(--muted);
}

.nav-left {
  display: flex;
  flex-direction: column;
}

.nav-center {
  display: flex;
  gap: 8px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.nav-tab {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 6px 14px;
  font-size: 14px;
  background: transparent;
  cursor: pointer;
}

.nav-tab.active {
  background: var(--turq);
  color: white;
  border-color: var(--turq);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.4);
}

/* Buttons */

button {
  font-family: inherit;
}

.btn-primary {
  border-radius: 999px;
  border: none;
  padding: 6px 16px;
  background: var(--turq);
  color: #f8fafc;
  cursor: pointer;
}

.btn-outline {
  border-radius: 999px;
  padding: 6px 14px;
  border: 1px solid var(--turq);
  background: white;
  color: var(--turq);
  cursor: pointer;
}

.btn-outline.small {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-outline.small.danger {
  border-color: #ef4444;
  color: #ef4444;
}

.btn-ghost {
  border-radius: 999px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.btn-pill {
  border-radius: 999px;
  padding: 4px 12px;
  border: 1px solid white;
  background: rgba(15, 23, 42, 0.6);
  color: #f9fafb;
  cursor: pointer;
}

/* Game toggle */

.game-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.game-toggle span {
  font-size: 13px;
  color: var(--muted);
}

#gameToggle {
  border-radius: 999px;
  padding: 4px 12px;
  border: none;
  font-size: 12px;
  cursor: pointer;
}

#gameToggle.on {
  background: #22c55e;
  color: #f0fdf4;
}

#gameToggle.off {
  background: #f97373;
  color: #fef2f2;
}

/* Controls bar */

#controlsBar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 6px 20px;
  font-size: 13px;
  background: #f9fafb;
}

.controls-label {
  font-weight: 600;
}

.mobile-note {
  color: var(--muted);
}

/* Main content */

#mainContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.view.active {
  display: block;
}

/* PLAY AREA */

#playArea {
  position: relative;
  width: 100%;
  height: calc(100vh - 96px); /* nav + controls approx */
  background: #ffffff;
  overflow: hidden;
}

/* Background video */

#bgVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
}

/* Video grid */

#videoGridWrapper {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 16px 20px 120px;
  overflow-y: auto;
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.toolbar-row h2 {
  margin: 0;
  font-size: 18px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.video-thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.video-meta {
  padding: 10px 12px 12px;
}

.video-title {
  font-weight: 600;
  font-size: 14px;
}

.video-user {
  font-size: 12px;
  color: var(--muted);
}

/* Game canvas overlay */

#gameCanvas.game-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* so clicks still hit tiles */
}

/* HUD */

#hudBar {
  position: absolute;
  bottom: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 18px;
  z-index: 3;
  pointer-events: none;
}

.bar-group {
  flex: 1;
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}

.bar {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.bar .fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
}

.exp-bar {
  background: var(--exp-bg);
}
.exp-bar .fill {
  background: var(--exp-bar);
}

.hp-bar {
  background: var(--hp-bg);
}
.hp-bar .fill {
  background: var(--hp-bar);
}

.hud-right {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.hud-stat span:first-child {
  color: var(--muted);
}

/* Video controls */

#videoControls {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: white;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#videoControls.visible {
  opacity: 1;
  pointer-events: auto;
}

#videoProgressBg {
  width: 260px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.7);
  cursor: pointer;
}

#videoProgressFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #a3e635; /* lime */
}

/* Mobile controls */

#mobileControls {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

#rotateHint {
  font-size: 11px;
  color: #f9fafb;
  background: rgba(15, 23, 42, 0.7);
  padding: 3px 8px;
  border-radius: 999px;
}

.mobile-buttons {
  display: flex;
  gap: 4px;
}

.mobile-buttons button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.8);
  color: #f9fafb;
  font-size: 16px;
  cursor: pointer;
}

/* PROFILE */

#profileView {
  padding: 20px;
}

.profile-stats.hidden {
  display: none;
}

/* new uploads section */

.profile-uploads {
  margin-top: 24px;
}

.profile-uploads.hidden {
  display: none;
}

.profile-uploads h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.upload-item-info {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.upload-title {
  font-size: 14px;
  font-weight: 600;
}

.upload-meta {
  font-size: 11px;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.stat-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

/* UPLOAD */

#uploadView {
  padding: 20px;
}

.upload-form.hidden {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.field span {
  font-size: 13px;
  margin-bottom: 4px;
}

.field input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.upload-status {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* MODAL */

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 18px 18px 14px;
  width: 320px;
  max-width: 90%;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.45);
  z-index: 1;
}

.modal-content h2 {
  margin: 0 0 4px;
}

.modal-content p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.auth-form .field input {
  width: 100%;
}

.error-text {
  font-size: 12px;
  color: #ef4444;
  min-height: 16px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Utility */

.hidden {
  display: none !important;
}

/* Basic responsive tweak */

@media (max-width: 800px) {
  .nav-left .tagline {
    display: none;
  }
  #videoGridWrapper {
    padding-bottom: 150px;
  }
}
