/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary-color: #2c3e50;
  --secondary-color: #e74c3c;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --background-light: #f8f9fa;
  --background-dark: #1a1a1a;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --border-color: #dde1e7;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-heavy: rgba(0, 0, 0, 0.2);
  --transition-speed: 0.3s;
  --border-radius: 12px;
  --max-width: 1200px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Raleway', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--background-light);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Kalam', cursive;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 600;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
}

/* Exhibition Container */
.exhibition-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Navigation */
.exhibition-nav {
  background: white;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px var(--shadow-light);
}

.exhibition-nav {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.exhibition-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  flex: 1;
  min-width: 80px;
  padding: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Raleway', sans-serif;
  color: var(--text-light);
  position: relative;
}

.nav-tab:hover {
  background: var(--background-light);
}

.nav-tab.active {
  color: var(--primary-color);
  font-weight: 600;
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary-color);
}

.tab-icon {
  font-size: 1.5rem;
  display: block;
}

.tab-text {
  font-size: 0.875rem;
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  padding: 1rem;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Exhibition Header */
.exhibition-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem 0;
}

.exhibition-title {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
}

.exhibition-subtitle {
  color: var(--text-light);
  font-size: 1.125rem;
  font-weight: 300;
}

/* Game Stats */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  font-family: 'Raleway', sans-serif;
  line-height: 1;
}

/* Hangman Display */
.hangman-display {
  text-align: center;
  margin-bottom: 2rem;
}

#hangman-image {
  height: 150px;
  width: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(2px 2px 4px var(--shadow-light));
}

/* Phrase Display */
.phrase-container {
  margin: 2rem 0;
}

.phrase {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: 'Kalam', cursive;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 600;
}

.letter {
  display: inline-block;
  width: clamp(30px, 5vw, 50px);
  height: clamp(40px, 6vw, 60px);
  line-height: clamp(40px, 6vw, 60px);
  text-align: center;
  border-bottom: 3px solid var(--primary-color);
  transition: all var(--transition-speed);
  color: var(--primary-color);
}

.letter.hidden {
  color: transparent;
}

.letter.revealed {
  animation: revealLetter 0.5s ease-out;
  color: var(--success-color);
}

@keyframes revealLetter {
  0% {
    transform: rotateY(90deg);
    opacity: 0;
  }
  50% {
    transform: rotateY(0);
    opacity: 0.5;
  }
  100% {
    transform: rotateY(0);
    opacity: 1;
  }
}

.space {
  width: 1rem;
}

/* Question Display */
.question-display {
  text-align: center;
  margin: 2rem 0;
}

.question-text {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.question-hint {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* Paintings Container */
.paintings-container {
  margin: 2rem 0;
  position: relative;
}

.paintings-grid {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.paintings-grid::-webkit-scrollbar {
  height: 8px;
}

.paintings-grid::-webkit-scrollbar-track {
  background: transparent;
}

.paintings-grid::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Painting Card */
.painting-card {
  flex: 0 0 250px;
  scroll-snap-align: center;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-light);
  transition: all var(--transition-speed);
  cursor: pointer;
}

.painting-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px var(--shadow-medium);
}

.painting-card.selected {
  box-shadow: 0 0 0 3px var(--secondary-color);
}

.painting-card.correct {
  box-shadow: 0 0 0 3px var(--success-color);
}

.painting-card.wrong {
  box-shadow: 0 0 0 3px var(--secondary-color);
  opacity: 0.7;
}

.painting-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.painting-number {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--primary-color);
  color: white;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background var(--transition-speed);
}

.painting-card:hover .painting-number {
  background: var(--secondary-color);
}

/* Swipe Hint */
.swipe-hint {
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 1rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* None Button */
.none-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 90%;
  max-width: 300px;
  margin: 2rem auto;
  padding: 1.25rem 2rem;
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: 0 4px 20px var(--shadow-light);
}

.none-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--shadow-medium);
}

.none-button:active {
  transform: translateY(0);
}

.none-icon {
  font-size: 1.5rem;
}

/* Educational Panel */
.education-panel {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: 0 4px 20px var(--shadow-light);
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.education-panel.success {
  border-left: 4px solid var(--success-color);
}

.education-panel.failure {
  border-left: 4px solid var(--secondary-color);
}

.education-content h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.continue-button {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.75rem 2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.continue-button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

/* Victory & Game Over Screens */
.victory-screen,
.gameover-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.victory-content,
.gameover-content {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: zoomIn 0.5s ease-out;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.victory-title,
.gameover-title {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.barbara-message {
  background: var(--background-light);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  font-style: italic;
}

.message-signature {
  text-align: right;
  margin-top: 1rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* Barbara Gallery */
.barbara-gallery h3 {
  text-align: center;
  margin-bottom: 1.5rem;
}

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

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform var(--transition-speed);
}

.gallery-item:hover {
  transform: scale(1.05);
}

.gallery-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

/* Action Buttons */
.victory-actions,
.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.action-button {
  display: inline-block;
  padding: 1rem 2rem;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.action-button.primary {
  background: var(--secondary-color);
  color: white;
}

.action-button.secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--shadow-light);
}

/* Content Tabs */
.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.section-title {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.lead-text {
  font-size: 1.125rem;
  color: var(--text-dark);
  margin-bottom: 2rem;
  line-height: 1.8;
}

/* Residency Content */
.residency-section {
  margin-bottom: 2rem;
}

.residency-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.residency-acknowledgment {
  background: var(--background-light);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-top: 2rem;
  border-left: 4px solid var(--secondary-color);
}

/* Artist Content */
.artist-bio {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.journey-timeline {
  margin: 2rem 0;
}

.timeline-item {
  margin-bottom: 2rem;
  padding-left: 2rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--secondary-color);
  border-radius: 50%;
}

.timeline-item h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.artist-statement {
  background: var(--background-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  margin: 2rem 0;
  font-style: italic;
  line-height: 1.8;
  white-space: pre-line;
}

.artist-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.artist-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  text-decoration: none;
  color: var(--primary-color);
  transition: all var(--transition-speed);
}

.artist-link:hover {
  border-color: var(--secondary-color);
  transform: translateX(5px);
}

/* Cité Content */
.cite-section {
  margin-bottom: 2rem;
}

.cite-acknowledgment {
  background: var(--background-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: center;
}

.cite-website {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: all var(--transition-speed);
}

.cite-website:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

/* Theory Content */
.theory-content {
  max-width: 800px;
  margin: 0 auto;
}

.theory-section {
  margin-bottom: 2.5rem;
}

.theory-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.theory-section p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: var(--text-dark);
}

.theory-callout {
  background: var(--background-light);
  border-left: 4px solid var(--secondary-color);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.theory-callout p {
  margin-bottom: 0;
  font-style: italic;
}

.theory-conclusion {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px var(--shadow-light);
  margin-top: 3rem;
}

.theory-conclusion h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.theory-final {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.125rem;
  margin-top: 1.5rem;
}

/* Footer */
.exhibition-footer {
  background: var(--primary-color);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  margin-top: auto;
}

.footer-credits {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.footer-thanks {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: white;
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
  z-index: 1001;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.modal-close:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .modal-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }
}

.modal-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--border-radius);
}

.modal-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.modal-hint {
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* Detection Guide */
.detection-guide {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.detection-guide h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.detection-section {
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-light);
}

.detection-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.detection-section ul {
  list-style: none;
  padding: 0;
}

.detection-section li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.detection-section li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--secondary-color);
  font-weight: bold;
}

.detection-section p {
  line-height: 1.8;
  color: var(--text-dark);
}

.detection-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .detection-actions {
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
  }
}

/* Feedback Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  width: 100%;
  max-width: 500px;
  transform: translateY(-30px) scale(0.95);
  transition: transform 0.3s ease;
}

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

.modal-content {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  padding-bottom: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Modal Icon */
.modal-icon {
  text-align: center;
  margin-bottom: 1.5rem;
  height: 60px;
  position: relative;
}

.icon-success,
.icon-failure {
  display: none;
  font-size: 3rem;
  font-weight: bold;
  animation: iconAppear 0.5s ease-out;
}

.modal-success .icon-success {
  display: inline-block;
  color: var(--success-color);
  animation: successPulse 1s ease-out;
}

.modal-failure .icon-failure {
  display: inline-block;
  color: var(--secondary-color);
  animation: failureShake 0.5s ease-out;
}

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

@keyframes successPulse {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes failureShake {
  0%, 100% { transform: translateX(0) scale(1); }
  10% { transform: translateX(-10px) scale(0.95); }
  20% { transform: translateX(10px) scale(0.95); }
  30% { transform: translateX(-10px) scale(0.95); }
  40% { transform: translateX(10px) scale(0.95); }
  50% { transform: translateX(0) scale(1); }
}

/* Modal Body */
.modal-body {
  margin-bottom: 1.5rem;
}

.modal-title {
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  text-align: center;
}

.modal-text {
  color: var(--text-dark);
  line-height: 1.6;
  text-align: center;
}

/* Game State Display */
.modal-game-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  background: var(--background-light);
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
}

.mini-hangman {
  position: relative;
  width: 80px;
  height: 80px;
}

.mini-hangman-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.3s ease;
}

.hangman-transition-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.mini-hangman-img.pulse-red {
  animation: redPulse 0.6s ease-out;
}

@keyframes redPulse {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 10px rgba(231, 76, 60, 0.8)); }
}

.state-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.letters-progress,
.mistakes-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.letters-label,
.mistakes-label {
  color: var(--text-light);
  font-size: 0.875rem;
}

.letters-count,
.mistakes-count {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
}

.mistakes-count.danger {
  color: var(--secondary-color);
  animation: dangerPulse 1s ease-out;
}

@keyframes dangerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Continue Button */
.modal-continue {
  display: block;
  width: 100%;
  padding: 1rem 2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.modal-continue:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

/* Letter Reveal Animation */
.letter.revealing {
  animation: letterFlip 0.6s ease-out forwards;
}

@keyframes letterFlip {
  0% {
    transform: rotateX(90deg);
    opacity: 0;
  }
  50% {
    transform: rotateX(0);
    opacity: 0.5;
  }
  100% {
    transform: rotateX(0);
    opacity: 1;
    color: var(--success-color);
  }
}

/* Painting Highlight */
.painting-card.correct-glow {
  animation: correctGlow 1s ease-out;
}

@keyframes correctGlow {
  0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
  50% { box-shadow: 0 0 20px 10px rgba(39, 174, 96, 0.6); }
  100% { box-shadow: 0 0 0 3px var(--success-color); }
}

/* Victory Gallery Enhancements */
.victory-painting-card {
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-speed);
}

.victory-painting-card:hover {
  transform: scale(1.05);
}

.painting-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-speed);
}

.victory-painting-card:hover .painting-caption {
  background: rgba(0, 0, 0, 0.9);
  padding: 0.75rem;
}

/* Painting Details Modal */
.painting-details {
  max-height: 90vh;
  overflow-y: auto;
  padding: 1rem;
}

.painting-detail-title {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 0.5rem;
  font-family: 'Kalam', cursive;
}

.painting-detail-subtitle {
  color: var(--text-light);
  text-align: center;
  font-style: italic;
  margin-bottom: 1.5rem;
}

.painting-detail-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: var(--border-radius);
  margin: 0 auto 1.5rem;
  display: block;
}

.painting-detail-content {
  max-width: 600px;
  margin: 0 auto;
}

.painting-detail-brief {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.painting-detail-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius);
}

.painting-detail-section h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.painting-detail-section p {
  line-height: 1.8;
  color: var(--text-dark);
}

.technique-section {
  border-left: 4px solid var(--success-color);
}

.metaphor-section {
  border-left: 4px solid var(--secondary-color);
}

/* Particle Effects */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(0);
    opacity: 0;
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .modal-container {
    margin: 1rem 0;
    max-height: calc(100vh - 2rem);
  }
  
  .modal-content {
    padding: 1.5rem;
    padding-bottom: 2rem;
    max-height: calc(100vh - 2rem);
  }
  
  .modal-game-state {
    flex-direction: column;
    gap: 1rem;
  }
  
  .mini-hangman {
    width: 60px;
    height: 60px;
  }
  
  .state-info {
    flex-direction: row;
    gap: 1.5rem;
  }
  
  /* Painting descriptions on mobile */
  .painting-info {
    margin-top: 1rem;
    padding-top: 1rem;
  }
  
  .painting-title {
    font-size: 1.125rem;
  }
  
  .painting-full-description.expanded {
    max-height: 400px;
    overflow-y: auto;
  }
  
  .technique-note,
  .metaphor-note {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
  
  /* Victory gallery on mobile */
  .painting-caption {
    font-size: 0.75rem;
    padding: 0.375rem;
  }
  
  /* Painting details modal on mobile */
  .painting-details {
    padding: 0.5rem;
  }
  
  .painting-detail-section {
    padding: 1rem;
  }
  
  .painting-detail-section h3 {
    font-size: 1.125rem;
  }
}

/* Painting Description Styles */
.painting-info {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.painting-title {
  color: var(--primary-color);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  text-align: center;
  font-family: 'Kalam', cursive;
}

.painting-subtitle {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.painting-brief {
  color: var(--text-dark);
  line-height: 1.6;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
}

.expand-description {
  display: block;
  margin: 0 auto;
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.5rem 1.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-speed);
  font-weight: 600;
}

.expand-description:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.painting-full-description {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  margin-top: 1rem;
}

.painting-full-description.expanded {
  max-height: 1000px;
  overflow-y: visible;
}

.painting-full-description p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: var(--text-dark);
}

.technique-note,
.metaphor-note {
  padding: 1rem;
  background: var(--background-light);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.technique-note {
  border-left: 3px solid var(--success-color);
}

.metaphor-note {
  border-left: 3px solid var(--secondary-color);
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-content {
  text-align: center;
}

.loading-title {
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top-color: var(--secondary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: var(--text-light);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.mobile-only {
  display: block;
}

/* Tablet Styles */
@media (min-width: 768px) {
  .paintings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: visible;
  }
  
  .painting-card {
    flex: none;
  }
  
  .painting-image {
    height: 250px;
  }
  
  .swipe-hint {
    display: none;
  }
  
  .mobile-only {
    display: none;
  }
  
  .tab-icon {
    font-size: 1.25rem;
  }
  
  .tab-text {
    font-size: 1rem;
  }
  
  #hangman-image {
    height: 200px;
  }
  
  .action-buttons {
    flex-direction: row;
    justify-content: center;
  }
  
  .artist-links {
    flex-direction: row;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  
  .gallery-item img {
    height: 200px;
  }
}

/* Desktop Styles */
@media (min-width: 1024px) {
  body {
    font-size: 1.125rem;
  }
  
  .exhibition-container {
    max-width: var(--max-width);
    margin: 0 auto;
    box-shadow: 0 0 50px var(--shadow-light);
  }
  
  .paintings-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
  }
  
  .painting-image {
    height: 200px;
  }
  
  #hangman-image {
    height: 250px;
  }
  
  .none-button {
    max-width: 400px;
  }
  
  .victory-actions,
  .gameover-actions {
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
  }
  
  .action-button {
    min-width: 200px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #4a90e2;
    --secondary-color: #ff6b6b;
    --success-color: #4ecdc4;
    --warning-color: #ffe66d;
    --background-light: #2a2a2a;
    --background-dark: #1a1a1a;
    --text-dark: #e0e0e0;
    --text-light: #a0a0a0;
    --border-color: #444;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-medium: rgba(255, 255, 255, 0.1);
    --shadow-heavy: rgba(255, 255, 255, 0.15);
  }
  
  body {
    background: var(--background-dark);
    color: var(--text-dark);
  }
  
  /* Navigation */
  .exhibition-nav {
    background: #2a2a2a;
    border-bottom-color: var(--border-color);
  }
  
  .nav-tab {
    color: var(--text-light);
  }
  
  .nav-tab:hover {
    background: #333;
  }
  
  .nav-tab.active {
    color: var(--primary-color);
  }
  
  /* Cards and Panels */
  .painting-card,
  .education-panel,
  .victory-content,
  .gameover-content,
  .modal-content,
  .detection-section,
  .theory-conclusion {
    background: #2a2a2a;
    color: var(--text-dark);
  }
  
  /* Text Elements */
  h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
  }
  
  p, span, div {
    color: inherit;
  }
  
  .exhibition-title,
  .section-title,
  .question-text {
    color: var(--primary-color);
  }
  
  .exhibition-subtitle,
  .question-hint,
  .stat-label {
    color: var(--text-light);
  }
  
  .stat-value {
    color: var(--primary-color);
  }
  
  .lead-text,
  .painting-brief,
  .modal-text {
    color: var(--text-dark);
  }
  
  /* Buttons */
  .continue-button,
  .modal-continue,
  .action-button.primary {
    background: var(--primary-color);
    color: white;
  }
  
  .action-button.secondary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
  }
  
  .none-button {
    background: var(--secondary-color);
    color: white;
  }
  
  .expand-description {
    border-color: var(--primary-color);
    color: var(--primary-color);
  }
  
  .expand-description:hover {
    background: var(--primary-color);
    color: white;
  }
  
  /* Special Elements */
  .painting-number {
    background: #444;
    color: white;
  }
  
  .painting-card:hover .painting-number {
    background: var(--secondary-color);
  }
  
  .letter {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
  }
  
  .letter.revealed {
    color: var(--success-color);
  }
  
  /* Backgrounds */
  .barbara-message,
  .residency-acknowledgment,
  .artist-statement,
  .cite-acknowledgment,
  .theory-callout,
  .technique-note,
  .metaphor-note,
  .modal-game-state {
    background: #333;
    color: var(--text-dark);
  }
  
  /* Links */
  a,
  .artist-link,
  .cite-website {
    color: var(--primary-color);
  }
  
  /* Footer */
  .exhibition-footer {
    background: #2a2a2a;
    border-top: 1px solid var(--border-color);
  }
  
  /* Modal Overlay */
  .modal-overlay,
  .victory-screen,
  .gameover-screen {
    background: rgba(0, 0, 0, 0.95);
  }
  
  /* Input elements */
  input, textarea, select {
    background: #333;
    color: var(--text-dark);
    border-color: var(--border-color);
  }
  
  /* Scrollbar */
  ::-webkit-scrollbar-track {
    background: #2a2a2a;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #555;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #666;
  }
  
  /* Hangman image fix for dark mode */
  #hangman-image,
  .mini-hangman-img {
    filter: invert(1) brightness(0.9);
  }
  
  /* Fix the transition overlay too */
  .hangman-transition-overlay {
    filter: invert(1) brightness(0.9);
  }
  
  /* Game over and victory screens text */
  .gameover-screen,
  .victory-screen {
    color: var(--text-dark);
  }
  
  .gameover-title,
  .victory-title {
    color: var(--primary-color);
  }
  
  .gameover-content p,
  .victory-content p {
    color: var(--text-dark);
  }
  
  /* Ensure paintings are NEVER inverted */
  .gallery-item img,
  .barbara-gallery img,
  .painting-image,
  .gallery-grid img,
  .painting-detail-image {
    filter: none !important;
  }
  
  /* Only invert specific hangman images */
  img[src*="/s0.png"],
  img[src*="/s1.png"],
  img[src*="/s2.png"],
  img[src*="/s3.png"],
  img[src*="/s4.png"],
  img[src*="/s5.png"],
  img[src*="/s6.png"],
  img[src*="/s7.png"],
  img[src*="/s8.png"] {
    filter: invert(1) brightness(0.9);
  }
  
  /* Ensure game over/victory screen buttons are visible */
  .gameover-actions .action-button,
  .victory-actions .action-button {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
  }
  
  .gameover-actions .action-button.secondary,
  .victory-actions .action-button.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
  }
  
  .gameover-actions .action-button:hover,
  .victory-actions .action-button:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
  }
}