:root {
  color-scheme: light;
  --paper: #f8f2e8;
  --panel: #fffdf8;
  --ink: #1d1b18;
  --muted: #736d63;
  --line: #dfd2bd;
  --accent: #1f6f80;
  --accent-dark: #155866;
  --accent-soft: rgba(31, 111, 128, .1);
  --gold: #c69943;
  --green: #2f7f63;
  --red: #b05b50;
  --shadow: 0 14px 34px rgba(55, 45, 30, .1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 6%, rgba(255, 255, 255, .9), transparent 26%),
    linear-gradient(180deg, #fffaf1 0%, var(--paper) 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px 104px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.13;
}

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

h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 248, .8);
  color: var(--accent);
  font-size: 28px;
  line-height: 34px;
  box-shadow: var(--shadow);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 14px;
}

.summary-grid article,
.goal-card,
.week-cover-card,
.check-card,
.note-form,
.week-card,
.stat-card,
.stage-card,
.records-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, .82);
  box-shadow: var(--shadow);
}

.summary-grid article {
  min-height: 82px;
  padding: 11px 10px;
}

.summary-grid span,
.summary-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-grid strong {
  display: block;
  margin: 7px 0 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid b {
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 11px;
}

.section-head.compact {
  margin-top: 0;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.soft-button {
  min-width: 62px;
  height: 36px;
  border: 1px solid rgba(31, 111, 128, .18);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.goal-list {
  display: grid;
  gap: 10px;
}

.goal-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  min-height: 78px;
  padding: 13px 12px;
  gap: 10px;
}

.goal-icon,
.task-badge {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #cfe8e9;
  color: var(--accent-dark);
  font-weight: 900;
}

.goal-icon {
  width: 44px;
  height: 44px;
}

.goal-card h3 {
  margin: 0;
}

.goal-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.goal-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.check-button,
.delete-goal {
  border: 0;
  background: transparent;
}

.check-button {
  width: 46px;
  height: 46px;
  border: 4px solid #e7dfd4;
  border-radius: 50%;
  color: transparent;
  font-size: 24px;
  font-weight: 900;
}

.check-button.done {
  border-color: var(--accent);
  color: var(--accent);
}

.delete-goal {
  color: var(--muted);
  font-size: 13px;
}

.week-cover-card {
  display: grid;
  grid-template-columns: 1fr 96px;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  min-height: 128px;
  padding: 15px;
  overflow: hidden;
}

.week-cover-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.week-cover-card h2 {
  margin-top: 7px;
}

.week-cover-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.week-cover-card.unlocked {
  border-color: rgba(47, 127, 99, .36);
  background: linear-gradient(135deg, #fffdf8, #e6f1ec);
}

.cover-preview {
  position: relative;
  height: 92px;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(180deg, #d8e4e1, #86aab0);
}

.cover-preview span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: rgba(255, 255, 255, .48);
}

.cover-preview span:nth-child(1) {
  width: 44px;
  height: 44px;
  right: 12px;
  top: 10px;
}

.cover-preview span:nth-child(2) {
  width: 120px;
  height: 44px;
  left: -18px;
  bottom: -18px;
}

.cover-preview span:nth-child(3) {
  width: 90px;
  height: 32px;
  right: -22px;
  bottom: 8px;
}

.check-card {
  display: grid;
  justify-items: center;
  margin-top: 18px;
  padding: 24px 16px 18px;
  text-align: center;
}

.task-badge {
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  background: linear-gradient(145deg, #2d8290, #155866);
  color: #fff;
  font-size: 22px;
}

.check-card h2 {
  font-size: 25px;
}

.check-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.complete-ring {
  width: 128px;
  height: 128px;
  margin-top: 24px;
  border: 8px solid #e7dfd4;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 45px;
  font-weight: 900;
}

.complete-ring.done {
  border-left-color: var(--accent);
  border-right-color: var(--accent);
  background: rgba(31, 111, 128, .05);
}

.complete-state {
  min-height: 24px;
}

.note-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
}

.note-form label,
.modal label span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 13px;
  line-height: 1.6;
}

input {
  height: 46px;
  padding: 0 13px;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 128, .12);
}

.form-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #2b8294, var(--accent-dark));
  color: #fff;
  font-weight: 900;
}

.week-card,
.stat-card,
.stage-card,
.records-card,
.settings-card {
  margin-top: 12px;
  padding: 14px;
}

.week-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.week-card-head span {
  color: var(--muted);
  font-size: 13px;
}

.week-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-dot {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.day-dot b {
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
}

.day-dot.done b {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.stat-card.landscape {
  min-height: 120px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, .9), rgba(255, 253, 248, .65)),
    linear-gradient(145deg, transparent 0 60%, rgba(31, 111, 128, .15) 61% 100%);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin: 9px 0 6px;
  font-size: 34px;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stage-list,
.record-list {
  display: grid;
  gap: 8px;
}

.stage-row,
.record-row {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 253, 248, .72);
  padding: 11px;
}

.stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-row strong {
  display: block;
}

.stage-row small,
.stage-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.stage-row.done {
  border-color: rgba(47, 127, 99, .35);
  background: rgba(47, 127, 99, .08);
}

.record-row {
  border-left: 5px solid var(--accent);
}

.record-row span {
  color: var(--muted);
  font-size: 12px;
}

.record-row p {
  margin: 7px 0 0;
  line-height: 1.55;
}

.empty {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: 20px 12px;
  color: var(--muted);
  text-align: center;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.danger-button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 1px solid rgba(176, 91, 80, .35);
  border-radius: 9px;
  background: rgba(176, 91, 80, .08);
  color: var(--red);
  font-weight: 900;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 430px);
  height: calc(72px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  padding: 9px 12px env(safe-area-inset-bottom);
  border-top: 1px solid rgba(223, 210, 189, .86);
  background: rgba(255, 253, 248, .86);
  backdrop-filter: blur(14px);
}

.bottom-tabs button {
  border: 0;
  background: transparent;
  color: #787168;
  font-size: 11px;
  font-weight: 800;
}

.bottom-tabs span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin: 0 auto 3px;
  border-radius: 8px;
  font-size: 14px;
}

.bottom-tabs button.active {
  color: var(--accent);
}

.bottom-tabs button.active span {
  background: var(--accent-soft);
}

.modal {
  width: min(calc(100% - 28px), 390px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .24);
}

.modal::backdrop {
  background: rgba(29, 27, 24, .3);
  backdrop-filter: blur(3px);
}

.modal form {
  display: grid;
  gap: 14px;
  margin: 0;
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
}

@media (max-width: 360px) {
  .summary-grid strong {
    font-size: 19px;
  }

  h1 {
    font-size: 26px;
  }
}
