/* ===== Musfir's World — global styles ===== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --coral: #ff6b6b;
  --orange: #ff9f43;
  --yellow: #ffd93d;
  --grass: #6bcB77;
  --sky: #4d96ff;
  --purple: #9b5de5;
  --pink: #ff70a6;
  --dark: #2b2d42;
  --gray: #6b7280;
  --bg: #fef9f4;
  --card-bg: #ffffff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(43, 45, 66, 0.12);
  --shadow-hover: 0 14px 32px rgba(43, 45, 66, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .logo, .btn, .pill {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow);
}

.btn:hover, .btn:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: var(--shadow-hover);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary { background: var(--coral); color: #fff; }
.btn-secondary { background: var(--sky); color: #fff; }
.btn-accent { background: var(--yellow); color: var(--dark); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-outline { background: #fff; color: var(--dark); border: 2px solid var(--dark); box-shadow: none; }
.btn-sm { padding: 8px 18px; font-size: 0.9rem; }
.btn-danger { background: #fff; color: var(--coral); border: 2px solid var(--coral); box-shadow: none; }

/* ===== Nav ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  color: var(--dark);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-links a:hover {
  background: var(--yellow);
  transform: translateY(-2px);
}

.nav-links a.active {
  background: var(--coral);
  color: #fff;
}

.auth-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-greeting {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 4px;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--dark);
}

@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 10px 20px 20px;
    display: none;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; text-align: center; }
}

/* ===== Hero ===== */

.hero {
  background: linear-gradient(120deg, var(--sky), var(--purple) 55%, var(--pink));
  color: #fff;
  padding: 70px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.25) 2px, transparent 2px);
  background-size: 28px 28px;
  opacity: 0.5;
}

.hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 14px;
  text-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

.hero p {
  font-size: 1.2rem;
  margin: 0 0 30px;
  opacity: 0.95;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Sections ===== */

.section {
  padding: 60px 20px;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin: 0 0 10px;
}

.section-subtitle {
  text-align: center;
  color: var(--gray);
  margin: 0 0 40px;
  font-size: 1.05rem;
}

.page-header {
  text-align: center;
  padding: 50px 20px 20px;
}

.page-header h1 {
  font-size: 2.4rem;
  margin: 0 0 10px;
}

.page-header p {
  color: var(--gray);
  font-size: 1.1rem;
}

/* ===== Cards / grids ===== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.card-media {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  color: #fff;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-body h3 {
  margin: 0;
  font-size: 1.15rem;
}

.card-meta {
  color: var(--gray);
  font-size: 0.85rem;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

/* game/feature cards with emoji icon */
.icon-card {
  text-align: center;
  padding: 26px 18px;
  text-decoration: none;
  color: var(--dark);
}

.icon-card .emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
}

/* ===== Gallery-specific ===== */

.dropzone {
  border: 3px dashed var(--sky);
  border-radius: var(--radius-lg);
  background: #f0f7ff;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-bottom: 40px;
}

.dropzone.dragover {
  background: #e0efff;
  border-color: var(--purple);
}

.dropzone .emoji {
  font-size: 2.6rem;
}

.dropzone p {
  margin: 8px 0 0;
  color: var(--gray);
  font-weight: 700;
}

.dropzone input[type="file"] {
  display: none;
}

/* Lightbox modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 30, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  overflow: hidden;
  position: relative;
  animation: pop 0.2s ease;
}

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-media {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  color: #fff;
}

.modal-media img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
}

.modal-body {
  padding: 18px 22px 22px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 2;
}

/* ===== Games ===== */

.game-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
}

.game-menu a.card {
  background: #fff;
}

.game-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 40px;
}

.game-section h2 {
  margin-top: 0;
  text-align: center;
}

.game-status {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 10px 0 20px;
  color: var(--purple);
}

/* Tic Tac Toe */

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 90px);
  grid-template-rows: repeat(3, 90px);
  gap: 8px;
  justify-content: center;
  margin: 0 auto 20px;
}

.ttt-cell {
  background: #f0f4ff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 2.4rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--dark);
  transition: background 0.15s ease;
}

.ttt-cell:hover {
  background: var(--yellow);
}

/* Memory */

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  gap: 10px;
  justify-content: center;
  margin: 0 auto 20px;
}

.memory-card {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--sky);
  color: transparent;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.memory-card.flipped, .memory-card.matched {
  background: #fff;
  color: var(--dark);
  border: 2px solid var(--yellow);
  transform: rotateY(360deg);
}

.memory-card.matched {
  border-color: var(--grass);
  cursor: default;
}

/* Custom matching game (create + play) */

.match-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  max-width: 640px;
  margin: 0 auto 20px;
}

.match-card {
  min-height: 90px;
  border-radius: var(--radius-sm);
  background: var(--sky);
  color: transparent;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  word-break: break-word;
}

.match-card.flipped, .match-card.matched {
  background: #fff;
  color: var(--dark);
  border: 2px solid var(--yellow);
}

.match-card.matched {
  border-color: var(--grass);
  cursor: default;
}

.pair-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pair-row input {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #e5e7eb;
  font-family: inherit;
  font-size: 1rem;
}

.pair-row input:focus {
  outline: none;
  border-color: var(--sky);
}

.pair-row .pair-remove {
  background: none;
  border: none;
  color: var(--coral);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.share-link-box {
  display: none;
  background: #eafff0;
  border: 2px solid var(--grass);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  text-align: center;
}

.share-link-box.show {
  display: block;
  animation: pop 0.25s ease;
}

.share-link-row {
  display: flex;
  gap: 8px;
  max-width: 500px;
  margin: 14px auto;
}

.share-link-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #e5e7eb;
  font-family: inherit;
  font-size: 0.9rem;
}

/* Snake */

.snake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#snakeCanvas {
  background: #1b1f3b;
  border-radius: var(--radius-md);
  max-width: 100%;
  touch-action: none;
}

.touch-controls {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 6px;
  justify-content: center;
}

.touch-controls button {
  font-size: 1.4rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--purple);
  color: #fff;
  cursor: pointer;
}

.tc-up { grid-column: 2; grid-row: 1; }
.tc-left { grid-column: 1; grid-row: 2; }
.tc-down { grid-column: 2; grid-row: 2; }
.tc-right { grid-column: 3; grid-row: 2; }

/* ===== Minecraft builder ===== */

.builder-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.palette button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 3px solid transparent;
  cursor: pointer;
}

.palette button.selected {
  border-color: var(--dark);
}

#builderCanvas {
  background: #cdeafe;
  border-radius: var(--radius-md);
  max-width: 100%;
  touch-action: none;
}

/* ===== Contact form ===== */

.contact-form {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid #e5e7eb;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sky);
}

.form-note {
  font-size: 0.85rem;
  color: var(--gray);
  text-align: center;
  margin-top: 16px;
}

.success-panel {
  display: none;
  text-align: center;
  background: #eafff0;
  border: 2px solid var(--grass);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 20px;
}

.success-panel.show {
  display: block;
  animation: pop 0.25s ease;
}

.success-panel .emoji {
  font-size: 2.6rem;
}

/* ===== Footer ===== */

.site-footer {
  margin-top: auto;
  background: var(--dark);
  color: #fff;
  text-align: center;
  padding: 34px 20px;
}

.site-footer .footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.site-footer a {
  text-decoration: none;
  color: #fff;
  font-weight: 700;
}

.site-footer a:hover {
  color: var(--yellow);
}

.footer-tagline {
  font-family: 'Baloo 2', sans-serif;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.footer-note {
  color: #b8b9c8;
  font-size: 0.85rem;
}

/* ===== Misc utility ===== */

.empty-state {
  text-align: center;
  color: var(--gray);
  padding: 30px;
  font-size: 1.05rem;
}

.small-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  justify-content: center;
}

.small-form input {
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  font-family: inherit;
}

@media (max-width: 480px) {
  .ttt-board { grid-template-columns: repeat(3, 78px); grid-template-rows: repeat(3, 78px); }
  .memory-board { grid-template-columns: repeat(4, 64px); }
  .memory-card { width: 64px; height: 64px; font-size: 1.5rem; }
}
