:root {
  --bg-0: #7dc2ff;
  --bg-1: #cfeeff;
  --bg-2: #b6f27a;
  --ink: #132531;
  --ink-soft: #2d4350;
  --pixel-border: #22353f;
  --card: #fff7e7;
  --card-2: #f4ffe8;
  --line: #8ca0af;
  --satiety: #ff8f42;
  --energy: #59a7ff;
  --clean: #41c58e;
  --danger: #d75c46;
  --good: #49ba6b;
  --gold: #ffd45a;
  --radius: 14px;
  --shadow: 0 5px 0 rgba(20, 35, 47, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 26%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.04) 2px, transparent 2px, transparent 6px),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 56%, var(--bg-2) 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-weight: 500;
  line-height: 1.45;
}

.bg-shape {
  position: fixed;
  z-index: 0;
  border-radius: 4px;
  opacity: 0.28;
  pointer-events: none;
}

.bg-shape-a {
  width: 220px;
  height: 220px;
  top: -40px;
  right: -44px;
  background: linear-gradient(135deg, #9efb72, #6adf6b);
  transform: rotate(10deg);
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  bottom: -80px;
  left: -70px;
  background: linear-gradient(135deg, #5fb9ff, #8de4ff);
  transform: rotate(-12deg);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 12px 24px;
  display: grid;
  gap: 12px;
}

.card {
  border: 3px solid var(--pixel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card);
}

.hero-card {
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.12)),
    linear-gradient(135deg, #f5ffcb, #d8ffd2 44%, #dcf0ff);
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hero-tag {
  margin: 0;
  color: #2f6c27;
  font-size: 14px;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.settings-trigger,
.icon-btn,
.icon-page-btn {
  border: 2px solid var(--pixel-border);
  border-radius: 10px;
  background: #fff9cd;
  color: #2d4d58;
  min-height: 40px;
  min-width: 40px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(16, 30, 40, 0.45);
}

.settings-trigger:active,
.icon-btn:active,
.icon-page-btn:active,
.primary-btn:active,
.ghost-btn:active,
.quick-pill:active,
.option-btn:active,
.voice-hold-btn:active,
.mini-primary:active,
.mini-ghost:active {
  transform: translateY(2px);
  box-shadow: none;
}

h1 {
  margin: 8px 0 6px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.hero-line {
  margin: 0;
  font-size: 16px;
  color: #2d4d58;
}

.voice-panel {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.voice-hold-btn {
  width: 100%;
  border: 2px solid var(--pixel-border);
  border-radius: 12px;
  min-height: 48px;
  background: linear-gradient(180deg, #ffe674, #ffc74d);
  color: #3a2b00;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(29, 24, 3, 0.45);
}

.voice-hold-btn.recording {
  background: linear-gradient(180deg, #ff8f8f, #ff6464);
  color: #fff;
}

.voice-icon {
  font-size: 18px;
}

.voice-transcript {
  min-height: 36px;
  border: 2px dashed rgba(24, 52, 64, 0.5);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.62);
  color: #2d4d58;
  font-size: 15px;
  line-height: 1.5;
}

.voice-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.voice-action-row .mini-primary,
.voice-action-row .mini-ghost {
  min-height: 38px;
  width: 100%;
}

.import-note-btn {
  min-height: 36px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
}

.hidden {
  display: none !important;
}

.suggestions {
  padding: 10px;
  background: linear-gradient(180deg, #fffbe7, #fff4d3);
}

.suggestions-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.suggestion-item {
  border: 2px solid #c28040;
  border-radius: 12px;
  background: #ffe7c3;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
}

.main-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  background: linear-gradient(180deg, #deeffb, #cfe7f8);
  border: 2px solid var(--pixel-border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.main-tab-btn {
  border: 2px solid var(--pixel-border);
  border-radius: 999px;
  min-height: 40px;
  background: #eaf4fb;
  color: #365565;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(16, 30, 40, 0.22);
  transform: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.main-tab-btn.active {
  background: linear-gradient(180deg, #66c9ff, #3697e9);
  color: #fff;
  box-shadow: 0 2px 0 rgba(16, 30, 40, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tab-pane {
  display: grid;
  gap: 12px;
}

.tab-pane.hidden {
  display: none !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.gauge-card {
  padding: 10px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}

.gauge-main {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.6));
}

.gauge-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gauge-title h3 {
  margin: 0;
  font-size: 20px;
}

.emoji {
  font-size: 21px;
}

.gauge-wrap {
  position: relative;
  width: 128px;
  margin: 4px auto;
}

.gauge-svg {
  width: 128px;
  height: 128px;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: rgba(22, 39, 46, 0.16);
  stroke-width: 11;
}

.gauge-progress {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 301.59;
  stroke-dashoffset: 301.59;
  transition: stroke-dashoffset 0.48s ease;
}

.gauge-svg.satiety .gauge-progress {
  stroke: var(--satiety);
}

.gauge-svg.energy .gauge-progress {
  stroke: var(--energy);
}

.gauge-svg.cleanliness .gauge-progress {
  stroke: var(--clean);
}

.gauge-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 800;
}

.gauge-value span {
  font-size: 30px;
  line-height: 1;
}

.gauge-value .unit {
  font-size: 13px;
  margin-top: 8px;
}

.gauge-hint {
  margin: 2px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--ink-soft);
}

.quick-input {
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  padding: 8px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}

.quick-nav {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 6px;
  align-items: center;
}

.quick-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.quick-mode-text {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #2b4a56;
}

.quick-viewport {
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: #fcfffb;
  padding: 8px;
  min-height: 88px;
  overflow: hidden;
  touch-action: pan-y;
}

.quick-stack {
  display: grid;
  gap: 8px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-pill,
.option-btn,
.primary-btn,
.ghost-btn,
.mini-primary,
.mini-ghost {
  border: 2px solid var(--pixel-border);
  border-radius: 10px;
  background: #fff;
  color: #1c3943;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(14, 28, 36, 0.45);
}

.quick-pill {
  min-height: 44px;
  padding: 9px 12px;
  font-size: 15px;
  line-height: 1.35;
}

.quick-pill.active {
  background: linear-gradient(180deg, #85d7ff, #59a7ff);
  color: #fff;
}

.quick-pill.warn {
  background: #ffe8e4;
  border-color: #cc5a49;
  color: #9d382a;
}

.quick-badge {
  padding: 4px 6px;
  border: 2px solid #7f9aa7;
  border-radius: 9px;
  font-size: 12px;
  background: #f5fbff;
}

.quick-count {
  font-size: 15px;
  font-weight: 700;
  color: #204451;
}

.quick-tip {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #375d68;
}

.quick-time-panel {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #f6fff1;
  padding: 4px 8px 8px;
}

.quick-time-summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #2b4a56;
}

.quick-time-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.quick-time-single {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
}

.quick-time-item {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #33545f;
}

.quick-time-item input {
  width: 100%;
  min-height: 38px;
  border: 2px solid #98aebb;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 15px;
}

.tiny-time-btn,
.tiny-clear {
  border: 2px solid #7c98ab;
  border-radius: 8px;
  background: #f0f8ff;
  color: #2b4a56;
  min-height: 34px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.quick-cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-cta .mini-ghost,
.quick-cta .mini-primary {
  min-height: 40px;
  width: 100%;
  font-size: 15px;
}

.mini-primary,
.primary-btn {
  background: linear-gradient(180deg, #7fe672, #4fbf50);
  color: #fff;
}

.ghost-btn,
.mini-ghost {
  background: #eef9ff;
}

.quick-cta button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.daily-stats-card {
  padding: 10px;
  background: linear-gradient(180deg, #f7fff4, #ecfff8);
}

.daily-stats-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.daily-stat-item {
  border: 2px solid #92a9b6;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.daily-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.daily-stat-head h3 {
  margin: 0;
  font-size: 16px;
}

.daily-stat-date {
  font-size: 12px;
  color: #4d6a76;
  font-weight: 700;
}

.daily-stat-grid {
  display: grid;
  gap: 4px;
}

.daily-stat-grid p {
  margin: 0;
  font-size: 14px;
  color: #24434f;
}

.daily-metric.metric-low {
  background: #fff2e8;
  border: 1px solid #f2b286;
  color: #a44a18;
  border-radius: 8px;
  padding: 4px 6px;
}

.daily-metric.metric-high {
  background: #ffecec;
  border: 1px solid #ee9d9d;
  color: #a53030;
  border-radius: 8px;
  padding: 4px 6px;
}

.daily-stat-tip {
  margin: 2px 0 0;
  padding-top: 6px;
  border-top: 1px dashed #b3c4cd;
  font-size: 13px;
  color: #28515e;
}

.logs-card {
  padding: 8px 10px 10px;
}

.logs-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.log-day-divider {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef7ff;
  color: #355463;
  border: 1px solid #b5cad6;
  font-size: 13px;
  font-weight: 700;
}

.log-item {
  border: 2px solid #97acb8;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.log-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.log-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
}

.log-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.log-time {
  font-size: 12px;
  color: #4f6e7b;
}

.log-sub {
  margin: 6px 0 0;
  color: #264550;
  font-size: 14px;
  line-height: 1.45;
}

.log-actions {
  display: inline-flex;
  gap: 6px;
}

.log-actions button {
  border: 2px solid var(--pixel-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(12, 25, 32, 0.42);
}

.log-actions .icon-only {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.edit-btn {
  background: #e8f4ff;
  color: #204f6e;
}

.delete-btn {
  background: #ffe9e4;
  color: #9c3225;
}

.empty {
  margin: 10px 0 4px;
  text-align: center;
  color: #44616d;
  font-size: 14px;
}

.logs-more {
  width: 100%;
  margin-top: 8px;
  min-height: 38px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: rgba(11, 20, 30, 0.56);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 10px;
}

.modal-card {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border: 3px solid var(--pixel-border);
  border-radius: 14px;
  background: #fffdf1;
  box-shadow: 0 8px 0 rgba(19, 33, 43, 0.64);
  padding: 12px;
}

.note-import-card {
  max-width: 680px;
}

.note-import-section {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.note-import-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 2px solid #98aebb;
  border-radius: 10px;
  padding: 10px;
  font-size: 15px;
  line-height: 1.45;
}

.note-review-nav {
  margin-top: 2px;
}

.note-import-editor {
  border: 2px solid #97acb8;
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.note-import-grid {
  display: grid;
  gap: 12px;
}

.note-import-grid label {
  display: grid;
  gap: 6px;
  line-height: 1.45;
}

.note-import-grid input,
.note-import-grid select {
  width: 100%;
  min-height: 42px;
  border: 2px solid #98aebb;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 15px;
}

.note-import-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.note-import-source {
  display: grid;
  gap: 4px;
  border: 1px dashed #b5c8d3;
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fcff;
}

.source-line {
  margin: 0;
  line-height: 1.45;
}

.note-delete-btn {
  min-height: 38px;
  min-width: 72px;
}

.note-import-unused {
  border: 2px solid #97acb8;
  border-radius: 10px;
  background: #f9fcff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.note-import-unused-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-import-unused-textarea {
  min-height: 130px;
  background: #fff;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.modal-subtitle {
  margin: 8px 0 10px;
  color: #32515e;
  font-size: 13px;
}

.entry-form,
.settings-form {
  display: grid;
  gap: 10px;
}

.settings-tabs {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: linear-gradient(180deg, #deeffb, #cfe7f8);
  border: 2px solid var(--pixel-border);
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.settings-tab-btn {
  border: 2px solid var(--pixel-border);
  border-radius: 999px;
  min-height: 40px;
  background: #eaf4fb;
  color: #365565;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(16, 30, 40, 0.22);
  transform: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.settings-tab-btn.active {
  background: linear-gradient(180deg, #66c9ff, #3697e9);
  color: #fff;
  box-shadow: 0 2px 0 rgba(16, 30, 40, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.settings-pane {
  display: none;
  gap: 10px;
  padding-top: 4px;
}

.settings-pane.active {
  display: grid;
}

.settings-form label,
.time-field {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  color: #243f4a;
}

input,
select,
button {
  font-family: inherit;
}

.settings-form input,
.settings-form select,
.time-field input {
  width: 100%;
  min-height: 40px;
  border: 2px solid #8ca3b0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 15px;
  color: #15303b;
  background: #fff;
}

.field-tip,
.mini-tip,
.summary {
  color: #44616d;
  font-size: 12px;
}

.settings-tip {
  margin: 0;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  font-size: 15px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
}

.segmented button {
  border: 2px solid var(--pixel-border);
  border-radius: 9px;
  min-height: 40px;
  background: #f1f9ff;
  color: #244653;
  font-weight: 700;
}

.segmented button.active {
  background: linear-gradient(180deg, #83d8ff, #5aaaf6);
  color: #fff;
}

.option-list {
  display: grid;
  gap: 7px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
}

.option-btn.active {
  background: #e4fce2;
  border-color: #377d3a;
}

.option-label {
  margin: 0;
  font-size: 15px;
}

.option-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: #3e5f6b;
}

.diaper-group {
  border: 2px solid #8ca3b0;
  border-radius: 10px;
  background: #f6fffb;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.checkbox-item input {
  width: 20px;
  height: 20px;
}

.time-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sleep-toggle {
  border: 2px solid #8ca3b0;
  border-radius: 10px;
  background: #f0f8ff;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #bdd2dc;
  transition: 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s;
}

.switch input:checked + .switch-slider {
  background: linear-gradient(180deg, #8be57d, #58c05a);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.feedback-toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translate(-50%, -8px);
  z-index: 30;
  border: 3px solid #2d6f2e;
  border-radius: 10px;
  background: linear-gradient(180deg, #c8ffb2, #8de88f);
  color: #1e4d1f;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: 0.16s ease;
}

.feedback-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  .gauge-wrap,
  .gauge-svg {
    width: 116px;
    height: 116px;
  }

  .gauge-value span {
    font-size: 26px;
  }

  .quick-pill {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
  }
}
