:root {
  --bg-0: #f5f0e8;
  --bg-1: #fffaf0;
  --bg-2: #efe2cc;
  --text-0: #2f261c;
  --text-1: #5f4f3d;
  --line: rgba(88, 64, 38, 0.2);
  --accent: #c3622c;
  --accent-strong: #a54b1d;
  --danger: #9f2a21;
  --warn: #8b5e12;
  --card-shadow: 0 16px 40px rgba(62, 44, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(circle at 10% 0%, #fff4dc 0%, transparent 45%),
    radial-gradient(circle at 100% 20%, #f7e7c8 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 50%, var(--bg-2));
  min-height: 100vh;
}

.app-shell {
  width: min(980px, 100% - 2rem);
  margin: 1.5rem auto 2.5rem;
  display: grid;
  gap: 1rem;
}

.hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  background: rgba(255, 251, 241, 0.9);
  box-shadow: var(--card-shadow);
}

.eyebrow {
  margin: 0;
  color: var(--text-1);
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.hero h1 {
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.hero-subtitle {
  margin: 0;
  color: var(--text-1);
}

.panel {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 241, 0.92);
  padding: 1rem;
  box-shadow: var(--card-shadow);
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 1.1rem;
}

.practice-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.tab-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-0);
  padding: 0.55rem 0.5rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.practice-summary {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.5);
}

.mini-card p {
  margin: 0;
}

.mini-title {
  color: var(--text-1);
  font-size: 0.82rem;
}

.mini-value {
  margin-top: 0.2rem;
  font-weight: 700;
}

.counter-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.8rem;
}

.label {
  margin: 0;
  color: var(--text-1);
}

.count-value {
  margin: 0.2rem 0 0;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
}

.goal-wrap {
  display: grid;
  gap: 0.3rem;
  justify-items: end;
}

.goal-wrap label {
  color: var(--text-1);
  font-size: 0.9rem;
}

input[type="number"],
input[type="time"],
input[type="text"],
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  padding: 0.4rem 0.52rem;
  font-size: 1rem;
  color: var(--text-0);
}

.goal-wrap input {
  width: 88px;
}

.progress-group {
  margin-top: 0.8rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-1);
  font-size: 0.9rem;
}

.progress-track {
  width: 100%;
  height: 14px;
  margin-top: 0.35rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(88, 64, 38, 0.22);
  background: rgba(255, 255, 255, 0.7);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #dd8a49);
  transition: width 0.2s ease;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 0.95rem;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 0.6rem 0.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-muted {
  background: #e2d5c0;
  color: var(--text-0);
}

.btn-warning {
  background: #d9be8e;
  color: var(--text-0);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.stats-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  background: rgba(255, 255, 255, 0.55);
}

.stat-label {
  margin: 0;
  color: var(--text-1);
  font-size: 0.87rem;
}

.stat-value {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.history-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.8fr;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.52);
}

.history-count,
.history-round {
  color: var(--text-1);
  text-align: right;
}

.settings-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.settings-grid label {
  display: grid;
  gap: 0.3rem;
  color: var(--text-1);
}

.switch-line {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.switch-line input {
  width: 16px;
  height: 16px;
}

.settings-actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.55rem;
}

.notify-status,
.dedication-preview {
  margin: 0.7rem 0 0;
  color: var(--text-1);
  line-height: 1.62;
}

.meaning-text {
  margin: 0.35rem 0;
  color: var(--text-1);
  line-height: 1.72;
}

.pwa-panel {
  background: rgba(252, 245, 233, 0.94);
}

.pwa-state {
  margin: 0.1rem 0 0.6rem;
  color: var(--text-1);
  line-height: 1.65;
}

.pwa-guide {
  margin: 0.65rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-1);
  line-height: 1.7;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(38, 27, 16, 0.46);
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff8ed;
  padding: 1rem;
  box-shadow: var(--card-shadow);
}

.modal-card h3 {
  margin: 0 0 0.5rem;
}

.modal-card p {
  margin: 0 0 0.75rem;
  color: var(--text-1);
  line-height: 1.72;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(980px, 100% - 1rem);
    margin-top: 0.7rem;
  }

  .practice-tabs,
  .practice-summary,
  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .history-count,
  .history-round {
    text-align: left;
  }

  .history-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-actions {
    flex-direction: column;
  }
}
