:root {
  --color-primary: #ffb3d9;
  --color-secondary: #c9a0dc;
  --color-accent: #b4e4ff;
  --color-bg: #fff8f3;
  --color-bg-alt: #fff0f5;
  --font-base: "Quicksand", "Nunito", -apple-system, sans-serif;
  --radius-lg: 24px;
  --shadow-lg: 0 8px 24px rgba(255, 179, 217, 0.25);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

body {
  font-family: var(--font-base);
  background: transparent !important;
  animation: none !important;
  position: relative;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

body::before,
body::after,
body.movie-mode::before,
body.movie-mode::after,
body.anime-mode::before,
body.anime-mode::after {
  display: none !important;
}

.container,
.header,
.photocards-section,
.ticket-generator,
.action-sidebar {
  position: relative;
  z-index: 10;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

button:focus, 
.mode-btn:focus,
.action-card:focus,
.popup-close-btn:focus,
.modal-btn:focus,
.ticket-btn:focus {
  outline: none !important;
  box-shadow: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeInDown 0.6s ease;
}

.header h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3),
    0 4px 20px rgba(255, 255, 255, 0.1);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.header-rotator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
  flex-wrap: wrap;
  transform: translateX(30px);
}

.dynamic-word-container {
  height: 1.5em;
  overflow: hidden;
  position: relative;
  width: 220px;
  perspective: 600px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.dynamic-word-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: rotateTextCube 12s infinite cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

.word-face {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start; 
  text-align: left;
  white-space: nowrap;
  padding-left: 2px;
  backface-visibility: hidden;
  background: transparent;
  color: #b4e4ff;
}

.word-face.front  { transform: translateZ(0.75em); }
.word-face.top    { transform: rotateX(-90deg) translateZ(0.75em); }
.word-face.back   { transform: rotateX(-180deg) translateZ(0.75em); }
.word-face.bottom { transform: rotateX(-270deg) translateZ(0.75em); }

@keyframes rotateTextCube {
  0%, 20%   { transform: rotateX(0deg); }
  25%, 45%  { transform: rotateX(90deg); }
  50%, 70%  { transform: rotateX(180deg); }
  75%, 95%  { transform: rotateX(270deg); }
  100%      { transform: rotateX(360deg); }
}

body.anime-mode .header-rotator {
  color: #1a202c;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}

body.anime-mode .word-face {
  color: #0077b6;
  text-shadow: none;
  font-weight: 800;
}

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  perspective: 1200px;
  animation: fadeIn 0.8s ease 0.2s backwards;
}

.mode-btn {
  position: relative;
  padding: 0;
  width: 160px;
  height: 56px;
  background: transparent;
  border: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--transition-smooth);
  box-shadow: none;
  pointer-events: auto;
}

.mode-btn * { pointer-events: none; }

.mode-btn:hover { transform: scale(1.05); }
.mode-btn:active { transform: scale(0.95); }

.mode-btn-face {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 14px;
  backface-visibility: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  overflow: hidden;
}

.mode-btn-front {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  transform: rotateX(0deg);
  z-index: 2;
}

.mode-btn-back {
  background: linear-gradient(135deg, #ff6b9d, #ffb3d9);
  color: white;
  transform: rotateX(180deg);
  box-shadow: 0 10px 30px rgba(255, 107, 157, 0.5);
  border: none;
}

.text-cube-container {
  perspective: 800px;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.text-cube {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotateX(0deg);
}

body.movie-mode .mode-btn[data-mode="movie"] .text-cube,
body.anime-mode .mode-btn[data-mode="anime"] .text-cube {
  animation: rotateCube 12s infinite cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

.mode-btn .cube-face {
  position: absolute;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  backface-visibility: hidden;
  white-space: nowrap;
  border-radius: 12px;
  padding: 0 0.5rem;
}

body.movie-mode .mode-btn[data-mode="movie"] .cube-face {
  background: linear-gradient(135deg, #c31432, #8e2de2);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
}

body.anime-mode .mode-btn[data-mode="anime"] .cube-face {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.mode-btn:not(.active) .cube-face {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.mode-btn .cube-face-front { transform: translateZ(28px); }
.mode-btn .cube-face-top { transform: rotateX(-90deg) translateZ(28px); }
.mode-btn .cube-face-back { transform: rotateX(-180deg) translateZ(28px); }
.mode-btn .cube-face-bottom { transform: rotateX(-270deg) translateZ(28px); }

@keyframes rotateCube {
  0%, 20%   { transform: rotateX(0deg); }
  25%, 45%  { transform: rotateX(90deg); }
  50%, 70%  { transform: rotateX(180deg); }
  75%, 95%  { transform: rotateX(270deg); } 
  100%      { transform: rotateX(360deg); }
}

body.movie-mode .mode-btn[data-mode="movie"] {
  border-color: rgba(195, 20, 50, 0.8);
  box-shadow: 0 10px 30px rgba(195, 20, 50, 0.6);
}
body.movie-mode .mode-btn[data-mode="movie"] .mode-btn-front {
  background: linear-gradient(135deg, #c31432, #8e2de2);
  border-color: rgba(195, 20, 50, 0.8);
}

body.anime-mode .mode-btn[data-mode="anime"] {
  border-color: rgba(79, 172, 254, 0.8);
  box-shadow: 0 10px 30px rgba(79, 172, 254, 0.6);
}
body.anime-mode .mode-btn[data-mode="anime"] .mode-btn-front {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border-color: rgba(79, 172, 254, 0.8);
}

.photocards-section {
  margin-bottom: 3rem;
}

.section-title {
  text-align: center;
  color: white;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 4px 15px rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.photocards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.photocard {
  background: white;
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.4s var(--transition-smooth);
  animation: fadeInUp 0.6s ease backwards;
  aspect-ratio: 3/4.5;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.photocard:nth-child(1) { animation-delay: 0.1s; }
.photocard:nth-child(2) { animation-delay: 0.2s; }
.photocard:nth-child(3) { animation-delay: 0.3s; }
.photocard:nth-child(4) { animation-delay: 0.4s; }
.photocard:nth-child(5) { animation-delay: 0.5s; }
.photocard:nth-child(6) { animation-delay: 0.6s; }

.photocard::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: 20px;
}

.photocard:hover {
  transform: translateY(-12px) scale(1.03);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 5px 15px rgba(0, 0, 0, 0.2);
}
.photocard:hover::before { opacity: 1; }

body.movie-mode .photocard {
    background: rgba(30, 30, 40, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
}
body.movie-mode .photocard-title { color: #f0f0f0; }
body.movie-mode .photocard-owner { color: #b0b0d0; }
body.movie-mode .photocard:hover {
    box-shadow: 0 15px 40px rgba(132, 59, 206, 0.4);
    border-color: rgba(132, 59, 206, 0.6);
}

body.anime-mode .photocard {
    background: linear-gradient(145deg, #ffffff 0%, #f0f8ff 100%);
    border: 2px solid #b4e4ff; 
    box-shadow: 0 8px 25px rgba(180, 228, 255, 0.4);
    color: #4a5568;
}
body.anime-mode .photocard-title { color: #2d3748; } 
body.anime-mode .photocard-owner { color: #718096; } 

body.anime-mode .photocard:hover {
    transform: translateY(-10px) rotate(1deg);
    box-shadow: 0 15px 35px rgba(255, 105, 180, 0.3);
    border-color: #ff69b4; 
}

.photocard-image {
  width: 100%;
  flex-shrink: 0;
  height: 65%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #f5f7fa;
}

.photocard-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.photocard:hover .photocard-image img { transform: scale(1.05); }

.photocard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0.8rem;
  padding-left: 0.5rem;
}

.photocard-header {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 5;
}

.media-badge {
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.3);
}

.photocard-title {
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.photocard-owner {
  font-size: 0.9rem;
  color: #718096;
  font-weight: 500;
}

.action-sidebar {
  position: fixed;
  right: 0; top: 50%;
  transform: translateY(-50%) translateX(60px);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  z-index: 1000;
  transition: transform 0.3s var(--transition-smooth);
  padding: 0.5rem;
}

.action-sidebar:hover,
.action-sidebar.expanded {
  transform: translateY(-50%) translateX(0);
}

.action-sidebar::before {
  content: "◀";
  position: absolute;
  left: -20px; top: 50%;
  transform: translateY(-50%);
  color: white; font-size: 0.8rem;
  opacity: 0.6;
  animation: pulseArrow 2s ease-in-out infinite;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.action-sidebar:hover::before { opacity: 0; }

@keyframes pulseArrow {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.6; }
  50% { transform: translateY(-50%) translateX(-5px); opacity: 1; }
}

.action-card {
  width: 70px; height: 70px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  border: none;
  position: relative;
}

.action-card::after {
  content: attr(data-label);
  position: absolute; right: 85px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap; opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-card:hover::after { opacity: 1; transform: translateX(0); }
.action-card:hover { transform: scale(1.15) rotate(5deg); box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6); }
.action-card:active { transform: scale(1.05); }

.dice-card { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.coin-card { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.dice-animation,
.coin-animation {
  font-size: 4rem;
  margin: 1rem 0;
  animation: spin 0.5s ease-in-out infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.result-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
}
.result-backdrop.show { opacity: 1; visibility: visible; }

.result-display {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: white;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 360px; width: 90%;
  z-index: 9999;
  opacity: 0; visibility: hidden;
  transition: all 0.4s var(--transition-bounce);
}
.result-display.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

.result-image-box {
  width: 100%; max-width: 200px;
  aspect-ratio: 2/3;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
}

.result-image-box img { width: 100%; height: 100%; object-fit: cover; }
.result-image-fallback {
  font-size: 3.5rem;
  display: none; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  position: absolute; top: 0; left: 0;
}

.result-title { font-size: 1.3rem; color: #2d3748; margin-bottom: 0.5rem; font-weight: 700; }
.result-meta { color: #718096; font-size: 1rem; margin-bottom: 1rem; }

.popup-close-btn {
  margin-top: 1rem; padding: 0.8rem 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.popup-close-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }
.popup-close-btn:active { transform: translateY(0) scale(1); }

.coin-flipping { animation: coinFlip3D 2s ease-out forwards; }

@keyframes coinFlip3D {
  0% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(1800deg) scale(1.3); }
  100% { transform: rotateY(3600deg) scale(1); }
}

.coin-selection-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.coin-selection-modal.show { display: flex; animation: fadeIn 0.3s ease; }

.coin-selection-content {
  background: white; padding: 2rem; border-radius: 24px;
  max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.6),
    0 0 40px 15px rgba(102, 126, 234, 0.3),
    0 0 80px 30px rgba(102, 126, 234, 0.15), 0 25px 50px rgba(0, 0, 0, 0.2);
  animation: bounceIn 0.5s var(--transition-bounce);
}

.coin-selection-content h2 { color: #667eea; margin-bottom: 0.8rem; font-size: 1.6rem; font-weight: 700; }
.coin-selection-content p { color: #718096; margin-bottom: 1.5rem; font-size: 0.95rem; }

.character-selection, .side-selection {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.5rem;
}

.character-option, .side-option {
  background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
  border: 3px solid #e2e8f0; border-radius: 16px;
  padding: 1.2rem 0.8rem; cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.character-option:hover, .side-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.character-option.selected {
  border-color: #10b981;
  background: linear-gradient(145deg, #d1fae5 0%, #a7f3d0 100%);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(16, 185, 129, 0.2);
  transform: translateY(-2px);
}

.character-option .emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.character-option .name { font-weight: 700; font-size: 1.1rem; color: #2d3748; }
.character-option.selected .name { color: #065f46; }

.side-option { color: #475569; font-weight: 700; font-size: 1.1rem; }
.side-option.selected {
  border-color: #f59e0b;
  background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(245, 158, 11, 0.2);
  transform: translateY(-2px);
}

.modal-actions { display: flex; gap: 1rem; justify-content: center; }

.modal-btn {
  padding: 0.9rem 1.8rem; border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}

.modal-btn-primary {
  background: linear-gradient(145deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.modal-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79, 172, 254, 0.5); }

.modal-btn-secondary {
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #64748b; border: 2px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.modal-btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12); }

.ticket-generator {
  position: fixed; bottom: 30px; right: 30px;
  z-index: 9999;
  animation: floatBtn 3s ease-in-out infinite;
}

.ticket-btn {
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
  color: white; border: 2px solid white;
  padding: 8px 16px; border-radius: 50px;
  font-family: 'Quicksand', sans-serif; font-weight: 700; font-size: 0.85rem;
  cursor: pointer; box-shadow: 0 8px 20px rgba(255, 154, 158, 0.5);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 1px;
}
.ticket-btn span { font-size: 1.1rem; }
.ticket-btn:hover { transform: scale(1.05) rotate(-3deg); background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.ticket-btn:active { transform: scale(0.95); }

@keyframes floatBtn {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.ticket-modal {
  perspective: 1200px;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 10000;
}
.ticket-modal.show { display: flex; animation: fadeIn 0.3s ease; }

.ticket-content {
  background: transparent; width: 100%; max-width: 680px;
  display: flex;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.4)) drop-shadow(0 5px 10px rgba(0,0,0,0.2));
  font-family: 'Courier Prime', 'Courier New', monospace;
  animation: printTicket 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: top center;
  position: relative;
}

@keyframes printTicket {
  0% { opacity: 0; transform: translateY(-100px) rotateX(-20deg); }
  100% { opacity: 1; transform: translateY(0) rotateX(0); }
}

.ticket-content::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 2;
  mix-blend-mode: overlay; border-radius: 16px;
  -webkit-mask-image: linear-gradient(to right, black 70%, transparent 70%), linear-gradient(to left, black 29%, transparent 29%);
}

.ticket-left {
  flex: 1; background-color: #c42525;
  background-image: radial-gradient(circle at top right, transparent 14px, #c42525 14.5px),
    radial-gradient(circle at bottom right, transparent 14px, #c42525 14.5px);
  background-position: top right, bottom right;
  background-size: 100% 51%; background-repeat: no-repeat;
  border-radius: 16px 0 0 16px; padding: 2.2rem;
  display: flex; flex-direction: column; position: relative;
  color: rgba(255, 255, 255, 0.95);
  box-shadow: inset 2px 2px 10px rgba(0,0,0,0.1);
}

.ticket-right {
  width: 200px; background-color: #f7f5f0;
  background-image: radial-gradient(circle at top left, transparent 14px, #f7f5f0 14.5px),
    radial-gradient(circle at bottom left, transparent 14px, #f7f5f0 14.5px);
  background-position: top left, bottom left;
  background-size: 100% 51%; background-repeat: no-repeat;
  border-radius: 0 16px 16px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
  border-left: 2px dashed rgba(0,0,0,0.15);
  box-shadow: inset -2px 2px 10px rgba(0,0,0,0.05);
}

.ticket-cinema-name {
  font-family: var(--font-base); font-size: 0.7rem;
  letter-spacing: 3px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6); margin-bottom: 0.5rem;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.ticket-movie-title-real {
  font-family: var(--font-base); font-size: 2.4rem;
  font-weight: 900; text-transform: uppercase; line-height: 1;
  margin-bottom: 2.5rem; letter-spacing: -1px;
  text-shadow: 0 0 1px rgba(255,255,255,0.4), 2px 2px 0 rgba(0,0,0,0.15);
}

.ticket-info-group { display: flex; gap: 3rem; margin-bottom: 1.5rem; }
.ticket-info-item { display: flex; flex-direction: column; }
.ticket-label {
  font-size: 0.55rem; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5); letter-spacing: 1.5px;
  margin-bottom: 4px; font-weight: 700;
}
.ticket-val {
  font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.5px; text-shadow: 0 0 1px rgba(255,255,255,0.2);
}

.stub-id {
  position: absolute; top: 1.5rem;
  font-size: 0.75rem; color: #666;
  letter-spacing: 3px; font-family: monospace;
}

.stub-label {
  font-family: var(--font-base); font-weight: 900; font-size: 2rem;
  text-transform: uppercase; color: rgba(0,0,0,0.1);
  transform: rotate(90deg); white-space: nowrap;
  letter-spacing: 6px; margin-left: 10px;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
}

.barcode-vertical {
  width: 45px; height: 72%;
  filter: blur(0.3px) contrast(1.2); mix-blend-mode: multiply; opacity: 0.85;
  background: repeating-linear-gradient(0deg, #111, #111 2px, transparent 2px, transparent 5px, #111 5px, #111 8px);
  position: absolute; right: 1.5rem; top: 50%; transform: translateY(-50%);
}

.cursor-trail-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9999;
}

.cursor-particle {
  position: absolute; pointer-events: none;
  animation: particleFade 1s ease-out forwards;
}

body.movie-mode .cursor-particle {
  width: 8px; height: 8px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(200, 150, 255, 0.5), transparent);
  border-radius: 50%; box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

body.anime-mode .cursor-particle {
  width: 20px; height: 12px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 40%, transparent 70%);
  border-radius: 50%; filter: blur(3px);
}

@keyframes particleFade {
  0% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.3) translateY(-20px); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .header h1 { font-size: 2rem; }
  .mode-toggle { gap: 1rem; }
  .mode-btn { width: 130px; height: 50px; }
  .mode-btn-face { font-size: 0.9rem; }
  .cube-face { font-size: 0.85rem; }
  .photocards-grid { grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
  .action-sidebar { transform: translateY(-50%) translateX(50px); }
  .action-card { width: 60px; height: 60px; font-size: 1.8rem; }
  .ticket-generator { 
    bottom: 1.5rem; 
    right: 1.5rem; 
  }
  .ticket-btn { 
    padding: 1rem 1.5rem; 
    font-size: 0.95rem;
    min-height: 48px;
    min-width: 48px;
    box-shadow: 0 8px 20px rgba(255, 154, 158, 0.6);
  }
  .result-display { padding: 1.5rem 1rem; max-width: 90%; }
  .result-image-box { max-width: 160px; }
}

@media (max-width: 650px) {
  .ticket-content { flex-direction: column; max-width: 320px; }
  .ticket-left { border-radius: 16px 16px 0 0; background-position: bottom left, bottom right; }
  .ticket-right { width: 100%; height: 120px; border-radius: 0 0 16px 16px; border-left: none; border-top: 2px dashed rgba(0,0,0,0.15); background-position: top left, top right; }
  .barcode-vertical { width: 100%; height: 35px; right: auto; left: 0; bottom: 1.5rem; top: auto; transform: none; background: repeating-linear-gradient(90deg, #111, #111 2px, transparent 2px, transparent 5px, #111 5px, #111 8px); }
  .stub-label { display: none; }
  .stub-id { top: auto; bottom: 65px; left: 50%; transform: translateX(-50%); }
}

@media (max-width: 600px) {
  .dynamic-word-container { width: 180px; }
  .header-rotator { font-size: 1rem; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 1.6rem; }
  .mode-btn { width: 110px; height: 46px; }
  .mode-btn-face { font-size: 0.8rem; }
  .cube-face { font-size: 0.75rem; }
  .photocards-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .photocard { padding: 0.75rem; }
  .photocard-title { font-size: 0.9rem; }
  .photocard-owner { font-size: 0.8rem; }
  .dice-animation, .coin-animation { font-size: 3rem; }
  .result-title { font-size: 1.1rem; }
  .coin-selection-content { padding: 1.5rem; }
  .character-option .emoji { font-size: 2.5rem; }
  .ticket-generator { 
    bottom: 1rem; 
    right: 1rem; 
  }
  .ticket-btn { 
    padding: 0.9rem 1.3rem; 
    font-size: 0.85rem;
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}