/* Zero External Dependencies - 100% Self-Contained Offline CSS */
:root {
  --bg-main: #fbf9f5;
  --bg-card: #ffffff;
  --bg-subtle: #f3eee6;
  --text-main: #2a2520;
  --text-muted: #6e655c;
  --gold-primary: #b8860b;
  --gold-dark: #8b6508;
  --gold-light: #fef8eb;
  --border-color: #e5ded2;
  --brand-child1: #c25e00;
  --brand-child2: #0b7285;
  --brand-child3: #5c7cfa;
  --brand-shared: #2b8a3e;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", Garamond, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #181614;
    --bg-card: #221f1c;
    --bg-subtle: #2d2924;
    --text-main: #f5f2ec;
    --text-muted: #aca499;
    --gold-primary: #d4af37;
    --gold-dark: #b8860b;
    --gold-light: #2c271b;
    --border-color: #3b352d;
    --brand-child1: #e8590c;
    --brand-child2: #15aabf;
    --brand-child3: #748ffc;
    --brand-shared: #40c057;
  }
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-system);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.heirloom-emblem {
  font-size: 2rem;
  color: var(--gold-primary);
}
.app-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}
.app-motto {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Main Layout */
.main-layout {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-main);
}

/* Sibling Equity Telemetry */
.equity-panel {
  border-top: 4px solid var(--gold-primary);
}
.equity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.score-badge {
  background: var(--gold-primary);
  color: #fff;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.85rem;
}
.equity-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.parity-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.child-stat-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}
.progress-bg {
  background: var(--bg-subtle);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.gentle-prompts-box {
  background: var(--gold-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.85rem;
}
.prompt-title {
  font-weight: 600;
  color: var(--gold-dark);
  margin-bottom: 0.4rem;
}
.prompts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.prompts-list li {
  position: relative;
  padding-left: 1rem;
  color: var(--text-main);
}
.prompts-list li::before {
  content: "•";
  color: var(--gold-primary);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Vault Matrix List */
.vault-pills-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.vault-pill-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-subtle);
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}
.vault-pill-item.shared-item {
  border-color: var(--brand-shared);
  background: rgba(43, 138, 62, 0.08);
}
.vault-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-child-1 { background: var(--brand-child1); }
.dot-child-2 { background: var(--brand-child2); }
.dot-child-3 { background: var(--brand-child3); }
.dot-shared { background: var(--brand-shared); }
.pill-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Capture Form */
.capture-card {
  border-top: 4px solid var(--brand-shared);
}
.capture-header {
  margin-bottom: 1.25rem;
}
.capture-header h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
}
.subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.form-group {
  margin-bottom: 1.1rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}
.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-control:focus {
  outline: 2px solid var(--gold-primary);
  border-color: transparent;
}

/* Vault Selector Grid */
.vault-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 0.85rem;
}
.radio-label.highlight-shared {
  grid-column: 1 / -1;
  border-color: var(--brand-shared);
  font-weight: 600;
  color: var(--brand-shared);
}

/* Trilingual Container */
.trilingual-container {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.trilingual-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
}
.tab-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--gold-dark);
  border-bottom: 2px solid var(--gold-primary);
}
.tab-content {
  padding: 0.75rem;
  background: var(--bg-card);
}
.tab-content.hidden {
  display: none;
}
.letter-textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.6;
}

/* Media Capture Box */
.media-capture-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-subtle);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
}
.audio-recorder-section, .file-upload-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.record-timer {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.file-label {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gold-dark);
  font-weight: 600;
}
.file-label input[type="file"] {
  display: none;
}
.file-selected {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s;
}
.btn:hover {
  opacity: 0.9;
}
.btn-gold {
  background: var(--gold-primary);
  color: #fff;
}
.btn-primary {
  background: var(--brand-shared);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.save-status-msg {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Recent Memories List */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.recent-item {
  padding: 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.recent-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.recent-item-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}
.recent-item-vault {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-backdrop.hidden {
  display: none;
}
.modal-card {
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 580px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

