:root {
  --bg: #fff7fb;
  --bg-2: #f7f2ff;
  --text: #4a3040;
  --muted: #9a7f90;
  --card: rgba(255, 255, 255, 0.88);
  --card-solid: #ffffff;
  --line: rgba(255, 127, 168, 0.2);
  --accent: #ff7fa8;
  --accent-2: #b6a6ff;
  --accent-text: #ffffff;
  --shadow: 0 18px 45px rgba(207, 123, 160, 0.16);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="theme-b"] {
  --bg: #10131a;
  --bg-2: #171b25;
  --text: #e8edf5;
  --muted: #95a0b3;
  --card: rgba(23, 27, 37, 0.9);
  --card-solid: #151924;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #7c8cff;
  --accent-2: #5bd0ff;
  --accent-text: #0f1117;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

html[data-theme="theme-0817"] {
  --bg: #f6efec;
  --bg-2: #f1e7e2;
  --text: #2a2630;
  --muted: #827781;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #fffdf8;
  --line: rgba(61, 47, 58, 0.11);
  --accent: #cb7e8d;
  --accent-2: #d8b8a4;
  --accent-text: #ffffff;
  --shadow: 0 18px 45px rgba(81, 58, 68, 0.12);
  --radius: 20px;
}

html[data-theme="pink-love"] {
  --bg: #fff2f7;
  --bg-2: #ffe2ed;
  --text: #62344b;
  --muted: #a37f92;
  --card: rgba(255, 255, 255, 0.9);
  --card-solid: #ffffff;
  --line: rgba(255, 127, 168, 0.22);
  --accent: #ff7fa8;
  --accent-2: #ffb3cc;
  --accent-text: #ffffff;
  --shadow: 0 18px 45px rgba(207, 123, 160, 0.18);
  --radius: 22px;
}

html[data-theme="moonlight"] {
  --bg: #f0f3ff;
  --bg-2: #e6f0ff;
  --text: #3b466e;
  --muted: #7e87a7;
  --card: rgba(255, 255, 255, 0.88);
  --card-solid: #ffffff;
  --line: rgba(112, 128, 190, 0.2);
  --accent: #7c8cff;
  --accent-2: #aab8ff;
  --accent-text: #ffffff;
  --shadow: 0 18px 45px rgba(76, 88, 145, 0.16);
  --radius: 22px;
}

html[data-theme="vintage"] {
  --bg: #fff8e8;
  --bg-2: #f3e8d5;
  --text: #6b4c33;
  --muted: #9a8168;
  --card: rgba(255, 252, 242, 0.92);
  --card-solid: #fffaf0;
  --line: rgba(185, 139, 79, 0.24);
  --accent: #c19a62;
  --accent-2: #d9bd8b;
  --accent-text: #ffffff;
  --shadow: 0 18px 40px rgba(117, 82, 42, 0.14);
  --radius: 14px;
}

html[data-theme="website"] {
  --bg: #10131a;
  --bg-2: #171b25;
  --text: #e8edf5;
  --muted: #95a0b3;
  --card: rgba(23, 27, 37, 0.92);
  --card-solid: #151924;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #7c8cff;
  --accent-2: #5bd0ff;
  --accent-text: #0f1117;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --radius: 22px;
}

html[data-theme="starry"] {
  --bg: #171630;
  --bg-2: #3a2d68;
  --text: #ece7ff;
  --muted: #b8aed8;
  --card: rgba(33, 27, 62, 0.92);
  --card-solid: #1f1a3f;
  --line: rgba(190, 170, 255, 0.2);
  --accent: #b6a6ff;
  --accent-2: #7ee0ff;
  --accent-text: #171630;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.3);
  --radius: 22px;
}

html[data-theme="spring"] {
  --bg: #f5ffe9;
  --bg-2: #fff9d9;
  --text: #405a42;
  --muted: #87977a;
  --card: rgba(255, 255, 255, 0.86);
  --card-solid: #ffffff;
  --line: rgba(147, 174, 93, 0.2);
  --accent: #86a85f;
  --accent-2: #e0b74a;
  --accent-text: #ffffff;
  --shadow: 0 18px 40px rgba(115, 140, 65, 0.14);
  --radius: 22px;
}

html[data-theme="0817"] {
  --bg: #f6efec;
  --bg-2: #f1e7e2;
  --text: #2a2630;
  --muted: #827781;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #fffdf8;
  --line: rgba(61, 47, 58, 0.11);
  --accent: #cb7e8d;
  --accent-2: #d8b8a4;
  --accent-text: #ffffff;
  --shadow: 0 18px 45px rgba(81, 58, 68, 0.12);
  --radius: 20px;
}

html[data-theme="0817"] body {
  background: #f6efec;
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
}

html[data-theme="0817"] body::before,
html[data-theme="0817"] body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(1px);
  opacity: 0.65;
  pointer-events: none;
  z-index: 0;
}

html[data-theme="0817"] body::before {
  width: 300px;
  height: 300px;
  background: rgba(223, 191, 203, 0.35);
  top: -120px;
  right: -140px;
}

html[data-theme="0817"] body::after {
  width: 220px;
  height: 220px;
  background: rgba(236, 214, 190, 0.42);
  bottom: 100px;
  left: -150px;
}

html[data-theme="0817"] .topbar {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-theme="0817"] .card {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 5px 5px 24px 5px;
  background: rgba(255, 255, 255, 0.46);
  box-shadow: 0 14px 38px rgba(81, 58, 68, 0.06);
}

html[data-theme="0817"] .page-title,
html[data-theme="0817"] .topbar__brand,
html[data-theme="0817"] .brand-text {
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 28%),
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 30%),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-2) 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.btn--ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn--small {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 13px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input,
.select {
  min-height: 48px;
  padding: 12px 14px;
}

.textarea {
  min-height: 128px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
}

.field {
  margin-bottom: 14px;
}

.field__label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.empty-state {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.empty-state__emoji {
  display: block;
  margin-bottom: 8px;
  font-size: 36px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 999;
  transform: translateX(-50%) translateY(20px);
  max-width: calc(100vw - 40px);
  padding: 11px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 92%, black);
  color: var(--bg);
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 32%),
    radial-gradient(circle at 80% 30%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 34%),
    var(--bg);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(10px);
}

.pin-card {
  width: min(360px, 100%);
  padding: 24px;
}

.pin-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

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

.pin-card .btn {
  width: 100%;
  margin-top: 10px;
}

.brand-text {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.theme-flash {
  position: fixed;
  inset: 0;
  z-index: 340;
  pointer-events: none;
  opacity: 0;
  background: #f6efec;
  transition: opacity 0.45s ease;
}

.theme-flash--white {
  background: #f6efec;
  opacity: 1;
}

.theme-flash--black {
  background: #0f1117;
  opacity: 1;
}

.about-dialog {
  position: fixed;
  inset: 0;
  z-index: 400;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 18px;
  border: 0;
  background: rgba(25, 18, 22, 0.42);
  overflow-y: auto;
}

.about-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-card {
  width: min(420px, 100%);
  padding: 26px;
  border-radius: var(--radius);
  background: var(--card-solid);
  color: var(--text);
  box-shadow: var(--shadow);
}

.about-card h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

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

.app-loader__inner {
  width: min(280px, 86vw);
  text-align: center;
}

.app-loader__heart {
  font-size: 42px;
  animation: loaderHeart 1.2s ease-in-out infinite;
}

.app-loader__text {
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.app-loader__bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.app-loader__bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: loaderBar 1.15s ease-in-out infinite;
}

@keyframes loaderHeart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes loaderBar {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(260%); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 60px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  background: color-mix(in srgb, var(--card-solid) 78%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
}

.sheet {
  width: 100%;
  max-width: 470px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(84px + var(--safe-bottom));
}

.page {
  padding: 16px;
}

.page-head {
  margin-bottom: 16px;
}

.page-title {
  margin: 0 0 5px;
  font-size: 21px;
  line-height: 1.3;
}

.page-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: color-mix(in srgb, var(--card-solid) 84%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.nav-item {
  flex: 1;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.nav-item.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.nav-item__icon {
  font-size: 19px;
}

.grid-list {
  display: grid;
  gap: 14px;
}

.egg-footer {
  position: relative;
  z-index: 1;
  margin: 20px 0 0;
  padding: 0 16px calc(96px + var(--safe-bottom));
  pointer-events: none;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  opacity: 0.55;
}

.egg-footer span {
  display: block;
  margin-bottom: 4px;
}

.counter-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.counter {
  padding: 12px 8px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
}

.counter__value {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}

.counter__label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.counter--small .counter__value {
  font-size: 13px;
}

.counter--small .counter__label {
  font-size: 9px;
}

.diary-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.diary-switch input {
  width: 42px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}

.diary-item {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.diary-item p {
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 14px;
}

.diary-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.status-emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.status-emoji {
  min-height: 64px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text);
}

.status-emoji--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.status-emoji__icon {
  font-size: 22px;
}

.status-emoji__label {
  font-size: 11px;
}

@media (max-width: 360px) {
  .page-title {
    font-size: 19px;
  }
}
