/* Fortune Teller - Minimalist Black & White Design */

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

:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --border-color: #000000;
  --accent-color: #000000;
  --secondary-bg: #f5f5f5;
  --error-color: #cc0000;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: 600px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 3rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1rem;
  opacity: 0.7;
  font-weight: 400;
}

/* Animated ASCII Cat */
.cat-container {
  position: relative;
  display: inline-block;
}

.speech-bubble {
  position: absolute;
  top: 20px;
  background: white;
  border: 2px solid black;
  border-radius: 15px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  width: 160px;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  animation: bobble 2s ease-in-out infinite;
  transition: all 0.3s ease;
}

/* Text mode - bubble on left */
.speech-bubble.position-left {
  left: -180px;
  right: auto;
}

.speech-bubble.position-left::before {
  content: '';
  position: absolute;
  right: -15px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid black;
  border-right: none;
}

.speech-bubble.position-left::after {
  content: '';
  position: absolute;
  right: -11px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid white;
  border-right: none;
}

/* Voice mode - bubble on right */
.speech-bubble.position-right {
  right: -180px;
  left: auto;
}

.speech-bubble.position-right::before {
  content: '';
  position: absolute;
  left: -15px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 15px solid black;
  border-left: none;
}

.speech-bubble.position-right::after {
  content: '';
  position: absolute;
  left: -11px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid white;
  border-left: none;
}

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

/* Loading dots animation */
.loading-dots {
  display: inline-block;
  animation: dots 1.5s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
  width: 0;
}

@keyframes dots {
  0% {
    width: 0;
  }
  25% {
    width: 0.3em;
  }
  50% {
    width: 0.6em;
  }
  75% {
    width: 0.9em;
  }
  100% {
    width: 1.2em;
  }
}

/* Loading state bubble */
.speech-bubble[data-loading="true"] {
  background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
  border-color: #666;
  font-style: italic;
}

/* Speech bubble always visible */
.speech-bubble {
  transition: opacity 0.3s ease;
}

.ascii-cat {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
  margin: 1.5rem auto;
  opacity: 0.8;
  animation: catFloat 3s ease-in-out infinite;
  white-space: pre;
  color: var(--text-color);
}

@keyframes catFloat {
  0%, 100% {
    opacity: 0.7;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.cat-face {
  display: inline-block;
  position: relative;
  width: 3ch;
  height: 1em;
  vertical-align: baseline;
}

.eyes-open,
.eyes-closed {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  text-align: center;
}

.eyes-open {
  animation: showOpen 4s infinite;
}

.eyes-closed {
  animation: showClosed 4s infinite;
}

@keyframes showOpen {
  0%, 48%, 52%, 100% {
    opacity: 1;
  }
  49%, 51% {
    opacity: 0;
  }
}

@keyframes showClosed {
  0%, 48%, 52%, 100% {
    opacity: 0;
  }
  49%, 51% {
    opacity: 1;
  }
}

.ascii-cat::after {
  /* content: '🐾'; */
  display: inline-block;
  animation: pawPrint 2s ease-in-out infinite;
  margin-left: 5px;
}

.ascii-cat::before {
  /* content: '🐾'; */
  display: inline-block;
  animation: pawPrint 2s ease-in-out infinite reverse;
  margin-right: 5px;
}

@keyframes pawPrint {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.mode-btn {
  flex: 1;
  padding: 1rem;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  color: var(--text-color);
  opacity: 0.5;
}

.mode-btn.active {
  opacity: 1;
  font-weight: 600;
}

.mode-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-color);
}

/* Input Sections */
.input-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.input-section.active {
  display: block;
}

/* Text Input */
textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin-bottom: 1rem;
}

textarea:focus {
  outline: none;
}

textarea::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

/* Buttons */
.submit-btn {
  width: 100%;
  padding: 1rem 2rem;
  background-color: var(--accent-color);
  color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  background-color: var(--bg-color);
  color: var(--text-color);
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn.secondary {
  background-color: var(--bg-color);
  color: var(--text-color);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Button Loader */
.btn-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes btnSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Voice Controls */
.voice-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.record-btn, .stop-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  background-color: var(--bg-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  --mouse-x: 0.5;
  --mouse-y: 0.5;
}

.record-btn:hover {
  background-color: var(--secondary-bg);
  transform: scale(1.05);
}

.record-icon {
  width: 40px;
  height: 40px;
  background-color: var(--accent-color);
  border-radius: 50%;
  transition: transform 0.1s ease;
  will-change: transform;
}

.record-btn:hover .record-icon {
  transform: translate(
    calc((var(--mouse-x) - 0.5) * 30px),
    calc((var(--mouse-y) - 0.5) * 30px)
  );
}

.stop-icon {
  width: 30px;
  height: 30px;
  background-color: var(--accent-color);
}

.recording-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: var(--secondary-bg);
  border-radius: 8px;
}

.recording-dot {
  width: 12px;
  height: 12px;
  background-color: #ff0000;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

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

.recording-timer {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  margin-left: auto;
}

/* Playback Section */
.playback-section {
  background-color: var(--secondary-bg);
  padding: 1.5rem;
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

.transcription-label {
  font-size: 0.875rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.transcription-text {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.playback-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.control-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.control-btn.secondary {
  border-style: dashed;
}

/* Loading Section */
.loading-section {
  text-align: center;
  padding: 3rem 0;
}

.crystal-ball {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-ball {
  font-size: 6rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(138, 43, 226, 0.3));
}

.sparkle {
  position: absolute;
  font-size: 1.2rem;
  animation: sparkleFloat 3s ease-in-out infinite;
  opacity: 0;
}

.sparkle-1 {
  top: 0;
  left: 50%;
  animation-delay: 0s;
}

.sparkle-2 {
  top: 20%;
  right: 5px;
  animation-delay: 0.5s;
}

.sparkle-3 {
  bottom: 30%;
  right: 0;
  animation-delay: 1s;
}

.sparkle-4 {
  bottom: 10px;
  left: 50%;
  animation-delay: 1.5s;
}

.sparkle-5 {
  bottom: 30%;
  left: 0;
  animation-delay: 2s;
}

.sparkle-6 {
  top: 20%;
  left: 5px;
  animation-delay: 2.5s;
}

@keyframes sparkleFloat {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
  40% {
    opacity: 0.8;
    transform: translateY(-20px) scale(0.8);
  }
  60% {
    opacity: 0.5;
    transform: translateY(-25px) scale(0.6);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(0.3);
  }
}

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

.loading-text {
  font-size: 1.125rem;
  opacity: 0.7;
  animation: fadeInOut 2s ease-in-out infinite;
}

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

/* Result Section */
.result-card {
  background-color: var(--secondary-bg);
  padding: 2rem;
  border-radius: 12px;
  border: 3px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.result-card h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.fortune-text {
  font-size: 1.125rem;
  line-height: 1.8;
  font-style: italic;
}

/* Volume Visualizer */
.volume-visualizer {
  display: block;
  width: 100%;
  height: 60px;
  margin: 1rem 0;
  border-radius: 8px;
  background: #f5f5f5;
  border: 2px solid var(--border-color);
}

/* Live Transcription */
.live-transcription {
  font-style: italic;
  opacity: 0.7;
  margin-top: 0.5rem;
  min-height: 1.5em;
  text-align: center;
  color: var(--text-color);
  font-size: 1rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  transition: opacity 0.3s ease;
}

/* Voice Error */
#voiceError {
  margin-top: 1rem;
  padding: 1rem;
  background-color: rgba(204, 0, 0, 0.05);
  border: 2px solid var(--error-color);
  border-radius: 8px;
  color: var(--error-color);
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Error Section */
.error-section {
  text-align: center;
  padding: 2rem;
  background-color: rgba(204, 0, 0, 0.05);
  border: 2px solid var(--error-color);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--error-color);
  margin-bottom: 1rem;
}

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

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

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

footer p {
  font-size: 0.75rem;
  opacity: 0.5;
}

/* Council Section Styles */
.council-section {
  animation: fadeIn 0.5s ease;
}

.council-header {
  text-align: center;
  margin-bottom: 2rem;
}

.council-header h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.council-progress {
  font-size: 1rem;
  opacity: 0.7;
  font-style: italic;
  animation: fadeInOut 2s ease-in-out infinite;
}

.council-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.council-card {
  background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.5s ease;
  opacity: 0;
  transform: translateY(20px);
}

.council-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Agent-specific color themes */
.council-card-purple {
  border-color: #6b4c9a;
  background: linear-gradient(135deg, #f3f0f7 0%, #ffffff 100%);
}

.council-card-midnight {
  border-color: #2c3e50;
  background: linear-gradient(135deg, #e8eef2 0%, #ffffff 100%);
}

.council-card-gold {
  border-color: #d4af37;
  background: linear-gradient(135deg, #faf8f0 0%, #ffffff 100%);
}

.council-card-orange {
  border-color: #e67e22;
  background: linear-gradient(135deg, #fdf6f0 0%, #ffffff 100%);
}

.council-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.council-emoji {
  font-size: 2.5rem;
  animation: emojiBounce 2s ease-in-out infinite;
}

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

.council-info {
  flex: 1;
}

.council-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.council-number {
  font-size: 0.875rem;
  opacity: 0.5;
  font-weight: 500;
}

.council-response {
  font-size: 1.0625rem;
  line-height: 1.7;
  font-style: italic;
  margin: 0;
  min-height: 3em;
}

.council-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.council-actions .submit-btn,
.council-actions .control-btn {
  margin: 0;
}

.council-actions .control-btn.secondary {
  width: 100%;
  padding: 0.75rem;
}

/* Action Plan Section */
.action-plan-section {
  animation: fadeIn 0.5s ease;
}

.action-plan-prompt {
  text-align: center;
  margin-bottom: 2rem;
}

.action-plan-prompt h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.action-plan-prompt p {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.action-input-group {
  margin-top: 1.5rem;
}

.goal-input {
  width: 100%;
  padding: 1rem;
  font-family: inherit;
  font-size: 1rem;
  border: 3px solid var(--border-color);
  border-radius: 8px;
  resize: vertical;
  min-height: 80px;
  transition: all 0.3s ease;
}

.goal-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.action-buttons .submit-btn {
  flex: 1;
  min-width: 200px;
}

.action-plan-result {
  animation: fadeIn 0.5s ease;
}

.action-plan-result h3 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.action-plan-content {
  background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 100%);
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.action-plan-content h1,
.action-plan-content h2,
.action-plan-content h3 {
  margin: 1.5rem 0 1rem 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.action-plan-content h1 {
  font-size: 1.75rem;
  border-bottom: 3px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.action-plan-content h2 {
  font-size: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.action-plan-content h3 {
  font-size: 1.25rem;
}

.action-plan-content .todo-item {
  padding: 1rem;
  margin: 0.75rem 0;
  background: white;
  border-left: 4px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
}

.action-plan-content .todo-item:hover {
  border-left-color: #000;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
  transform: translateX(2px);
}

.action-plan-content .todo-item::before {
  content: '✓';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: transparent;
  transition: all 0.3s ease;
}

.action-plan-content .todo-item:hover::before {
  color: var(--border-color);
  border-color: #000;
}

.action-plan-content strong {
  font-weight: 700;
  color: #000;
}

.action-plan-content em {
  font-style: italic;
  opacity: 0.9;
}

.action-plan-content code {
  background: #f0f0f0;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  border: 1px solid #e0e0e0;
}

.action-plan-content pre {
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  overflow-x: auto;
  margin: 1rem 0;
}

.action-plan-content pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: 0.9rem;
}

.action-plan-content ul {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0;
}

.action-plan-content li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
}

.action-plan-content li::before {
  content: '▸';
  position: absolute;
  left: 0.25rem;
  font-weight: bold;
}

/* Mobile Responsive Styles */
@media (max-width: 600px) {
  /* Reposition bubbles below the cat on mobile */
  .speech-bubble {
    position: relative;
    top: 0;
    left: auto !important;
    right: auto !important;
    width: auto;
    max-width: 100%;
    margin: 0 auto 1rem;
    display: block;
  }

  /* Hide speech bubble tails on mobile */
  .speech-bubble::before,
  .speech-bubble::after {
    display: none;
  }

  /* Adjust cat container for mobile */
  .cat-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .ascii-cat {
    order: 2;
    margin: 0;
  }

  .speech-bubble {
    order: 1;
  }

  /* Hide voice input on mobile */
  #voiceModeBtn {
    display: none !important;
  }

  #voiceSection {
    display: none !important;
  }
}
