/* R263 style.css · streak-ring-grid · v1.0 */
:root {
  --primary: #EA580C;
  --secondary: #FB923C;
  --accent: #F59E0B;
  --bg: #FFF7ED;
  --card: #FFFFFF;
  --text: #431407;
  --text-secondary: #9A3412;
  --border: #FED7AA;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --tile-bg: #FFEDD5;
  --ring-track: #FED7AA;
  --done-bg: #D1FAE5;
  --contact-footer-h: 92px;
  --segment-h: 48px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-chrome-h: calc(var(--contact-footer-h) + var(--safe-area-bottom));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
}
body.has-contact-footer { padding-bottom: calc(var(--contact-footer-h) + var(--segment-h) + 12px + var(--safe-area-bottom)); }

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-header { padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.app-header h1 { font-size: 17px; }
.app-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: center; }
.header-share { font-size: 16px; padding: 8px; color: var(--primary); }

.segment-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px 6px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 99; }
.segment-btn { border: none; background: var(--tile-bg); color: var(--text); padding: 8px 2px; border-radius: 8px; font-size: 10px; font-weight: 600; cursor: pointer; min-height: 40px; }
.segment-btn.active { background: var(--primary); color: #fff; }

#main { padding: 12px 16px 20px; min-height: 40vh; }

.btn { border: none; border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 600; min-height: 44px; cursor: pointer; display: inline-block; text-align: center; background: var(--tile-bg); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: 12px; }
.btn-chip { border: 1px solid var(--border); background: var(--card); padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; cursor: pointer; margin: 4px; }
.btn-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.child-switcher { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; }
.child-chip { border: 1px solid var(--border); background: var(--card); padding: 8px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.child-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.streak-box { text-align: center; margin-bottom: 16px; }
.streak-box canvas { display: block; margin: 0 auto; }
.tier-badge { font-size: 12px; color: var(--primary); font-weight: 700; margin-top: 6px; }
.star-balance { font-size: 14px; font-weight: 700; margin-top: 4px; }
.ring-fallback { padding: 16px; background: var(--card); border-radius: 50%; width: 120px; margin: 0 auto; border: 3px solid var(--primary); }
.ring-num { font-size: 32px; font-weight: 800; color: var(--primary); }

.habit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.habit-btn {
  position: relative;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  padding: 16px 10px;
  min-height: 120px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease, background 0.2s;
  animation: fadeUp 0.35s ease both;
}
.habit-btn:active { transform: scale(0.96); }
.habit-btn.done { background: var(--done-bg); border-color: var(--success); opacity: 0.85; }
.habit-icon { font-size: 42px; line-height: 1; }
.habit-name { font-size: 14px; font-weight: 700; }
.habit-streak { font-size: 11px; color: var(--text-secondary); }
.habit-check { position: absolute; top: 8px; right: 8px; font-size: 18px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.today-summary { text-align: center; margin-top: 12px; font-size: 13px; color: var(--text-secondary); }

.garden-header { text-align: center; margin-bottom: 12px; }
.garden-sub { font-size: 12px; color: var(--text-secondary); }
.garden-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.plant-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  transform: scale(var(--plant-scale, 1));
  animation: growIn 0.5s ease both;
}
.plant-card.wilted { filter: grayscale(1); opacity: 0.6; }
.plant-emoji { font-size: calc(36px * var(--plant-scale, 1)); display: block; margin-bottom: 6px; }
.plant-card small { font-size: 11px; color: var(--text-secondary); }
@keyframes growIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(var(--plant-scale, 1)); opacity: 1; } }

.stickers-header { margin-bottom: 12px; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sticker-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; text-align: center; font-size: 11px; }
.sticker-card.locked { opacity: 0.55; }
.sticker-emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.btn-redeem { margin-top: 4px; width: 100%; }

.parent-gate, .parent-view { max-width: 360px; margin: 0 auto; }
.pin-input { width: 100%; padding: 14px; font-size: 24px; letter-spacing: 8px; text-align: center; border: 2px solid var(--border); border-radius: 12px; margin: 12px 0; }
.pin-input.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.stats-panel { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 12px; }
.stat-item strong { display: block; font-size: 16px; margin-top: 4px; }

.heatmap-wrap { margin-bottom: 16px; }
.heatmap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.heat-cell { aspect-ratio: 1; border-radius: 4px; background: #F3F4F6; }
.heat-cell.lvl-1 { background: #FED7AA; }
.heat-cell.lvl-2 { background: #FB923C; }
.heat-cell.lvl-3 { background: #EA580C; }

.habit-manage-list { list-style: none; margin-bottom: 12px; }
.habit-manage-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.template-chips { margin-bottom: 12px; }

.about-view h2 { margin-bottom: 8px; }
.about-view h3 { margin: 16px 0 8px; font-size: 14px; }
.theme-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.version-tag { font-size: 11px; color: var(--text-secondary); margin-top: 16px; }
.link-catalog { display: block; margin-top: 8px; }

.editor-panel { background: #FEF3C7; border: 1px dashed var(--warning); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.editor-panel label { display: block; margin-bottom: 8px; font-size: 12px; }
.editor-panel input { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 950; }
.poster-modal { background: var(--card); border-radius: 12px; padding: 12px; max-width: 360px; width: 100%; }
.poster-modal img { max-width: 100%; border-radius: 8px; }

.empty-hint { text-align: center; padding: 20px; color: var(--text-secondary); font-size: 13px; }

.share-main { padding: 24px 16px; min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.share-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; text-align: center; width: 100%; }
.share-icon { font-size: 40px; margin-bottom: 8px; }
.share-slogan { color: var(--text-secondary); font-size: 13px; margin: 8px 0 16px; }
.share-qr { display: flex; justify-content: center; margin: 12px 0; }
.share-link { font-size: 11px; color: var(--text-secondary); margin-bottom: 12px; word-break: break-all; }

.toast-container { position: fixed; left: 50%; bottom: calc(var(--bottom-chrome-h) + var(--segment-h) + 16px); transform: translateX(-50%); z-index: 9999; pointer-events: none; }
.toast-item { background: rgba(0,0,0,0.78); color: #fff; padding: 10px 16px; border-radius: 10px; margin-top: 6px; opacity: 0; transition: opacity 0.3s; font-size: 13px; max-width: 90vw; }
.toast-item.show { opacity: 1; }

.contact-footer { position: fixed; left: 0; right: 0; bottom: 0; background: #1a1a1a; z-index: 850; padding: 0.55rem 0.75rem calc(0.55rem + var(--safe-area-bottom)); min-height: var(--contact-footer-h); }
.contact-footer__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 88px)); justify-content: center; gap: 0.4rem; max-width: 320px; margin: 0 auto; }
.contact-footer__cta, .contact-footer__btn { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.contact-footer__cta { background: #E87722 !important; color: #fff; }
.contact-footer__btn { background: #333; color: #fff; border: none; cursor: pointer; }
.contact-footer__brand { text-align: center; color: #888; font-size: 10px; margin-top: 6px; }

body.has-contact-footer .zw-root .zw-fab,
body.has-contact-footer .em-entry-btn {
  bottom: calc(var(--contact-footer-h) + var(--segment-h) + 12px + var(--safe-area-bottom)) !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
