/* Paper and homework aesthetic */
.paper-container {
  max-width: 850px;
  margin: 2rem auto;
  background: var(--paper-bg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  min-height: 100vh;
}

/* Binder holes */
.binder-holes {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 60px;
  z-index: 1;
}

.hole {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #f0f0f0 30%, #d0d0d0 70%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  position: absolute;
  left: 20px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.hole:hover {
  transform: scale(1.1);
}

#hole-1 { top: 120px; }
#hole-2 { top: 200px; }
#hole-3 { top: 280px; }

/* Worksheet main content */
.worksheet {
  padding: 2rem 2rem 2rem 80px;
  background: 
    /* Horizontal lines */
    repeating-linear-gradient(
      transparent,
      transparent 1.4rem,
      var(--line-blue) 1.4rem,
      var(--line-blue) calc(1.4rem + 1px)
    ),
    /* Left margin */
    linear-gradient(
      90deg,
      var(--margin-pink) 0,
      var(--margin-pink) 1px,
      transparent 1px
    );
  background-position: 0 0, 60px 0;
  background-size: 100% 100%, 100% 100%;
  min-height: 100vh;
  position: relative;
}

/* Ticker watermark */
.worksheet::before {
  content: attr(data-ticker);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 8rem;
  color: var(--line-blue);
  opacity: 0.02;
  pointer-events: none;
  z-index: 0;
  font-weight: bold;
  letter-spacing: 2rem;
}

/* Header */
.worksheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--line-blue);
}

.course-title {
  margin: 0;
  font-size: 1.8rem;
  color: var(--ink);
}

.date-line {
  font-size: 1rem;
  margin-top: 0.5rem;
  color: var(--ink);
}

.student-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.student-info input {
  min-width: 200px;
}

/* Instructions */
.instructions {
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.3);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
}

.hints-section {
  margin-top: 1rem;
}

.hints-section summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--accent);
  padding: 0.5rem 0;
}

.hints-section summary:hover {
  text-decoration: underline;
}

.hints-content {
  padding: 1rem 0;
  border-top: 1px solid var(--line-blue);
  margin-top: 0.5rem;
}

/* Problem cards */
.problems {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.problem-card {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  border: 1px solid var(--line-blue);
  position: relative;
}

.problem-number {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--accent);
  min-width: 2rem;
  flex-shrink: 0;
}

.problem-content {
  flex: 1;
}

.problem-stem {
  margin-bottom: 1rem;
  font-weight: 500;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.choice {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.choice:hover {
  background: rgba(255, 255, 255, 0.3);
}

.choice-label {
  font-weight: bold;
  margin-right: 0.5rem;
  color: var(--accent);
}

.explanation {
  color: var(--success);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.choice input[type="radio"]:checked ~ .explanation,
.problem-card:hover .explanation {
  opacity: 1;
}

/* Graph paper widget */
.graph-paper {
  margin: 1rem 0;
  padding: 1rem;
  background: 
    linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 2px solid var(--line-blue);
  border-radius: 4px;
  position: relative;
}

.graph-title {
  font-weight: bold;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--ink);
}

.graph-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--ink);
}

#price-chart {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

/* Footer */
.worksheet-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--line-blue);
}

.appendix-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.appendix-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.appendix-item sup {
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
}

.appendix-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}

.appendix-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

.disclaimer {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Control buttons */
.panic-button {
  position: fixed;
  top: -50px;
  left: 20px;
  background: var(--danger);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  z-index: 1000;
  transition: top 0.3s ease;
}

.panic-button:focus,
.panic-button.visible {
  top: 20px;
}

.mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 12px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: all 0.2s ease;
}

.mode-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Crypto mode styles */
.crypto-mode .token-name {
  font-weight: bold;
  color: var(--accent);
}

.crypto-mode #ticker-display {
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.875rem;
}

.crypto-mode .appendix-link::after {
  content: " 🔗";
  opacity: 0.6;
}

/* Panic mode styles */
.panic-mode .worksheet::before {
  content: "HOMEWORK" !important;
}

.panic-mode #price-live,
.panic-mode #change-24h,
.panic-mode #market-cap {
  color: transparent !important;
  background: var(--line-blue);
}

.panic-mode #price-chart {
  filter: blur(4px);
}

.panic-mode .appendix-link {
  filter: blur(2px);
}

/* Responsive design */
@media (max-width: 768px) {
  .paper-container {
    margin: 1rem;
    box-shadow: none;
  }
  
  .worksheet {
    padding: 1rem 1rem 1rem 40px;
  }
  
  .worksheet-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .student-info input {
    min-width: 150px;
  }
  
  .problem-card {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .binder-holes {
    width: 30px;
  }
  
  .hole {
    width: 15px;
    height: 15px;
    left: 7px;
  }
  
  #hole-1 { top: 80px; }
  #hole-2 { top: 140px; }
  #hole-3 { top: 200px; }
  
  .appendix-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .worksheet {
    padding: 1rem 0.5rem 1rem 30px;
  }
  
  .course-title {
    font-size: 1.4rem;
  }
  
  .problem-card {
    padding: 1rem;
  }
}
