/* Daily Puzzle Powers - Post-it Note Aesthetic */

/* ========================================
   CSS Variables
   ======================================== */
:root {
  /* Paper colors */
  --paper-bg: #f5f5dc;
  --paper-lines: #c5d5e5;
  --paper-margin: #e8a0a0;

  /* Post-it colors */
  --postit-yellow: #fff740;
  --postit-yellow-shadow: #e6de3a;
  --postit-pink: #ff7eb9;
  --postit-pink-shadow: #e66da3;
  --postit-blue: #7afcff;
  --postit-blue-shadow: #5de0e3;
  --postit-green: #98fb98;
  --postit-green-shadow: #7dd87d;
  --postit-orange: #ffb347;
  --postit-orange-shadow: #e69d3d;

  /* Text colors */
  --ink-dark: #2c3e50;
  --ink-blue: #1a5276;
  --ink-red: #c0392b;
  --pencil-gray: #5d6d7e;

  /* Fonts */
  --font-handwriting: 'Patrick Hand', cursive;
  --font-casual: 'Caveat', cursive;
}

/* ========================================
   Base Styles / Paper Background
   ======================================== */
body {
  background-color: var(--paper-bg);
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      var(--paper-lines) 31px,
      var(--paper-lines) 32px
    ),
    linear-gradient(
      90deg,
      transparent 79px,
      var(--paper-margin) 79px,
      var(--paper-margin) 81px,
      transparent 81px
    );
  background-size: 100% 32px, 100% 100%;
  min-height: 100vh;
  font-family: var(--font-handwriting);
  color: var(--ink-dark);
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

/* Back to index link */
.back-link {
  display: inline-block;
  font-family: var(--font-handwriting);
  font-size: 1em;
  color: var(--ink-blue);
  text-decoration: none;
  padding: 8px 12px;
  background: white;
  border-radius: 2px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 15px;
}

.back-link:hover {
  color: var(--ink-red);
  text-decoration: underline;
}

/* ========================================
   Selection Counter
   ======================================== */
.selection-counter {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--postit-yellow);
  padding: 15px 20px;
  border-radius: 2px;
  box-shadow:
    3px 3px 8px rgba(0,0,0,0.2),
    inset 0 -2px 5px rgba(0,0,0,0.05);
  transform: rotate(3deg);
  z-index: 1000;
  font-family: var(--font-casual);
  font-size: 1.3em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.selection-counter.counter-full {
  background: var(--postit-pink);
  transform: rotate(-2deg);
}

.counter-label {
  display: block;
  font-size: 0.8em;
  color: var(--pencil-gray);
}

.counter-value {
  font-size: 1.5em;
  color: var(--ink-dark);
}

/* ========================================
   Section Styles
   ======================================== */
.section {
  background: transparent;
  border: none;
  margin-bottom: 40px;
  padding: 20px 100px 20px 100px;
}

.section-header {
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-casual);
  font-size: 2.5em;
  font-weight: 600;
  color: var(--ink-blue);
  margin: 60px 0 0 0;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--ink-red);
  text-underline-offset: 5px;
}

.section-header-buttons {
  display: none;
}

/* Info box / description */
.info-box {
  background: white;
  border: none;
  padding: 20px 25px;
  margin: 20px 0 30px 0;
  font-size: 1.1em;
  line-height: 1.8;
  color: var(--ink-dark);
  box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
  border-left: 4px solid var(--ink-blue);
  transform: rotate(-0.5deg);
}

/* ========================================
   Element Groups
   ======================================== */
.element-group {
  margin-bottom: 40px;
}

.element-group h3 {
  font-family: var(--font-casual);
  font-size: 1.8em;
  color: var(--ink-dark);
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 2px dashed var(--pencil-gray);
}

.group-description {
  font-size: 1em;
  color: var(--pencil-gray);
  margin-bottom: 20px;
}

/* ========================================
   Post-it Note Options
   ======================================== */
.choices-container,
.options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 25px 40px;
  justify-content: center !important;
  padding: 10px 20px;
}

.option-item,
.choice-item {
  /* Override base styles */
  flex: 0 0 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  min-height: 200px;
  padding: 20px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  box-shadow:
    4px 4px 10px rgba(0,0,0,0.15),
    inset 0 -3px 8px rgba(0,0,0,0.05);
}

/* Tape effect at top */
.option-item::before,
.choice-item::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 20px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
}

/* House Rules - Sharpie on paper (3rd div after section-image and info-box) */
.element-group:nth-of-type(3) {
  margin: 30px 0 50px 0;
  padding: 0;
}

/* Show "House Rules" title in large sharpie */
.element-group:nth-of-type(3) > h3 {
  display: block !important;
  font-family: 'Permanent Marker', var(--font-casual), cursive !important;
  font-size: 1.6em !important;
  color: #1a1a1a !important;
  border-bottom: none !important;
  margin-bottom: 15px !important;
  padding-bottom: 0 !important;
  text-shadow: 0.5px 0.5px 0px rgba(0,0,0,0.2);
}

/* Hide the "[Choose zero or more]" span */
.element-group:nth-of-type(3) > h3 .group-description {
  display: none !important;
}

.element-group:nth-of-type(3) .options-container {
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 10px 30px !important;
  padding: 0 !important;
  align-items: flex-start !important;
  justify-content: center !important;
}

.element-group:nth-of-type(3) .option-item {
  /* Remove post-it styling */
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 8px 12px !important;
  min-height: auto !important;
  min-width: auto !important;
  max-width: 380px !important;
  flex: 0 1 380px !important;
  transform: none !important;
  width: auto !important;
  overflow: visible !important;
}

/* Ensure option-content is visible for sharpie rules */
.element-group:nth-of-type(3) .option-item .option-content {
  display: block !important;
  overflow: visible !important;
}

.element-group:nth-of-type(3) .option-item::before {
  display: none !important;
}

.element-group:nth-of-type(3) .option-item:hover {
  transform: none !important;
  box-shadow: none !important;
  background: rgba(0,0,0,0.04) !important;
}

.element-group:nth-of-type(3) .option-item.selected {
  transform: none !important;
  box-shadow: none !important;
  background: rgba(0,0,0,0.06) !important;
}

.element-group:nth-of-type(3) .option-item.selected::after {
  content: '\2713';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.2em;
  color: #1a1a1a;
  font-weight: bold;
  font-family: 'Permanent Marker', var(--font-casual), cursive;
}

/* Hide the title container for sharpie options */
.element-group:nth-of-type(3) .option-item .entry-title-container {
  display: none !important;
}

/* Style the description text as sharpie */
.element-group:nth-of-type(3) .option-item .option-content,
.element-group:nth-of-type(3) .option-item .option-text-content,
.element-group:nth-of-type(3) .option-item .option-text-content p {
  font-family: 'Permanent Marker', var(--font-casual), cursive !important;
  font-size: 1.05em !important;
  color: #1a1a1a !important;
  margin: 0 !important;
  line-height: 1.5 !important;
  letter-spacing: 0.3px;
  text-shadow: 0.5px 0.5px 0px rgba(0,0,0,0.15);
}

/* NYT Games - Yellow post-its (4th div) */
.element-group:nth-of-type(4) .option-item:nth-child(1) { transform: rotate(-4deg); }
.element-group:nth-of-type(4) .option-item:nth-child(2) { transform: rotate(2.5deg); }
.element-group:nth-of-type(4) .option-item:nth-child(3) { transform: rotate(-1deg); }
.element-group:nth-of-type(4) .option-item:nth-child(4) { transform: rotate(3.5deg); }
.element-group:nth-of-type(4) .option-item:nth-child(5) { transform: rotate(-2.5deg); }

/* Non-Wordle -dle Games - Pink post-its (5th div) */
.element-group:nth-of-type(5) .option-item:nth-child(1) { transform: rotate(3deg); }
.element-group:nth-of-type(5) .option-item:nth-child(2) { transform: rotate(-3.5deg); }
.element-group:nth-of-type(5) .option-item:nth-child(3) { transform: rotate(1.5deg); }
.element-group:nth-of-type(5) .option-item:nth-child(4) { transform: rotate(-2deg); }
.element-group:nth-of-type(5) .option-item:nth-child(5) { transform: rotate(4deg); }

/* Other Games - Blue post-its (6th div) */
.element-group:nth-of-type(6) .option-item:nth-child(1) { transform: rotate(-2.5deg); }
.element-group:nth-of-type(6) .option-item:nth-child(2) { transform: rotate(4deg); }
.element-group:nth-of-type(6) .option-item:nth-child(3) { transform: rotate(-4.5deg); }
.element-group:nth-of-type(6) .option-item:nth-child(4) { transform: rotate(1deg); }
.element-group:nth-of-type(6) .option-item:nth-child(5) { transform: rotate(-3deg); }

/* Hover effect */
.option-item:hover,
.choice-item:hover {
  transform: scale(1.03) rotate(0deg) !important;
  box-shadow:
    6px 6px 15px rgba(0,0,0,0.25),
    inset 0 -3px 8px rgba(0,0,0,0.05);
  z-index: 10;
}

/* Selected state */
.option-item.selected,
.choice-item.selected {
  transform: scale(1.02) rotate(0deg) !important;
  box-shadow:
    0 0 0 4px var(--ink-blue),
    6px 6px 15px rgba(0,0,0,0.2);
}

/* Hover on selected items */
.option-item.selected:hover,
.choice-item.selected:hover {
  transform: scale(1.05) rotate(0deg) !important;
  box-shadow:
    0 0 0 4px var(--ink-blue),
    8px 8px 20px rgba(0,0,0,0.3);
  z-index: 10;
}

.option-item.selected::after,
.choice-item.selected::after {
  content: '\2713';
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2em;
  color: var(--ink-blue);
  font-weight: bold;
}

/* Disabled state */
.option-item.disabled-choice,
.choice-item.disabled-choice {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

.option-item.disabled-choice:hover,
.choice-item.disabled-choice:hover {
  transform: inherit !important;
  box-shadow:
    4px 4px 10px rgba(0,0,0,0.15),
    inset 0 -3px 8px rgba(0,0,0,0.05);
}

/* ========================================
   Post-it Content
   ======================================== */
.option-item h3,
.choice-item h3,
.entry-title-container h3 {
  font-family: var(--font-casual);
  font-size: 1.4em;
  font-weight: 600;
  color: var(--ink-dark);
  margin: 0 0 10px 0;
  line-height: 1.2;
}

.option-item p,
.choice-item p {
  font-family: var(--font-handwriting);
  font-size: 0.95em;
  line-height: 1.5;
  color: var(--ink-dark);
  margin: 0;
}

/* Puzzle link styling */
.option-item a,
.choice-item a {
  color: var(--ink-blue);
  text-decoration: underline;
  font-weight: 600;
}

.option-item a:hover,
.choice-item a:hover {
  color: var(--ink-red);
}

/* URL display for screenshots */
.url-display {
  display: block;
  font-family: var(--font-handwriting);
  font-size: 0.85em;
  color: var(--ink-dark);
  opacity: 0.7;
  margin-top: 4px;
  word-break: break-all;
}

/* Section header image - polaroid style, float right so text wraps */
.section-image {
  float: right;
  width: 450px;
  margin: 0 20px 15px 25px;
  shape-outside: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  position: relative;
  z-index: 10;
}

.section-image img {
  width: 100%;
  background: white;
  padding: 10px 10px 35px 10px;
  border-radius: 2px;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.25);
  transform: rotate(4deg);
}

/* Entry images - polaroids pinned beside the post-it, behind it */
.entry-image {
  position: absolute;
  z-index: 1;
  width: 260px;
  pointer-events: none;
}

.entry-image img {
  width: 100%;
  background: white;
  padding: 8px 8px 28px 8px;
  border-radius: 2px;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
}

/* Post-it backgrounds (offset by 3: section-image, info-box, and house-rules divs) */
.element-group:nth-of-type(4) .option-item,
.element-group:nth-of-type(4) .choice-item {
  background: linear-gradient(135deg, var(--postit-yellow) 0%, var(--postit-yellow-shadow) 100%);
}
.element-group:nth-of-type(5) .option-item,
.element-group:nth-of-type(5) .choice-item {
  background: linear-gradient(135deg, var(--postit-pink) 0%, var(--postit-pink-shadow) 100%);
}
.element-group:nth-of-type(6) .option-item,
.element-group:nth-of-type(6) .choice-item {
  background: linear-gradient(135deg, var(--postit-blue) 0%, var(--postit-blue-shadow) 100%);
}

/* Alternate positions - polaroids fully outside post-it */
.option-item:nth-child(odd) .entry-image {
  left: -280px;
  top: 20px;
}
.option-item:nth-child(odd) .entry-image img {
  transform: rotate(-8deg);
}

.option-item:nth-child(even) .entry-image {
  right: -280px;
  top: 30px;
}
.option-item:nth-child(even) .entry-image img {
  transform: rotate(7deg);
}

.option-item:nth-child(3n) .entry-image {
  top: 50px;
}
.option-item:nth-child(3n) .entry-image img {
  transform: rotate(-5deg);
}

.option-item:nth-child(4n) .entry-image {
  top: 10px;
}
.option-item:nth-child(4n) .entry-image img {
  transform: rotate(9deg);
}

.option-item:nth-child(5n) .entry-image {
  top: 40px;
}
.option-item:nth-child(5n) .entry-image img {
  transform: rotate(-6deg);
}

/* Requirements indicator */
.requirements-indicator {
  font-size: 0.8em;
  color: var(--pencil-gray);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--pencil-gray);
}

/* ========================================
   Footer
   ======================================== */
.footer-wrapper {
  margin-top: 60px;
  padding: 20px;
}

.footer-toggle {
  background: var(--postit-green);
  display: inline-block;
  padding: 10px 20px;
  cursor: pointer;
  font-family: var(--font-casual);
  font-size: 1.1em;
  transform: rotate(-1deg);
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.footer-toggle:hover {
  transform: rotate(0deg) scale(1.02);
}

.footer-section {
  background: white;
  padding: 20px;
  margin-top: 15px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
  border-left: 4px solid var(--postit-green);
}

.footer-hidden .footer-section {
  display: none;
}

.changelog-container,
.credits-container {
  margin-bottom: 20px;
}

.changelog-container:last-child,
.credits-container:last-child {
  margin-bottom: 0;
}

.changelog-container h3,
.credits-container h3 {
  font-family: var(--font-casual);
  font-size: 1.5em;
  color: var(--ink-blue);
  margin: 0 0 10px 0;
}

.credits-container p {
  margin: 5px 0;
  color: var(--pencil-gray);
}

.changelog-entry {
  margin: 5px 0;
  color: var(--pencil-gray);
}

.changelog-entry .version {
  font-weight: 600;
  color: var(--ink-dark);
  margin-right: 10px;
}

.changelog-entry .description {
  color: var(--pencil-gray);
}

/* ========================================
   Tablet/Medium Width Responsiveness
   ======================================== */
@media (max-width: 1100px) {
  .section {
    padding: 20px 40px;
  }

  /* Reposition entry images inside the post-it at narrower widths */
  .entry-image {
    position: relative;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100%;
    margin-bottom: 15px;
    z-index: 1;
  }

  .entry-image img {
    transform: rotate(0deg) !important;
    max-width: 200px;
    margin: 0 auto;
    display: block;
  }
}

/* ========================================
   Mobile Responsiveness
   ======================================== */
@media (max-width: 768px) {
  body {
    padding: 10px;
    background-size: 100% 28px, 100% 100%;
  }

  .section {
    padding: 10px 20px;
  }

  .section-title {
    font-size: 1.8em;
  }

  .selection-counter {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 20px;
    display: inline-block;
  }

  .option-item,
  .choice-item {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: auto;
    transform: rotate(0deg) !important;
  }

  .choices-container,
  .options-container {
    flex-direction: column;
    gap: 15px;
  }

  /* Keep sharpie house rules side-by-side even on mobile */
  .element-group:nth-of-type(3) .options-container {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }

  .element-group:nth-of-type(3) .option-item {
    flex: 0 1 auto !important;
    width: auto !important;
    min-width: auto !important;
    max-width: 100% !important;
  }
}

/* ========================================
   Hide Character Sheet
   ======================================== */
.character-sheet {
  display: none !important;
}

/* ========================================
   Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--paper-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--pencil-gray);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-dark);
}

/* ========================================
   Navigation Menu Override (Hide it)
   ======================================== */
.nav-menu {
  display: none !important;
}

/* ========================================
   Minimize Button Override
   ======================================== */
.section-minimize-toggle,
.section-bottom-controls {
  display: none !important;
}
