/* ══════════════════════════════════════════════════════════════════════════ */
/* PUZZLE CAMPAIGN — styled to match Aaral Campus Store's products page        */
/* Tokens below are copied from products.css so this page reads as part of    */
/* the same app, not a separate microsite.                                    */
/* ══════════════════════════════════════════════════════════════════════════ */

:root {
  --color-primary-yellow: #FFCC33;
  --color-accent-teal: #00897B;
  --color-teal-light: #E6F4F1;
  --color-teal-dark: #00695C;
  --color-bg-main: #F3F4F6;
  --color-card-bg: #FFFFFF;
  --color-text-dark: #1F2937;
  --color-text-muted: #6B7280;
  --color-border: #E5E7EB;
  --color-red: #EF4444;
  --color-navy-border: #1B2E5E;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--color-text-dark);
  background-color: var(--color-bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 68px;
  padding-bottom: 40px;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* TOP BAR — same slot layout/appearance as the products page: circular       */
/* back button, navy-bordered, floating over a transparent strip.             */
/* ─────────────────────────────────────────────────────────────────────────── */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-navy-border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: background-color 0.15s;
}

.back-btn:hover { background-color: var(--color-bg-main); }
.back-btn:active { transform: scale(0.95); }

.top-bar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-dark);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* INTRO                                                                        */
/* ─────────────────────────────────────────────────────────────────────────── */

.intro {
  padding: 20px 16px 4px;
  max-width: 640px;
}

.intro .eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-teal-dark);
  margin-bottom: 6px;
}

.intro h1 {
  font-size: clamp(21px, 4vw, 27px);
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--color-text-dark);
}

.intro p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin: 0;
  max-width: 56ch;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* STAGE / LAYOUT                                                              */
/* ─────────────────────────────────────────────────────────────────────────── */

.stage {
  padding: 16px 16px 24px;
  max-width: 640px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* PUZZLE CARD — same card shell as .product-card (border, radius, shadow)    */
/* ─────────────────────────────────────────────────────────────────────────── */

.puzzle-card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
}

.puzzle-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stat-group { display: flex; gap: 20px; }

.stat { display: flex; flex-direction: column; gap: 1px; }

.stat .stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.stat .stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-dark);
}

.toolbar-actions { display: flex; gap: 8px; }

.icon-btn {
  border: 1.5px solid var(--color-border);
  background-color: var(--color-card-bg);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--color-accent-teal);
  color: var(--color-teal-dark);
  background-color: var(--color-teal-light);
}

.icon-btn:active { transform: scale(0.96); }
.icon-btn[disabled] { opacity: 0.45; pointer-events: none; }

/* Board */
.board-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.already-played {
  display: none;
  background-color: var(--color-teal-light);
  color: var(--color-teal-dark);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.already-played.show { display: block; }

.already-played strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
  font-weight: 700;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background-color: #F9FAFB;
  border: 1px solid var(--color-border);
  touch-action: none;
  user-select: none;
}

.tile {
  position: absolute;
  width: calc(100% / 3);
  height: calc(100% / 3);
  background-size: 300% 300%;
  background-repeat: no-repeat;
  transition: top 0.22s cubic-bezier(0.4, 0, 0.2, 1), left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -0.5px;
}

.tile:hover { filter: brightness(1.04); }
.tile:active { filter: brightness(0.97); }

.tile.empty {
  cursor: default;
  background: var(--color-bg-main);
  outline: none;
}

.tile.empty:hover { filter: none; }

.reference-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.reference-toggle input { accent-color: var(--color-accent-teal); }

.reference-preview {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  max-width: 120px;
  opacity: 0;
  max-height: 0;
  transition: opacity 0.2s ease;
}

.reference-preview.visible {
  opacity: 1;
  max-height: unset;
}

.reference-preview img { aspect-ratio: 1/1; object-fit: cover; }

/* View product CTA — sits inside the puzzle card, no separate product card */
.view-product-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 100px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn-teal { background-color: var(--color-accent-teal); color: #fff; }
.btn-teal:hover { background-color: var(--color-teal-dark); }

.btn-yellow { background-color: var(--color-primary-yellow); color: var(--color-text-dark); }
.btn-yellow:hover { background-color: #F5C200; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-dark);
}
.btn-outline:hover { border-color: var(--color-accent-teal); color: var(--color-teal-dark); }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ─────────────────────────────────────────────────────────────────────────── */
/* SUCCESS / ENTRY OVERLAY                                                     */
/* ─────────────────────────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 55, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.visible { opacity: 1; pointer-events: auto; }

.overlay-card {
  background-color: var(--color-card-bg);
  border-radius: 14px;
  max-width: 420px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 22px 22px;
  box-shadow: 0 24px 60px -20px rgba(31, 41, 55, 0.35);
  position: relative;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.overlay.visible .overlay-card { transform: translateY(0) scale(1); }

.overlay-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--color-accent-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}

.overlay-card h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--color-text-dark);
}

.overlay-card > p.overlay-msg {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.result-stats {
  display: flex;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.entry-form label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: -4px;
}

.entry-form input {
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background-color: var(--color-card-bg);
  color: var(--color-text-dark);
}

.entry-form input:focus { border-color: var(--color-accent-teal); outline: none; }

.field-error { font-size: 11.5px; color: var(--color-red); display: none; }
.field-error.show { display: block; }

.overlay-actions { display: flex; flex-direction: column; gap: 10px; }
.overlay-actions .row { display: flex; gap: 10px; }
.overlay-actions .row .btn { width: auto; flex: 1; }

.download-note {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 2px;
}

.confirm-banner {
  background-color: var(--color-teal-light);
  color: var(--color-teal-dark);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
  display: none;
}
.confirm-banner.show { display: block; }

.close-x {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-muted);
  line-height: 1;
  padding: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* BOARD LOCK SCRIM                                                            */
/* ─────────────────────────────────────────────────────────────────────────── */

.board-scrim {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background-color: rgba(31, 41, 55, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 5;
}

.board-scrim.show { display: flex; }

.board-scrim-inner { color: #fff; padding: 0 24px; }
.board-scrim .lock-icon { font-size: 24px; margin-bottom: 8px; }
.board-scrim p { font-size: 13px; line-height: 1.5; margin: 0; }

/* ─────────────────────────────────────────────────────────────────────────── */
/* FOOTER                                                                       */
/* ─────────────────────────────────────────────────────────────────────────── */

.site-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--color-text-muted);
  padding: 20px 16px 8px;
}
