:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #1d1d1f;
  --accent-2: #86868b;
  --dark: #1c1510;
  --dark-line: rgba(232, 210, 172, 0.28);
  --dark-text: #fff7e8;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.brand,
.nav-item,
.section-head,
.topbar,
.hero-actions,
.mini-actions,
.share-card-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark,
.share-card-head span:last-child {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 900;
}

.brand strong,
.brand span,
.sidebar-note span,
.eyebrow,
.metric-card span,
.focus-metrics span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.muted,
.eyebrow,
.sidebar-note span {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  gap: 10px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #f2f2f4;
  color: #1d1d1f;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  border-color: var(--line);
  background: #f2f2f4;
  color: var(--ink);
}

.sidebar-note {
  position: absolute;
  right: 22px;
  bottom: 22px;
  left: 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
}

.topbar-actions,
.hero-actions,
.mini-actions {
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.chip-btn,
.icon-btn,
.segmented button {
  min-height: 38px;
  border-radius: 7px;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-btn {
  padding: 0 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.ghost-btn,
.chip-btn,
.icon-btn {
  border: 1px solid transparent;
  background: #f2f2f4;
  color: #1d1d1f;
  font-weight: 750;
}

.ghost-btn {
  padding: 0 14px;
}

.chip-btn {
  padding: 0 11px;
  min-height: 32px;
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  padding: 0;
}

.quiet-action {
  display: none;
}

.more-actions {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.more-actions summary {
  width: max-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.more-actions button {
  width: 100%;
}

.primary-btn:hover {
  background-color: #000;
}

.ghost-btn:hover,
.chip-btn:hover,
.icon-btn:hover,
.segmented button:hover {
  background-color: #e9e9ed;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.today-grid,
.content-grid,
.metrics-grid,
.focus-layout,
.share-layout {
  display: grid;
  gap: 16px;
}

.today-grid {
  grid-template-columns: minmax(320px, 1.25fr) minmax(280px, 0.75fr);
  margin-bottom: 16px;
}

.content-grid {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel {
  padding: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.hero-panel {
  min-height: 294px;
}

.hero-count {
  display: flex;
  align-items: end;
  gap: 14px;
  margin: 28px 0 18px;
}

.hero-count strong {
  color: var(--ink);
  font-size: 68px;
  line-height: 0.92;
}

.hero-count span {
  color: var(--muted);
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: #eee5d5;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.hero-panel .muted,
.vow-panel .muted {
  margin-top: 12px;
}

.hero-actions {
  margin-top: 20px;
}

.vow-text {
  margin: 18px 0 12px;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.55;
}

.practice-list,
.record-list,
.group-list,
.badge-grid {
  display: grid;
  gap: 10px;
}

.practice-select {
  width: 100%;
  min-height: 42px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #f5f5f7;
  color: #111;
  font: inherit;
  font-weight: 800;
}

.practice-select option {
  background: #fff;
  color: #111;
}

.focus-select {
  margin: 16px 0;
  border-color: #e8d2ac;
  background: #fffaf0;
  color: #111;
}

.practice-detail {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfd;
}

.practice-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-content {
  display: none;
  padding: 12px;
  border-left: 2px solid var(--line);
  background: var(--surface);
  color: #3f372f;
  line-height: 1.8;
  white-space: pre-wrap;
}

.practice-content.show {
  display: block;
}

.practice-benefit {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.practice-benefit a {
  color: var(--accent);
}

.practice-dropdown {
  border-top: 1px solid #ebe1ce;
  padding-top: 10px;
}

.practice-dropdown summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.practice-dropdown .practice-list {
  margin-top: 10px;
}

.practice-item,
.record-item,
.group-item,
.badge-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfd;
}

.practice-item {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 12px;
  align-items: center;
}

.practice-item.compact {
  grid-template-columns: 1fr;
}

.practice-item button,
.group-item button {
  justify-self: end;
}

.practice-title-row,
.record-item,
.group-item-head,
.badge-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.practice-title-row strong {
  min-width: 0;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.metric-card {
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

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

.heat-day {
  display: grid;
  place-items: center;
  height: 38px;
  border: 1px solid #eee5d5;
  border-radius: 7px;
  background: #f7f0e2;
  color: var(--muted);
  font-size: 12px;
}

.heat-day.l1 {
  background: #eadcc4;
  color: #6c481f;
}

.heat-day.l2 {
  background: #d7bd8e;
  color: #4f3517;
}

.heat-day.l3 {
  background: #b9874f;
  color: #fffdf7;
}

.heat-day.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.badge-grid {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.badge-item.achieved {
  border-color: #d7bd8e;
  background: #fbf4e5;
}

.focus-layout.active {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 320px;
}

.focus-stage {
  min-height: calc(100vh - 120px);
  padding: 16px;
  border: 1px solid #3f3023;
  border-radius: var(--radius);
  background: #151311;
  color: var(--dark-text);
}

.focus-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
}

.focus-stage .eyebrow,
.focus-stage .muted,
.focus-side .muted {
  color: #cdb892;
}

.practice-chips,
.focus-controls,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-chips {
  margin: 16px 0;
}

.practice-chips button {
  min-height: 32px;
  border: 1px solid var(--dark-line);
  border-radius: 7px;
  background: rgba(255, 247, 232, 0.08);
  color: #ddcaa7;
  font-weight: 800;
}

.practice-chips button.active {
  border-color: #e8d2ac;
  background: #e8d2ac;
  color: #271c12;
}

.focus-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
}

.focus-metrics div {
  padding: 10px;
  text-align: center;
}

.focus-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.muyu-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 320px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(232, 210, 172, 0.32);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 38%, rgba(160, 103, 50, 0.42), rgba(54, 34, 18, 0.38) 40%, rgba(17, 12, 8, 0.98) 84%),
    #130f0c;
}

.muyu-stage img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 232px;
  object-fit: contain;
  filter: saturate(0.92) contrast(1.08);
  transition: transform 90ms ease, filter 90ms ease;
}

.muyu-stage.is-hit img {
  filter: saturate(0.92) contrast(1.08) brightness(0.92);
  transform: translateY(5px) scale(0.992);
}

.muyu-count {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  width: 132px;
  padding: 12px 0;
  transform: translateX(-50%);
  border: 1px solid rgba(232, 210, 172, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 250, 239, 0.94);
  color: #261d13;
  text-align: center;
}

.muyu-count strong,
.muyu-count small {
  display: block;
}

.muyu-count strong {
  font-size: 38px;
  line-height: 1;
}

.focus-chant {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: rgba(255, 247, 232, 0.06);
  text-align: center;
}

#focusChantText {
  color: #fff7e8;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.45;
  white-space: pre-wrap;
}

#focusChantPinyin {
  margin-top: 7px;
  color: #cdb892;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.tap-float {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 3;
  color: #fff7e8;
  font-size: 18px;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(20, 12, 6, 0.72);
  transform: translate(-50%, 0);
  animation: tapFloat 780ms ease forwards;
  pointer-events: none;
}

@keyframes tapFloat {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  18% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -48px);
  }
}

.round-panel,
.saved-panel {
  display: none;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: rgba(232, 210, 172, 0.12);
}

.round-panel.show,
.saved-panel.show {
  display: flex;
}

.focus-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
}

.focus-side {
  align-self: start;
}

.timer {
  margin: 10px 0;
  color: var(--ink);
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
}

.segmented {
  margin: 16px 0;
}

.focus-mode {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.focus-mode button {
  min-height: 34px;
  border: 1px solid var(--dark-line);
  border-radius: 7px;
  background: rgba(255, 247, 232, 0.08);
  color: #ddcaa7;
  font-weight: 800;
}

.focus-mode button.active {
  border-color: #e8d2ac;
  background: #e8d2ac;
  color: #271c12;
}

.focus-stage.pure .focus-select,
.focus-stage.pure .focus-mode,
.focus-stage.pure .focus-metrics,
.focus-stage.pure .round-panel {
  display: none;
}

.focus-layout.pure .focus-side {
  display: none;
}

.focus-layout.pure {
  grid-template-columns: minmax(360px, 760px);
  justify-content: center;
}

.focus-layout.pure .focus-stage {
  min-height: calc(100vh - 120px);
}

.segmented button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  border-color: var(--accent-2);
  background: #edf3e7;
  color: #4b6d41;
}

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

input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #f5f5f7;
  color: var(--ink);
}

.group-item {
  display: grid;
  gap: 10px;
}

.share-layout.active {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(280px, 1fr);
  align-items: start;
}

.share-card {
  min-height: 620px;
  padding: 28px;
  border: 1px solid #e3d4bb;
  border-radius: var(--radius);
  background: #fffdf7;
  text-align: center;
}

.share-card-head {
  justify-content: space-between;
  text-align: left;
}

.share-card-head span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.share-card-head strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.share-number {
  margin-top: 92px;
  color: var(--accent);
  font-size: 118px;
  font-weight: 900;
  line-height: 0.9;
}

.share-unit {
  margin-top: 12px;
  color: #5f594f;
  font-size: 28px;
}

.share-card p {
  max-width: 320px;
  margin: 70px auto 0;
  color: #5f594f;
  line-height: 1.8;
}

.share-card small {
  display: block;
  margin-top: 56px;
  color: var(--muted);
}

.share-actions {
  display: grid;
  gap: 12px;
}

.share-guide {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfd;
}

.share-guide strong {
  display: block;
  margin-bottom: 6px;
}

.share-guide p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.poster-tools {
  display: grid;
  gap: 10px;
}

.poster-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.background-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-right: 2px;
}

.background-choice {
  min-width: 0;
  min-height: 34px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--bg1);
}

.background-choice.active {
  border-color: var(--accent);
}

.poster-canvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfd;
}

.download-link {
  display: grid;
  place-items: center;
  min-height: 38px;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  min-width: 160px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  transform: translateX(-50%) translateY(20px);
  border-radius: 7px;
  background: rgba(28, 21, 16, 0.92);
  color: #fff7e8;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    top: auto;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    padding: 8px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand,
  .sidebar-note {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(5, 1fr);
  }

  .nav-item {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 6px 4px;
    text-align: center;
  }

  .nav-item span {
    width: 28px;
    height: 28px;
  }

  .nav-item strong {
    font-size: 12px;
  }

  .main {
    padding: 16px 16px 88px;
  }

  .topbar,
  .today-grid,
  .content-grid,
  .focus-layout.active,
  .share-layout.active {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .focus-controls {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .muyu-stage {
    height: 280px;
  }

  .muyu-stage img {
    height: 198px;
  }
}

@media (max-width: 520px) {
  .hero-count {
    display: block;
  }

  .hero-count strong {
    font-size: 56px;
  }

  .practice-item {
    grid-template-columns: 1fr;
  }

  .practice-item button {
    justify-self: stretch;
  }

  .badge-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
