/* COSYgames Shared Styles */

:root {
  --cg-footer-bg: #1F2937;
  --cg-footer-text: #F9FAFB;
  --cg-footer-muted: #9CA3AF;
  --cg-footer-link: #6EE7B7;

  --cg-font-heading: 'Fraunces', Georgia, serif;
  --cg-font-body: 'Nunito', 'DM Sans', system-ui, -apple-system, sans-serif;

  --cg-color-bg: var(--cream, #fdfcf8);
  --cg-color-surface: var(--surface-color, #FFFFFF);
  --cg-color-text: var(--ink, #2a2a2a);
  --cg-color-muted: var(--ink-faint, #5c5957);

  --cg-color-teal: var(--sage, #416b49);
  --cg-color-teal-dark: var(--sage-dark, #375742);
  --cg-color-teal-light: var(--sage-light, #e8f0e9);

  --cg-color-plum: #7E22CE;
  --cg-color-plum-dark: #6B21A8;
  --cg-color-plum-light: #F3E8FF;

  --cg-color-gold: #D97706;
  --cg-color-gold-dark: #B45309;
  --cg-color-gold-light: #FEF3C7;

  --cg-radius-sm: 8px;
  --cg-radius-md: 12px;
  --cg-radius-lg: 20px;

  --cg-shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --cg-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --cg-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --cg-transition: all 0.25s ease;
}

/* Base resets & box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

.level-note {
  margin: .5rem auto 0;
  max-width: 40rem;
  padding: .5rem .75rem;
  font-size: .9rem;
  color: var(--ink);
  background: var(--surface-color);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
}

.setup-note {
  font-size: .9rem;
  color: var(--ink-soft);
  margin: .25rem 0 0;
}

body.cosy-game-theme {
  margin: 0;
  padding: 0;
  font-family: var(--cg-font-body);
  background-color: var(--cg-color-bg);
  color: var(--cg-color-text);
  line-height: 1.5;
}

/* Header & Navigation Bar */
.cg-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--cg-color-surface);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--cg-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cg-nav-brand-icon {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--teal);
}

.cg-brand {
  font-family: var(--cg-font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cg-color-teal-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.cg-nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cg-nav-links a {
  color: var(--cg-color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--cg-transition);
}

.cg-nav-links a:hover {
  color: var(--cg-color-teal);
}

/* Game Cards Layout Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 0;
}

.game-card {
  background: var(--cg-color-surface);
  border-radius: var(--cg-radius-lg);
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--cg-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--cg-transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cg-shadow-lg);
  border-color: var(--cg-color-teal);
}

.game-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.game-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.game-card-title {
  font-family: var(--cg-font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--cg-color-text);
}

.game-card-description {
  font-size: 0.95rem;
  color: var(--cg-color-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.game-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.game-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: #E5E7EB;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.game-tag.solo {
  background: var(--cg-color-teal-light);
  color: var(--cg-color-teal-dark);
}

.game-tag.group {
  background: var(--cg-color-plum-light);
  color: var(--cg-color-plum-dark);
}

.game-tag.mystery {
  background: var(--cg-color-gold-light);
  color: var(--cg-color-gold-dark);
}

/* Buttons & Interactive Elements */
.cg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  min-height: 44px;
  border-radius: var(--cg-radius-md);
  font-family: var(--cg-font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--cg-transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cg-btn:focus-visible {
  outline: 3px solid var(--cg-color-teal, #0D9488);
  outline-offset: 2px;
}

.cg-btn-primary {
  background-color: var(--cg-color-teal);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.cg-btn-primary:hover {
  background-color: var(--cg-color-teal-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3);
}

.cg-btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.cg-btn-secondary {
  background-color: #E5E7EB;
  color: var(--cg-color-text);
}

.cg-btn-secondary:hover {
  background-color: #D1D5DB;
  transform: translateY(-1px);
}

.cg-btn-secondary:active {
  transform: translateY(1px) scale(0.98);
}

.cg-btn-outline {
  background: transparent;
  border: 2px solid var(--cg-color-teal);
  color: var(--cg-color-teal);
}

.cg-btn-outline:hover {
  background-color: var(--cg-color-teal-light);
  transform: translateY(-1px);
}

.report-issue-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.5rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 150ms ease;
}

.report-issue-link:hover {
  color: #FFFFFF;
  text-decoration: underline;
}

.game-header-info {
  padding: 1.25rem 1.5rem;
  background: var(--cg-color-surface);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.game-description {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  color: var(--cg-color-text);
}

.game-canvas-area {
  min-height: 320px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.game-content-placeholder {
  margin-top: 1rem;
}

.score-tracking-section {
  padding: 1.25rem 1.5rem;
  background: var(--surface-color, #FAF7F2);
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.related-tools-links {
  font-size: 0.9rem;
}

.related-tools-links a {
  color: var(--teal);
  text-decoration: none;
}

.related-tools-links a:hover {
  text-decoration: underline;
}

html[data-theme="dark"] .related-tools-links a,
body.theme-dark .related-tools-links a {
  color: #e8f0e9;
}

#game-canvas select {
  background: var(--surface-color);
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: var(--cg-radius-sm);
  padding: 0.5rem 0.75rem;
  font: inherit;
  min-height: 44px;
}

#game-canvas select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Section titles & Hero */
.hero-section {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  background: linear-gradient(135deg, #FAF7F2 0%, #F3EFE6 100%);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.hero-section h1 {
  font-family: var(--cg-font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--cg-color-teal-dark);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--cg-color-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.35s ease forwards;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.animate-pulse {
  animation: pulse 1.8s infinite ease-in-out;
}

/* Display Context Adaptations */

/* Projector (Classroom / Offline) Context */
html[data-context="projector"] body,
[data-context="projector"] body {
  font-size: 1.15rem;
}

html[data-context="projector"] .cg-btn,
[data-context="projector"] .cg-btn {
  padding: 0.85rem 1.75rem;
  font-size: 1.1rem;
  border-width: 3px;
  min-height: 52px;
}

html[data-context="projector"] .hero-section h1,
[data-context="projector"] .hero-section h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
}

/* Phone (Mobile) Context */
html[data-context="phone"] body,
[data-context="phone"] body {
  font-size: 0.95rem;
  padding-bottom: max(1rem, var(--safe-bottom, 0px));
}

html[data-context="phone"] .cg-btn,
[data-context="phone"] .cg-btn {
  min-height: 48px;
  padding: 0.65rem 1rem;
  width: 100%;
}

html[data-context="phone"] .hero-section,
[data-context="phone"] .hero-section {
  padding: 2rem 1rem 1.25rem;
}

html[data-context="phone"] .game-grid,
[data-context="phone"] .game-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Online (Screen-Share / Laptop) Context */
html[data-context="online"] body,
[data-context="online"] body {
  font-size: 1rem;
}

html[data-context="online"] .cg-btn,
[data-context="online"] .cg-btn {
  min-height: 44px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .cg-header-nav {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .cg-nav-links {
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }
}

/* ── FOOTER COMPONENT ── */
.cg-footer {
  margin-top: 2rem;
  padding: 2rem 1.5rem;
  background: var(--cg-footer-bg);
  color: var(--cg-footer-text);
  text-align: center;
}

.cg-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cg-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--cg-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.cg-footer-logo {
  width: 24px;
  height: 24px;
}

.cg-footer-tagline,
.cg-footer-desc {
  margin: 0;
  color: var(--cg-footer-muted);
  font-size: 0.95rem;
}

.cg-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.cg-footer-link,
.cg-footer-links a {
  color: var(--cg-footer-link);
  text-decoration: none;
  font-weight: 600;
  transition: color 150ms ease;
}

.cg-footer-link:hover,
.cg-footer-links a:hover {
  text-decoration: underline;
}

.cg-footer-copy {
  font-size: 0.85rem;
  color: var(--cg-footer-muted);
  margin-top: 1rem;
}
