:root,
[data-theme="macaron"] {
  --bg0: #fff8f4;
  --bg1: #ffe9f0;
  --glow-a: #c8f0e4;
  --glow-b: #ffe1a8;
  --glow-c: rgba(232, 145, 176, 0.22);
  --ink: #3d2e35;
  --muted: #8a737c;
  --line: rgba(61, 46, 53, 0.12);
  --brand: #e891b0;
  --brand-2: #7ec8b2;
  --card: rgba(255, 252, 250, 0.94);
  --shadow: 0 18px 50px rgba(180, 120, 140, 0.12);
  --radius: 18px;
  --font-display: "ZCOOL XiaoWei", "Noto Sans SC", serif;
  --font-body: "Noto Sans SC", sans-serif;
  --theme-color: #e891b0;
}

[data-theme="rose"] {
  --bg0: #fff5f8;
  --bg1: #ffe8ef;
  --glow-a: #ffd6e4;
  --glow-b: #ffc9a8;
  --glow-c: rgba(212, 83, 126, 0.2);
  --ink: #3a2430;
  --muted: #8a6574;
  --line: rgba(58, 36, 48, 0.12);
  --brand: #d4537e;
  --brand-2: #e891b0;
  --card: rgba(255, 250, 252, 0.94);
  --shadow: 0 18px 50px rgba(180, 70, 110, 0.12);
  --theme-color: #d4537e;
}

[data-theme="mint"] {
  --bg0: #f3faf6;
  --bg1: #e5f6ee;
  --glow-a: #c9efe0;
  --glow-b: #dcecc8;
  --glow-c: rgba(46, 143, 117, 0.18);
  --ink: #1c2b26;
  --muted: #5f726a;
  --line: rgba(28, 43, 38, 0.12);
  --brand: #2f8f75;
  --brand-2: #e0a05a;
  --card: rgba(255, 252, 246, 0.92);
  --shadow: 0 18px 50px rgba(31, 55, 46, 0.12);
  --theme-color: #2f8f75;
}

[data-theme="lemon"] {
  --bg0: #fffced;
  --bg1: #fff3c9;
  --glow-a: #ffe9a8;
  --glow-b: #ffd4c2;
  --glow-c: rgba(230, 168, 60, 0.22);
  --ink: #3a3220;
  --muted: #8a7a55;
  --line: rgba(58, 50, 32, 0.12);
  --brand: #e6a83c;
  --brand-2: #f0b8a0;
  --card: rgba(255, 253, 246, 0.94);
  --shadow: 0 18px 50px rgba(180, 140, 60, 0.12);
  --theme-color: #e6a83c;
}

[data-theme="lavender"] {
  --bg0: #faf7ff;
  --bg1: #efe8ff;
  --glow-a: #e0d4ff;
  --glow-b: #f8d6ea;
  --glow-c: rgba(140, 120, 200, 0.2);
  --ink: #322840;
  --muted: #7a6e8a;
  --line: rgba(50, 40, 64, 0.12);
  --brand: #8c78c8;
  --brand-2: #e891b0;
  --card: rgba(252, 250, 255, 0.94);
  --shadow: 0 18px 50px rgba(120, 100, 180, 0.12);
  --theme-color: #8c78c8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow-a) 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-b) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

body {
  padding: 20px 16px 40px;
}

.bg-glow {
  position: fixed;
  inset: auto -20% -10% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-c), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.theme-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.theme-bar .label {
  font-size: 0.85rem;
  color: var(--muted);
}

.theme-dots {
  display: flex;
  gap: 8px;
}

.theme-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line), 0 4px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  padding: 0;
  background: var(--dot);
}

.theme-dot[data-theme-id="macaron"] { --dot: linear-gradient(135deg, #e891b0, #7ec8b2, #ffe1a8); }
.theme-dot[data-theme-id="rose"] { --dot: #d4537e; }
.theme-dot[data-theme-id="mint"] { --dot: #2f8f75; }
.theme-dot[data-theme-id="lemon"] { --dot: #e6a83c; }
.theme-dot[data-theme-id="lavender"] { --dot: #8c78c8; }

.theme-dot.active {
  box-shadow: 0 0 0 2px var(--brand), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.theme-bar.compact {
  justify-content: flex-end;
  margin: 0 0 10px;
}

.theme-bar.compact .label {
  display: none;
}

.view {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  padding: 28px 8px 18px;
}

.brand, .brand-sm {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  color: var(--brand);
  margin: 0;
}

.brand {
  font-size: 2.4rem;
  line-height: 1.1;
}

.brand-sm {
  font-size: 1.15rem;
}

.tagline {
  margin: 10px 0 6px;
  font-size: 1.15rem;
  font-weight: 500;
}

.sub, .hint, .who, .empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.hint {
  margin: 12px 0 0;
  line-height: 1.5;
}

.hint.tight {
  margin-top: 0;
  margin-bottom: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(8px);
}

.auth-panel label {
  display: block;
  margin-bottom: 14px;
}

.auth-panel label span,
.date-row label span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input:not([type]) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(31, 111, 91, 0.35);
  border-color: var(--brand);
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-row.center {
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary.lg {
  min-width: 160px;
  padding: 14px 28px;
  font-size: 1.05rem;
}

.btn.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid rgba(31, 111, 91, 0.35);
}

.btn.text {
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
}

.error {
  color: #b42318;
  background: #fdecea;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.who {
  margin: 2px 0 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(255, 252, 246, 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
}

.tab {
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 10px 8px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: #fff;
  color: var(--brand);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(31, 55, 46, 0.08);
}

.slot-machine {
  --slot-cell: 68px;
  width: min(92vw, 380px);
  margin: 8px auto 14px;
  padding: 14px 14px 12px;
  border-radius: 22px;
  background: var(--brand);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.slot-top {
  text-align: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.slot-window {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: #1a1520;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  overflow: hidden;
  height: calc(var(--slot-cell) * 3);
}

.slot-window.single {
  grid-template-columns: 1fr;
  width: min(72%, 220px);
  margin: 0 auto;
}

.slot-payline {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: var(--slot-cell);
  transform: translateY(-50%);
  border-radius: 10px;
  border: 2px solid var(--brand-2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 16px rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 3;
}

.slot-reel {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #fff8fb;
  z-index: 1;
}

.slot-strip {
  will-change: transform;
}

.slot-cell {
  height: var(--slot-cell);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  line-height: 1.2;
}

.slot-foot {
  margin-top: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
}

.slot-machine.spinning .slot-reel {
  filter: saturate(1.05);
}

.spin-result {
  text-align: center;
  min-height: 1.5em;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--brand);
  margin: 0 0 12px;
}

.week-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.week-meta {
  text-align: center;
}

.week-label {
  margin: 0;
  font-weight: 700;
  color: var(--brand);
}

.week-range {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.week-actions {
  margin: 0 0 10px;
}

.meal-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.meal-form input {
  flex: 1;
}

.meal-week {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.55);
}

.day-block.today {
  border-color: rgba(31, 111, 91, 0.35);
  background: rgba(31, 111, 91, 0.06);
}

.day-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.day-title .wd {
  font-weight: 700;
}

.day-title .dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.day-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.meal-list, .edit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.meal-list li, .edit-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.meal-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meal-list .meta {
  flex: 1;
}

.meal-list .food {
  font-weight: 500;
}

.meal-list .src {
  font-size: 0.8rem;
  color: var(--muted);
}

.edit-list input {
  flex: 1;
}

.edit-list .rm {
  color: #b42318;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 6px 8px;
}

.empty {
  text-align: center;
  margin: 18px 0 6px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  .brand {
    font-size: 2rem;
  }
  .btn-row.center {
    flex-direction: column;
    align-items: stretch;
  }
}
