@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700;900&family=Noto+Sans+JP:wght@300;400;700&family=Crimson+Pro:wght@400;600&display=swap');

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

:root {
  --pink-primary: #ff69b4;
  --pink-dark: #db4898;
  --purple-deep: #1a0a2e;
  --purple-mid: #2d1b4e;
  --blue-midnight: #0a0a1a;
  --cyan-accent: #00ffff;
  --cherry: #ffb6c1;
  --gold: #ffd700;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--blue-midnight);
  min-height: 100vh;
  overflow-x: hidden;
  color: #fff;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Breathing animation for sprites */
@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Main Menu */
.main-menu {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at center, var(--purple-mid) 0%, var(--blue-midnight) 70%);
}

.menu-background {
  position: absolute;
  inset: 0;
}

.cherry-blossoms {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 15% 25%, var(--cherry) 2px, transparent 2px),
    radial-gradient(circle at 85% 15%, var(--pink-primary) 3px, transparent 3px),
    radial-gradient(circle at 65% 75%, var(--cherry) 2px, transparent 2px),
    radial-gradient(circle at 25% 85%, var(--pink-primary) 2px, transparent 2px),
    radial-gradient(circle at 45% 45%, var(--cherry) 1px, transparent 1px);
  background-size: 100% 100%;
  animation: floatPetals 25s ease-in-out infinite;
  opacity: 0.3;
}

@keyframes floatPetals {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(15px) rotate(2deg); }
  50% { transform: translateY(25px) rotate(0deg); }
  75% { transform: translateY(10px) rotate(-2deg); }
}

.drone-silhouettes {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 45 L55 40 L60 45 L55 50 Z' fill='rgba(255,105,180,0.08)'/%3E%3C/svg%3E");
  background-size: 60px 60px;
  animation: driftDrones 40s linear infinite;
  opacity: 0.5;
}

@keyframes driftDrones {
  0% { background-position: 0 0; }
  100% { background-position: 120px 120px; }
}

.menu-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.title-container {
  margin-bottom: 2.5rem;
}

.propeller-icon {
  font-size: 3.5rem;
  animation: spinPropeller 2.5s linear infinite;
  display: inline-block;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 20px var(--pink-primary));
}

@keyframes spinPropeller {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.game-title-main {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink-primary) 0%, var(--cherry) 50%, var(--cyan-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerTitle 3s ease-in-out infinite;
  letter-spacing: -0.02em;
}

@keyframes shimmerTitle {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(255, 105, 180, 0.6)); }
  50% { filter: drop-shadow(0 0 25px rgba(255, 182, 193, 0.8)); }
}

.game-subtitle {
  font-family: 'Crimson Pro', serif;
  font-size: 1.3rem;
  color: var(--cherry);
  font-weight: 400;
  letter-spacing: 0.4em;
  margin-top: 0.25rem;
  text-transform: uppercase;
}

.edition-badge {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.35rem 1rem;
  background: linear-gradient(135deg, var(--gold) 0%, #ff8c00 100%);
  color: var(--blue-midnight);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border-radius: 20px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 2rem;
}

.menu-btn {
  padding: 0.9rem 2.5rem;
  font-size: 1.1rem;
  font-family: 'Zen Maru Gothic', sans-serif;
  border: 2px solid var(--pink-primary);
  background: rgba(255, 105, 180, 0.1);
  color: var(--cherry);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 220px;
  backdrop-filter: blur(10px);
}

.menu-btn:hover {
  background: var(--pink-primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(255, 105, 180, 0.5);
}

.menu-btn.start {
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  color: white;
  border: none;
}

.character-preview {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.preview-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.preview-avatar:hover {
  transform: scale(1.15) rotate(5deg);
}

.avatar-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: white;
}

.menu-warning {
  margin-top: 1.5rem;
  color: var(--gold);
  font-size: 0.85rem;
  font-style: italic;
}

/* Game Screen */
.game-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100vh;
}

.scene-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.6) saturate(1.1);
}

.scene-background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(10, 10, 26, 0.95) 100%);
}

.game-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 105, 180, 0.2);
}

.day-indicator {
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
}

.phase-indicator {
  color: var(--cherry);
  font-size: 0.8rem;
  text-transform: capitalize;
  opacity: 0.8;
}

.rel-btn, .save-btn, .debug-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 105, 180, 0.3);
  color: var(--pink-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.save-btn, .debug-btn {
  margin-left: 0.4rem;
}

.debug-btn {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--gold);
  color: var(--gold);
}

.rel-btn:hover, .save-btn:hover, .debug-btn:hover {
  background: var(--pink-primary);
  color: white;
  transform: scale(1.1);
}

/* Sprite Container */
.sprite-container {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.sprite-container.loading {
  opacity: 0.7;
}

.sprite-container.loaded {
  opacity: 1;
  animation: spriteEnter 0.6s ease-out;
}

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

.sprite-placeholder {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

/* Dialogue Container */
.dialogue-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(10, 10, 26, 0.92) 0%, rgba(26, 10, 46, 0.98) 100%);
  backdrop-filter: blur(25px);
  padding: 1.25rem 1.5rem;
  min-height: 160px;
  border-top: 2px solid var(--pink-primary);
  cursor: pointer;
}

.speaker-name {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 15px currentColor;
}

.phone-speaker {
  color: var(--cyan-accent) !important;
}

.dialogue-text {
  font-size: 1rem;
  line-height: 1.75;
  color: #eee;
  max-width: 850px;
}

.typing-cursor {
  animation: cursorBlink 0.6s infinite;
  color: var(--pink-primary);
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.advance-hint {
  position: absolute;
  bottom: 0.4rem;
  right: 1rem;
  color: var(--cherry);
  font-size: 0.8rem;
  animation: hintBounce 1.2s infinite;
  opacity: 0.7;
}

@keyframes hintBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* Choices */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.choice-button {
  padding: 0.9rem 1.25rem;
  background: rgba(255, 105, 180, 0.15);
  border: 2px solid rgba(255, 105, 180, 0.4);
  border-radius: 12px;
  color: white;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.choice-button:hover {
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  border-color: var(--pink-primary);
  transform: translateX(12px);
  box-shadow: 0 5px 25px rgba(255, 105, 180, 0.4);
}

/* Character Select */
.character-select {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  background: radial-gradient(ellipse at center, var(--purple-mid) 0%, var(--blue-midnight) 70%);
}

.select-bg {
  position: absolute;
  inset: 0;
  background: url('/api/nanobanana/image/1024/768?prompt=anime+evening+cityscape+romantic+sunset+beautiful+cherry+blossoms');
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) saturate(1.2);
}

.character-select h2 {
  position: relative;
  z-index: 10;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.75rem;
  color: var(--pink-primary);
  margin-bottom: 0.4rem;
}

.character-select > p {
  position: relative;
  z-index: 10;
  color: var(--cherry);
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.character-options {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 700px;
  width: 100%;
}

.character-option {
  background: rgba(10, 10, 26, 0.9);
  border: 2px solid;
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.character-option:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.option-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.option-info h4 {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.option-info p {
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 0.4rem;
}

.mini-hearts {
  font-size: 0.7rem;
}

/* Relationship Screen */
.relationship-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.97);
  padding: 1.5rem;
  overflow-y: auto;
  backdrop-filter: blur(20px);
}

.relationship-screen h2 {
  text-align: center;
  color: var(--pink-primary);
  font-family: 'Zen Maru Gothic', sans-serif;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.character-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.char-card {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.char-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: white;
  flex-shrink: 0;
}

.char-info h4 {
  color: white;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.char-info p {
  color: #777;
  font-size: 0.8rem;
}

.hearts {
  margin-top: 0.4rem;
}

.heart {
  font-size: 1rem;
  color: #333;
  transition: color 0.3s ease;
}

.heart.filled {
  color: var(--pink-primary);
}

.suspicion-meter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #777;
}

.meter {
  flex: 1;
  height: 5px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
}

.meter .fill {
  height: 100%;
  transition: width 0.4s ease;
}

.close-btn {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.7rem 2rem;
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  border: none;
  border-radius: 25px;
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.3s ease;
}

.close-btn:hover {
  transform: scale(1.05);
}

/* Propeller Game */
.propeller-game {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-midnight) 0%, var(--purple-deep) 100%);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.game-header-bar {
  text-align: center;
  margin-bottom: 1.25rem;
}

.propeller-game .game-title {
  color: var(--pink-primary);
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
}

.target-efficiency {
  color: var(--cherry);
  font-size: 0.85rem;
  opacity: 0.8;
}

.game-layout {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.propeller-canvas {
  border: 2px solid var(--pink-primary);
  border-radius: 16px;
  background: var(--blue-midnight);
  box-shadow: 0 0 30px rgba(255, 105, 180, 0.2);
}

.efficiency-display {
  text-align: center;
  width: 100%;
}

.efficiency-display span {
  color: var(--cherry);
  font-size: 0.85rem;
}

.efficiency-bar {
  height: 18px;
  background: #1a1a2a;
  border-radius: 10px;
  overflow: hidden;
  margin: 0.4rem 0;
  border: 1px solid rgba(255, 105, 180, 0.2);
}

.efficiency-fill {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 10px;
}

.efficiency-value {
  font-size: 1.1rem !important;
  font-weight: bold;
}

.controls-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 105, 180, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
  min-width: 260px;
  backdrop-filter: blur(10px);
}

.control-group {
  margin-bottom: 1.25rem;
}

.control-group label {
  display: block;
  color: var(--cherry);
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.control-group input[type="range"] {
  width: 100%;
  accent-color: var(--pink-primary);
  height: 6px;
}

.control-group select {
  width: 100%;
  padding: 0.65rem;
  background: var(--blue-midnight);
  border: 1px solid rgba(255, 105, 180, 0.3);
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
}

.submit-design {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  border: none;
  border-radius: 25px;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-design:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 5px 25px rgba(255, 105, 180, 0.4);
}

.submit-design:disabled {
  opacity: 0.85;
}

.design-tips {
  text-align: center;
  padding: 0.75rem;
  color: #777;
  font-size: 0.8rem;
}

/* Ending Screen */
.ending-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, var(--purple-mid) 0%, var(--blue-midnight) 70%);
  padding: 1.5rem;
}

.ending-content {
  text-align: center;
  max-width: 450px;
}

.ending-content h2 {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 2rem;
  color: var(--pink-primary);
  margin-bottom: 0.75rem;
}

.ending-content > p {
  color: var(--cherry);
  margin-bottom: 1rem;
}

.ending-character {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid;
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.ending-character h3 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.ending-summary {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 1rem;
  margin: 1rem 0;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.summary-item:last-child {
  border-bottom: none;
}

.restart-btn {
  margin-top: 1.5rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, var(--pink-primary), var(--pink-dark));
  border: none;
  border-radius: 25px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 25px rgba(255, 105, 180, 0.4);
}

/* Debug Info */
.debug-info {
  position: fixed;
  top: 50px;
  left: 10px;
  background: rgba(255, 215, 0, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.7rem;
  color: var(--gold);
  z-index: 100;
  font-family: monospace;
}

/* Footer */
.game-footer {
  position: fixed;
  bottom: 165px;
  right: 0.75rem;
  z-index: 30;
}

.game-footer a {
  color: rgba(255, 182, 193, 0.4);
  text-decoration: none;
  font-size: 0.7rem;
  transition: color 0.3s ease;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .game-title-main {
    font-size: 2rem;
  }
  
  .game-subtitle {
    font-size: 1rem;
    letter-spacing: 0.2em;
  }
  
  .menu-btn {
    min-width: 180px;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
  }
  
  .dialogue-container {
    min-height: 180px;
    padding: 1rem;
  }
  
  .sprite-container {
    bottom: 190px !important;
  }
  
  .sprite-container canvas {
    height: 50vh !important;
    max-height: 400px !important;
  }
  
  .game-layout {
    flex-direction: column;
    align-items: center;
  }
  
  .propeller-canvas {
    width: 240px !important;
    height: 240px !important;
  }
  
  .controls-panel {
    width: 100%;
    max-width: 320px;
  }
  
  .character-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .game-footer {
    bottom: 185px;
    right: 0.5rem;
  }
  
  .choice-button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .game-title-main {
    font-size: 1.6rem;
  }
  
  .character-options {
    grid-template-columns: 1fr;
    max-width: 280px;
  }
  
  .sprite-container canvas {
    height: 40vh !important;
    max-height: 300px !important;
  }
  
  .sprite-container.left {
    display: none;
  }
}