:root {
  --primary: #FF8BA7;
  --primary-light: #FFC6C7;
  --secondary: #C3AED6;
  --bg-color: #FCE4EC;
  --surface: #FFFFFF;
  --text-dark: #333333;
  --text-light: #666666;
  --success: #81C784;
  --danger: #E57373;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-dark);
}

.container, .game-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--surface);
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  position: relative;
  overflow-x: hidden;
}

/* === INDEX.HTML === */

.logo-section {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--primary-light), var(--surface));
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
}

.logo-icon {
  font-size: 64px;
  margin-bottom: 10px;
}

.logo-title {
  color: var(--primary);
  font-size: 32px;
  font-weight: bold;
}

.logo-subtitle {
  color: var(--text-light);
  font-size: 16px;
}

.screen {
  display: none;
  padding: 30px 20px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 139, 167, 0.4);
}

.btn-secondary {
  background-color: var(--secondary);
  color: white;
}

.btn-small {
  width: auto;
  padding: 10px 15px;
  font-size: 16px;
}

.divider {
  display: flex;
  align-items: center;
  margin: 30px 0;
  color: #ccc;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #eee;
}
.divider span { padding: 0 15px; }

.join-section {
  display: flex;
  gap: 10px;
}

.input {
  width: 100%;
  padding: 15px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
}
.input:focus { border-color: var(--primary); }

.join-section .input { flex: 1; }
.join-section .btn { width: auto; padding: 0 20px; }

.form-group { margin-bottom: 25px; }
.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
  color: var(--text-dark);
}

.role-select {
  display: flex;
  gap: 15px;
}

.role-btn {
  flex: 1;
  background: #f8f9fa;
  border: 2px solid #eee;
  border-radius: 16px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.role-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.role-btn.disabled {
  opacity: 0.5;
  background: #eee;
  cursor: not-allowed;
  filter: grayscale(1);
}

.role-emoji { font-size: 40px; }
.role-label { font-size: 16px; font-weight: bold; color: var(--text-dark); }

.info-text { color: var(--text-light); margin-bottom: 20px; font-size: 14px; }
.error-text { color: var(--danger); margin-top: 15px; text-align: center; }

.waiting-icon { font-size: 60px; text-align: center; margin-bottom: 20px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.link-box { display: flex; gap: 10px; margin: 20px 0; }
.link-box .input { text-align: center; font-family: monospace; background: #f8f9fa; color: var(--primary); font-weight: bold; }
.hint-text { text-align: center; font-size: 14px; color: var(--text-light); }

/* === GAME.HTML === */

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

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-emoji { font-size: 32px; }
.stage-name { font-weight: bold; font-size: 16px; }
.stage-desc { font-size: 12px; color: var(--text-light); }

.header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-light);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: bold;
  color: var(--text-dark);
}

.partner-status {
  background: #e3f2fd;
  color: #1976d2;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
}
.partner-status.hidden { display: none; }

.game-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
}

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

.tab-title { margin-bottom: 20px; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 10px; }

/* Home Tab */
.baby-visual {
  text-align: center;
  margin: 20px 0 40px 0;
}
.baby-icon {
  font-size: 100px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}
.baby-name {
  margin-top: 10px;
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; white-space: nowrap; }
.stat-value { font-size: 12px; text-align: right; margin-top: 5px; font-weight: bold; }

.progress-bar {
  width: 100%;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar.large { height: 12px; }

.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.health { background: var(--success); }
.progress-fill.happiness { background: #FFD54F; }
.progress-fill.mood { background: #B39DDB; }
.progress-fill.bond { background: var(--primary); }
.progress-fill.stage { background: linear-gradient(90deg, var(--secondary), var(--primary)); }

.partner-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}
.partner-emoji { font-size: 30px; }
.partner-info { flex: 1; }
.partner-name { display: block; font-weight: bold; margin-bottom: 5px; }
.partner-mood-val { font-size: 14px; color: var(--text-light); }

.stage-progress { margin-bottom: 20px; }
.stage-progress-label { display: flex; justify-content: space-between; font-size: 14px; font-weight: bold; margin-bottom: 8px; }

/* Tasks Tab */
.task-item {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border-left: 5px solid #ccc;
  position: relative;
  overflow: hidden;
}

.task-item.role-mama { border-color: #FF8BA7; }
.task-item.role-papa { border-color: #4FC3F7; }
.task-item.role-shared { border-color: #C3AED6; }
.task-item.role-event { border-color: #FFB74D; animation: vibrate 2s infinite; }

@keyframes vibrate {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.task-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.task-title { font-weight: bold; font-size: 16px; color: var(--text-dark); }
.task-reward { background: var(--primary-light); color: var(--text-dark); padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; }
.task-desc { color: var(--text-light); font-size: 14px; margin-bottom: 15px; line-height: 1.4; }
.task-footer { display: flex; justify-content: space-between; align-items: center; }

.task-timer { font-size: 12px; color: var(--danger); font-weight: bold; display: flex; align-items: center; gap: 5px; }
.task-timer::before { content: '⏱'; }

.task-shared-status { font-size: 12px; color: var(--success); font-weight: bold; padding: 5px; background: #e8f5e9; border-radius: 8px; }

/* Shop Tab */
.shop-balance { background: var(--surface); padding: 20px; border-radius: 16px; text-align: center; font-size: 18px; margin-bottom: 20px; }
.shop-balance strong { color: var(--primary); font-size: 24px; }

.shop-item {
  background: var(--surface);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.shop-item-emoji { font-size: 40px; }
.shop-item-info { flex: 1; }
.shop-item-name { font-weight: bold; margin-bottom: 5px; display: block; }
.shop-item-price { color: var(--primary); font-weight: bold; font-size: 14px; }
.btn-buy { background: var(--primary); color: white; padding: 8px 15px; border-radius: 20px; border: none; font-weight: bold; }
.btn-buy:disabled { background: #ccc; }

/* History Tab */
.milestone-item {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  position: relative;
}
.milestone-item::before {
  content: ''; position: absolute; left: 19px; top: 40px; bottom: -20px;
  width: 2px; background: #eee;
}
.milestone-item:last-child::before { display: none; }
.milestone-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; justify-content: center; align-items: center;
  font-size: 20px; z-index: 1;
}
.milestone-content { flex: 1; background: var(--surface); padding: 15px; border-radius: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.milestone-week { font-size: 12px; color: var(--primary); font-weight: bold; margin-bottom: 5px; }
.milestone-title { font-weight: bold; margin-bottom: 5px; }
.milestone-desc { font-size: 13px; color: var(--text-light); }

.task-history-item { padding: 10px 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; }
.task-history-item:last-child { border-bottom: none; }
.task-history-title { font-size: 14px; }
.task-history-by { font-size: 12px; color: var(--text-light); display: flex; align-items: center; gap: 5px; }

/* Bottom Nav */
.bottom-nav {
  display: flex;
  background: var(--surface);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
}

.nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-light);
  cursor: pointer;
  position: relative;
}

.nav-icon { font-size: 24px; transition: transform 0.2s; filter: grayscale(1); opacity: 0.7; }
.nav-label { font-size: 10px; font-weight: bold; transition: color 0.2s; }

.nav-btn.active .nav-icon { transform: translateY(-3px); filter: grayscale(0); opacity: 1; }
.nav-btn.active .nav-label { color: var(--primary); }

.nav-badge {
  position: absolute;
  top: -5px; right: 20%;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid var(--surface);
}
.nav-badge.hidden { display: none; }

/* Modals */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
}
.modal-content {
  background: var(--surface);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  position: relative;
  z-index: 101;
  width: 90%;
  max-width: 350px;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.milestone-emoji, .gender-emoji { font-size: 60px; margin-bottom: 20px; }
.modal-content h2 { margin-bottom: 10px; color: var(--primary); }
.modal-content p { color: var(--text-light); margin-bottom: 25px; line-height: 1.5; }
.empty-text { text-align: center; color: var(--text-light); padding: 40px 20px; font-style: italic; }
