/* File: projects/voice-talker-web/css/style.css */
:root {
  --bg-page: #fdf8f5;
  --bg-card: #ffffff;
  --primary: #ff6b81;
  --primary-hover: #ff4757;
  --secondary: #57606f;
  --accent-blue: #1e90ff;
  --text-main: #2f3542;
  --text-muted: #747d8c;
  --border-color: #f1e4de;
  --shadow-soft: 0 8px 24px rgba(47, 53, 66, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', 'Meiryo', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header & Tabs */
.app-header {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  padding: 1.5rem 1rem 0;
  text-align: center;
  box-shadow: 0 4px 12px rgba(255, 107, 129, 0.15);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto 1.2rem;
}

.app-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #2f3542;
  margin-bottom: 0.25rem;
}

.app-subtitle {
  font-size: 0.95rem;
  color: #4b5563;
}

.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  max-width: 680px;
  margin: 0 auto;
}

.tab-btn {
  flex: 1;
  max-width: 280px;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 14px 14px 0 0;
  background-color: rgba(255, 255, 255, 0.55);
  color: #57606f;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.85);
}

.tab-btn.active {
  background-color: var(--bg-page);
  color: var(--primary-hover);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* Main Content */
.app-main {
  max-width: 1080px;
  margin: 1.75rem auto;
  padding: 0 1rem 3rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

/* Baby Studio 2-Column Responsive Grid */
.baby-studio-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 820px) {
  .baby-studio-layout {
    grid-template-columns: 1fr;
  }
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stage-header .section-title {
  margin-bottom: 0;
}

.state-pill {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  background-color: #fff0f6;
  color: #eb2f96;
}

.state-pill.speaking {
  background-color: #f6ffed;
  color: #389e0d;
}

.canvas-container {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid #ffd8be;
  background-color: #fff7e6;
}

#babyCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.photo-toolbar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Switch Toggle (Voice Mode) */
.control-section {
  margin-bottom: 1.25rem;
}

.control-label,
.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.voice-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fa;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #e9ecef;
}

.voice-mode-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.voice-mode-label.active {
  color: var(--primary-hover);
  font-weight: 800;
}

.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #4a69bd;
  transition: 0.3s;
}

.slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider::before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round::before {
  border-radius: 50%;
}

/* Expression Pills */
.expression-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.expression-pill {
  padding: 0.65rem 0.9rem;
  border: 2px solid #f1e4de;
  border-radius: var(--radius-pill);
  background: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
}

.expression-pill:hover {
  border-color: var(--primary);
  background: #fff5f7;
}

.expression-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(255, 107, 129, 0.3);
}

/* Text Input & Presets */
.text-input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 0.6rem;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip-btn {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ffd8be;
  background: #fff7e6;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn:hover {
  background: #ffe7ba;
}

/* Sliders & Action Buttons */
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.control-item input[type="range"] {
  width: 100%;
  margin-top: 0.4rem;
}

.action-buttons,
.baby-action-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-primary,
.btn-baby-primary {
  flex: 1;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #ff6b81 0%, #ff4757 100%);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.28);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled),
.btn-baby-primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-primary:disabled,
.btn-baby-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--secondary);
  cursor: pointer;
}

.btn-outline {
  padding: 0.55rem 1rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--primary-hover);
  font-weight: 700;
  cursor: pointer;
}

.btn-ghost {
  padding: 0.55rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-pill);
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  cursor: pointer;
}

.status-badge {
  margin-top: 1rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  background: #f1f2f6;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* 波形アニメーション */
@keyframes waveAnim {
  0%, 100% { height: 6px; }
  50% { height: 28px; }
}
.animate-wave1 { animation: waveAnim 0.8s ease-in-out infinite 0.1s; }
.animate-wave2 { animation: waveAnim 0.8s ease-in-out infinite 0.2s; }
.animate-wave3 { animation: waveAnim 0.8s ease-in-out infinite 0.3s; }
.animate-wave4 { animation: waveAnim 0.8s ease-in-out infinite 0.4s; }
.animate-wave5 { animation: waveAnim 0.8s ease-in-out infinite 0.25s; }
.animate-wave6 { animation: waveAnim 0.8s ease-in-out infinite 0.15s; }
.animate-wave7 { animation: waveAnim 0.8s ease-in-out infinite 0.35s; }
