/* emma LIFF - Shared Styles */
:root {
  --bg: #FFF8E7;
  --card: #FFFBF0;
  --text: #5C4033;
  --text-light: #8B7355;
  --accent: #D4A76A;
  --accent-dark: #B8860B;
  --border: #E8D8B8;
  --error: #C0392B;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

h1 {
  font-size: 1.4rem;
  text-align: center;
  margin: 16px 0;
}

h2 {
  font-size: 1.1rem;
  margin: 24px 0 8px;
  color: var(--accent-dark);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 16px 0 4px;
  font-weight: 600;
}

label:first-child { margin-top: 0; }

input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  color: var(--text);
  font-family: inherit;
}

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 167, 106, 0.2);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

/* Preset grid */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.preset-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-card:hover { border-color: var(--accent); }
.preset-card.selected {
  border-color: var(--accent);
  background: #FFF5E0;
}

.preset-emoji { font-size: 2rem; }
.preset-name { font-size: 0.9rem; font-weight: 600; margin-top: 4px; }
.preset-desc { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

/* Detail fields (expand/collapse) */
.detail-fields {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.detail-fields.open {
  max-height: 2000px;
}

.toggle-detail {
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px;
  margin: 8px 0;
  font-size: 0.85rem;
  color: var(--accent-dark);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
}

/* Photo upload */
.photo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  margin: 8px 0;
}

.photo-area img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.photo-area .placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* History scenes (checkboxes) */
.scene-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 8px 0;
}

.scene-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.scene-chip.selected {
  background: #FFF5E0;
  border-color: var(--accent);
}

/* Buttons */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 24px 0 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Status messages */
.status {
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  border-radius: 8px;
  margin: 8px 0;
}
.status.error { background: #FDE8E8; color: var(--error); }
.status.success { background: #E8F5E9; color: #2E7D32; }
