* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a0f;
  --bg-card: #16161f;
  --accent: #ff3366;
  --accent-glow: rgba(255, 51, 102, 0.4);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100vh;
  position: relative;
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

/* Start Screen */
.start-screen {
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(255, 51, 102, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(102, 51, 255, 0.1) 0%, transparent 50%),
    var(--bg-dark);
}

.floating-shards {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.floating-shard {
  position: absolute;
  width: 4px;
  height: 4px;
  background: linear-gradient(135deg, var(--accent), #6633ff);
  opacity: 0.3;
  animation: floatShard 15s infinite ease-in-out;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

@keyframes floatShard {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% {
    transform: translateY(-100px) rotate(720deg);
    opacity: 0;
  }
}

.main-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(4rem, 15vw, 10rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ff3366, #ff6633, #ff3366);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientPulse 3s ease infinite;
  text-shadow: 0 0 60px var(--accent-glow);
  margin-bottom: 0.5rem;
}

@keyframes gradientPulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-weight: 300;
}

.input-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 500px;
}

.break-input {
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s ease;
}

.break-input::placeholder {
  color: var(--text-secondary);
}

.break-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.break-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 1.25rem 3rem;
  background: linear-gradient(135deg, var(--accent), #ff6633);
  border: none;
  border-radius: 16px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.break-btn.pulse {
  animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow); }
}

.break-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 40px var(--accent-glow);
}

.break-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

.surprise-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  padding: 1rem 2rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.surprise-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.gallery-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #6633ff, #3366ff);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1.5rem;
}

.gallery-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 51, 255, 0.3);
}

/* Breaking Screen */
.breaking-screen {
  background: var(--bg-dark);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.break-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.break-object {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: objectAppear 0.5s ease;
  z-index: 5;
}

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

.break-object.breaking {
  animation: shatter 0.3s ease forwards;
}

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

.object-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Object Visuals */
.object-glass {
  width: 150px;
  height: 200px;
  background: linear-gradient(135deg, rgba(135, 206, 235, 0.3), rgba(176, 224, 230, 0.5));
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(135, 206, 235, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.1);
}

.glass-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.object-solid {
  width: 180px;
  height: 180px;
  background: linear-gradient(135deg, #696969, #808080);
  border-radius: 4px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.brick {
  position: absolute;
  width: 30%;
  height: 45%;
  background: linear-gradient(135deg, #8B7355, #A9A9A9);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.object-electronic {
  width: 160px;
  height: 200px;
  background: linear-gradient(180deg, #2a2a2a, #1a1a1a);
  border: 3px solid #333;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.screen-content {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 70%;
  background: #0f0f1a;
  border-radius: 4px;
  overflow: hidden;
}

.circuit-line {
  position: absolute;
  height: 2px;
  background: #00ff00;
  box-shadow: 0 0 10px #00ff00;
  animation: circuitPulse 1s infinite;
}

.circuit-line:nth-child(1) { top: 20%; left: 10%; width: 60%; }
.circuit-line:nth-child(2) { top: 50%; left: 20%; width: 50%; animation-delay: 0.3s; }
.circuit-line:nth-child(3) { top: 80%; left: 5%; width: 70%; animation-delay: 0.6s; }

@keyframes circuitPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.object-emotional {
  width: 180px;
  height: 180px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emotion-core {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #9370DB, #8A2BE2);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(147, 112, 219, 0.6);
  animation: emotionPulse 2s ease-in-out infinite;
}

.emotion-aura {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 2px solid rgba(147, 112, 219, 0.3);
  border-radius: 50%;
  animation: auraExpand 2s ease-out infinite;
}

.emotion-aura.delay {
  animation-delay: 1s;
}

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

@keyframes auraExpand {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.object-soft {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle at 30% 30%, #FFC0CB, #FFB6C1);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 10px 40px rgba(255, 182, 193, 0.3);
  animation: softFloat 3s ease-in-out infinite;
}

.soft-highlight {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 30%;
  height: 30%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.object-metal {
  width: 200px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  transition: transform 0.1s ease;
}

.chain-link {
  position: absolute;
  width: 40px;
  height: 50px;
  border: 6px solid #C0C0C0;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.3);
}

.object-paper {
  width: 140px;
  height: 180px;
  background: linear-gradient(180deg, #FFFAF0, #FAF0E6);
  border-radius: 2px;
  position: relative;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transform: rotate(-2deg);
}

.paper-line {
  position: absolute;
  left: 15%;
  width: 70%;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}

.paper-line:nth-child(1) { top: 25%; }
.paper-line:nth-child(2) { top: 45%; }
.paper-line:nth-child(3) { top: 65%; }

.instruction {
  position: fixed;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.25rem;
  color: var(--text-secondary);
  animation: instructionPulse 2s ease-in-out infinite;
}

@keyframes instructionPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.tap-progress {
  position: fixed;
  bottom: 10%;
  display: flex;
  gap: 8px;
}

.tap-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--glass);
  border: 2px solid var(--glass-border);
  transition: all 0.2s ease;
}

.tap-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

.hold-progress {
  position: fixed;
  bottom: 10%;
  width: 200px;
  height: 8px;
  background: var(--glass);
  border-radius: 4px;
  overflow: hidden;
}

.hold-fill {
  height: 100%;
  background: linear-gradient(90deg, #9370DB, #ff3366);
  transition: width 0.1s ease;
  box-shadow: 0 0 20px rgba(147, 112, 219, 0.5);
}

.encouragement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
  animation: encouragementFade 2s ease forwards;
  z-index: 100;
}

@keyframes encouragementFade {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}

/* Result Screen */
.result-screen {
  background: 
    radial-gradient(ellipse at center, rgba(102, 51, 255, 0.15) 0%, transparent 60%),
    var(--bg-dark);
}

.result-content {
  text-align: center;
  max-width: 500px;
}

.result-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  animation: resultAppear 0.5s ease;
}

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

.broken-item {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.broken-item span {
  color: var(--accent);
  font-weight: 600;
}

.encouragement-result {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 2rem;
  font-style: italic;
}

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

.action-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--accent), #ff6633);
  color: white;
}

.action-btn.secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: white;
}

.action-btn.accent {
  background: linear-gradient(135deg, #6633ff, #3366ff);
  color: white;
}

.action-btn:hover {
  transform: translateY(-2px);
}

.stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
}

.stat {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Art Screen */
.art-screen {
  background: var(--bg-dark);
  padding: 1rem;
}

.back-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  z-index: 100;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.art-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding-top: 4rem;
}

.art-canvas {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.art-info {
  text-align: center;
}

.art-info h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.art-stats {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.broken-list {
  font-size: 0.9rem;
  color: var(--accent);
  max-width: 300px;
}

.art-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.download-btn, .share-btn, .new-btn {
  font-family: 'Space Grotesk', sans-serif;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.download-btn {
  background: linear-gradient(135deg, #00c853, #00e676);
  color: white;
}

.share-btn {
  background: linear-gradient(135deg, #2196f3, #03a9f4);
  color: white;
}

.new-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: white;
}

.download-btn:hover, .share-btn:hover, .new-btn:hover {
  transform: translateY(-2px);
}

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

.download-modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.download-modal h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.option-group {
  margin-bottom: 1.5rem;
}

.option-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.option-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.option-buttons button {
  flex: 1;
  min-width: 60px;
  padding: 0.5rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.option-buttons button.selected {
  background: var(--accent);
  border-color: var(--accent);
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.download-buttons button {
  padding: 1rem;
  background: linear-gradient(135deg, #6633ff, #3366ff);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.download-buttons button:hover {
  transform: translateY(-2px);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  color: white;
  background: var(--glass);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 640px) {
  .main-title {
    font-size: clamp(3rem, 12vw, 6rem);
  }
  
  .input-form {
    padding: 0 1rem;
  }
  
  .art-actions {
    flex-direction: column;
    width: 100%;
    padding: 0 1rem;
  }
  
  .download-btn, .share-btn, .new-btn {
    width: 100%;
  }
  
  .option-buttons {
    flex-wrap: wrap;
  }
  
  .option-buttons button {
    min-width: 45%;
  }
}

/* Screen shake effect */
@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.breaking-screen.shaking {
  animation: screenShake 0.3s ease;
}