:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  
  /* Phase colors */
  --phase-1-accent: #3b82f6;
  --phase-2-accent: #8b5cf6;
  --phase-3-accent: #dc2626;
  --phase-4-accent: #991b1b;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.5s ease;
  position: relative;
}

/* Phase Styles */
.phase-1 {
  --accent: var(--phase-1-accent);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.phase-2 {
  --accent: var(--phase-2-accent);
  background: linear-gradient(135deg, #ede9fe 0%, #c4b5fd 100%);
}

.phase-3 {
  --accent: var(--phase-3-accent);
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  animation: subtleShake 5s ease-in-out infinite;
}

.phase-4 {
  --accent: var(--phase-4-accent);
  background: linear-gradient(135deg, #1f1f1f 0%, #3f0f0f 100%);
  color: #fecaca;
  animation: intenseShake 0.5s ease-in-out infinite;
}

@keyframes subtleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-0.5deg); }
  75% { transform: translateX(2px) rotate(0.5deg); }
}

@keyframes intenseShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.phase-4 .app-header {
  background: rgba(0, 0, 0, 0.8);
  border-bottom-color: #991b1b;
}

.main-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.phase-4 .main-title {
  color: #fecaca;
}

.main-title.glitch {
  animation: glitch 0.3s infinite;
}

@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); filter: hue-rotate(90deg); }
  40% { transform: translate(2px, -2px); filter: hue-rotate(-90deg); }
  60% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, -1px); }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.antagonism-level {
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
  font-size: 0.875rem;
}

.phase-4 .antagonism-level {
  background: rgba(255, 255, 255, 0.1);
}

.level-value {
  font-size: 1.25rem;
}

.help-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.help-button:hover {
  background: var(--accent);
  color: white;
  transform: rotate(180deg);
}

/* Dashboard */
.antagonism-dashboard {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.phase-4 .antagonism-dashboard {
  background: rgba(153, 27, 27, 0.3);
  border-bottom-color: #991b1b;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.frustration-bar {
  width: 150px;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.frustration-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
  transition: width 0.3s ease;
}

.mock-message {
  margin-left: auto;
  font-style: italic;
  color: var(--accent);
  animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  10%, 90% { opacity: 1; }
}

/* Form Container */
.form-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.hostile-form {
  width: 100%;
  max-width: 450px;
  background: var(--bg-secondary);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.phase-4 .hostile-form {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #991b1b;
  box-shadow: 0 0 50px rgba(153, 27, 27, 0.5);
}

.form-group {
  margin-bottom: 1.5rem;
  transition: all 0.5s ease;
}

.form-group.swapped {
  animation: swap 0.5s ease;
}

@keyframes swap {
  0% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-20px); opacity: 0.5; }
  100% { transform: translateY(0); opacity: 1; }
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.phase-4 .form-label {
  color: #fecaca;
}

.tooltip {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
  font-style: italic;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background: var(--bg-primary);
}

.phase-4 .form-input {
  background: rgba(0, 0, 0, 0.4);
  border-color: #991b1b;
  color: #fecaca;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input.laggy {
  transition: all 0.3s ease 0.15s;
}

.form-input.sticky {
  transition: all 0.1s ease 0.05s;
}

/* Checkbox */
.checkbox-group {
  margin-top: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  background: var(--bg-primary);
}

.custom-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.custom-checkbox.checked::after {
  content: '✓';
  color: white;
  font-weight: 700;
}

/* Loading */
.fake-loading {
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.phase-4 .fake-loading {
  background: rgba(153, 27, 27, 0.2);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #10b981 100%);
  transition: width 0.2s ease;
}

/* Submit Area */
.submit-area {
  position: relative;
  min-height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.submit-button {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  z-index: 10;
}

.submit-button:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
  box-shadow: 0 10px 30px -5px rgba(59, 130, 246, 0.4);
}

.phase-2-button,
.phase-3-button,
.phase-4-button {
  transition: transform 0.05s ease;
}

.decoy-button {
  position: absolute;
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.decoy-button:hover {
  opacity: 1;
}

/* Error Modal */
.error-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 100;
  text-align: center;
  transition: transform 0.2s ease;
  border: 2px solid #ef4444;
}

.phase-4 .error-modal {
  background: #1f1f1f;
  color: #fecaca;
  border-color: #991b1b;
}

.error-modal h3 {
  color: #ef4444;
  margin-bottom: 0.5rem;
}

.error-modal p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.phase-4 .error-modal p {
  color: #fca5a5;
}

.error-close {
  padding: 0.5rem 1.5rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

/* Lock Overlay */
.lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: lockPulse 1s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% { background: rgba(0, 0, 0, 0.95); }
  50% { background: rgba(153, 27, 27, 0.95); }
}

.lock-overlay h2 {
  font-size: 3rem;
  color: #ef4444;
  margin-bottom: 1rem;
}

.lock-overlay p {
  color: #fca5a5;
  font-size: 1.25rem;
}

.lock-timer {
  margin-top: 2rem;
  color: #991b1b;
  font-size: 1rem;
}

/* Footer */
.app-footer {
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.phase-4 .app-footer {
  background: rgba(0, 0, 0, 0.8);
  border-top-color: #991b1b;
  color: #fca5a5;
}

.give-up-text {
  font-size: 0.5rem;
  opacity: 0.2;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.give-up-text:hover {
  opacity: 0.5;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.3s ease;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Still Hint */
.still-hint {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.9);
  color: white;
  padding: 1rem 2rem;
  border-radius: 9999px;
  font-weight: 600;
  animation: pulse 1s ease-in-out infinite;
  z-index: 50;
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

/* Victory Screen */
.victory-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  text-align: center;
  padding: 2rem;
}

.victory-title {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.victory-subtitle {
  font-size: 1.5rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.victory-stats {
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem 2.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.victory-stats p {
  margin: 0.5rem 0;
  font-size: 1.125rem;
}

.victory-button {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  background: white;
  color: #059669;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}

.victory-button:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.victory-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.875rem;
}

.victory-link:hover {
  color: white;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .antagonism-dashboard {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .mock-message {
    margin-left: 0;
    margin-top: 0.5rem;
  }
  
  .hostile-form {
    padding: 1.5rem;
  }
  
  .main-title {
    font-size: 1.5rem;
  }
  
  .victory-title {
    font-size: 2.5rem;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}