:root {
  --bg-warm: #fff8f2;
  --bg-soft: #ffeade;
  --text-main: #4a3035;
  --text-sub: #8d6b72;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(255, 172, 156, 0.42);

  --accent: #ff7f91;
  --accent-2: #ff9a78;
  --good: #3ab67a;
  --bad: #df4c4c;
  --gradient-primary: linear-gradient(145deg, #ff9b8e, #ff7e9a);
  --gradient-soft: linear-gradient(145deg, #ffd7cf, #ffe9dc);

  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;

  --shadow-main: 0 16px 40px rgba(255, 138, 155, 0.2);
  --shadow-card: 0 8px 20px rgba(255, 177, 163, 0.2);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 18% 8%, #fff7f1 0%, #ffe8e5 42%, #ffd7d1 100%);
  color: var(--text-main);
  font-family: "M PLUS Rounded 1c", sans-serif;
}

button, input, select {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding-bottom: 95px;
}

.view {
  display: none;
  min-height: calc(100vh - 95px);
  padding: 12px 14px 22px;
}

.view[data-view="home"] {
  background:
    linear-gradient(165deg, rgba(255, 245, 240, 0.65) 0%, rgba(255, 235, 231, 0.55) 52%, rgba(255, 244, 238, 0.62) 100%),
    url("./bg-home.jpg") center/cover no-repeat;
}

.view[data-view="tasks"] {
  background:
    linear-gradient(165deg, rgba(255, 246, 243, 0.78) 0%, rgba(255, 236, 240, 0.7) 100%),
    url("./bg-tasks.jpg") center/cover no-repeat;
}

.view[data-view="shop"] {
  background:
    linear-gradient(165deg, rgba(255, 247, 242, 0.76) 0%, rgba(255, 239, 231, 0.72) 100%),
    url("./bg-shop.jpg") center/cover no-repeat;
}

.view[data-view="tasks"].is-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 95px);
  padding-bottom: 12px;
}

.view.is-active {
  display: block;
  animation: fade-up 0.25s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120px 120px at 82% 14%, rgba(255, 255, 255, 0.5), transparent 65%),
    radial-gradient(200px 160px at 0% 85%, rgba(255, 179, 193, 0.45), transparent 70%),
    linear-gradient(165deg, #ffd7cf 0%, #ffe8dd 48%, #fff6ee 100%);
  z-index: -2;
}

.top-strip {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.coin-points {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 172, 164, 0.62);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 6px 14px rgba(255, 158, 170, 0.22);
}

.coin-icon {
  font-size: 1.4rem;
}

.coin-points .label {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-sub);
}

.coin-points strong {
  font-size: 1.15rem;
  color: #d48f00;
}

.avatar-pair {
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(145deg, #ffece6, #ffd9ce);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.78), 0 0 20px rgba(255, 255, 255, 0.38);
}

.orb-right {
  margin-left: -12px;
}

.right-widgets {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.bell-btn {
  position: relative;
  border: none;
  background: rgba(255, 255, 255, 0.82);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.15rem;
  box-shadow: var(--shadow-card);
}

.bell-dot {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3737;
  box-shadow: 0 0 0 2px #fff;
}

.heart-core {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe4ba, #ffb37d 72%);
  box-shadow: 0 0 18px rgba(255, 197, 140, 0.75), inset 0 0 14px rgba(255, 233, 200, 0.8);
  overflow: hidden;
}

.heart-main {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f7334f;
  font-size: 1.35rem;
  z-index: 3;
  text-shadow: 0 0 8px rgba(255, 128, 128, 0.45);
}

.heart-rain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.heart-dot {
  position: absolute;
  top: -8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(242, 47, 66, 0.88);
  animation: heart-fall linear forwards;
}

@keyframes heart-fall {
  from { transform: translateY(0) scale(0.9); opacity: 0.15; }
  20% { opacity: 1; }
  to { transform: translateY(44px) scale(1); opacity: 0; }
}

.love-days {
  margin-top: 20vh;
  text-align: center;
  color: #fff;
  text-shadow: 0 4px 14px rgba(101, 56, 49, 0.38);
}

.love-days p {
  margin: 0;
  font-size: 1.4rem;
  font-family: "ZCOOL XiaoWei", serif;
}

.days-row {
  margin-top: 3px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 5px;
}

.days-row strong {
  font-size: 2.7rem;
  line-height: 1;
}

.days-row span {
  font-size: 1.35rem;
  line-height: 1;
}

.drag-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 78px;
  min-height: 28vh;
  background: rgba(255, 255, 255, 0.96);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  box-shadow: 0 -12px 28px rgba(255, 156, 116, 0.2);
  touch-action: none;
  user-select: none;
  transform: translateY(0px);
  transition: transform 0.22s ease;
}

.panel-handle {
  padding: 9px 0 12px;
  display: flex;
  justify-content: center;
}

.panel-handle span {
  width: 45px;
  height: 5px;
  border-radius: 999px;
  background: #ffd0bc;
}

.panel-entries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 0 14px;
}

.entry-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdfc 0%, #fff4f0 100%);
  border-radius: var(--radius-lg);
  padding: 11px 6px;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.entry-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.entry-icon.calendar { background: #ffdce7; }
.entry-icon.game { background: #ffe7dc; }
.entry-icon.shop { background: #ffe0d9; }

.entry-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #895b5f;
}

.panel-note {
  text-align: center;
  font-size: 0.8rem;
  color: #b07f83;
  padding: 12px 0 10px;
}

.sub-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 0;
}

.sub-header h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-family: "ZCOOL XiaoWei", serif;
}

.view[data-view="tasks"] .sub-header {
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 4px 0 2px;
  background: rgba(255, 247, 239, 0.95);
}

.view[data-view="tasks"] .sub-header h2 {
  text-align: center;
  margin: 0;
}

.sub-actions {
  display: flex;
  gap: 8px;
}

.chip-select,
.chip-btn {
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 127, 95, 0.45);
  background: #fff;
  color: #9c4e45;
  font-size: 0.8rem;
  padding: 0 12px;
}

.chip-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
}

.filter-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 3px;
}

.filter-row .chip-btn {
  background: var(--gradient-soft);
  color: #a25763;
  border: 1px solid rgba(255, 158, 150, 0.52);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  line-height: 1;
}

.filter-row .chip-btn.is-active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

.score-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 14px;
}

.score-btn {
  border: none;
  border-radius: 13px;
  padding: 10px;
  color: #fff;
  font-weight: 700;
}

.score-btn.plus { background: linear-gradient(145deg, #5cc68d, #3daa70); }
.score-btn.minus { background: linear-gradient(145deg, #ef6a66, #d6534f); }

.content-block {
  margin-bottom: 14px;
}

.split-area {
  min-height: 0;
  flex: 1;
  border: 1px solid rgba(255, 186, 170, 0.5);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 246, 243, 0.82));
  padding: 10px;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}

.split-top {
  margin-top: 2px;
}

.split-bottom {
  border-color: rgba(255, 168, 182, 0.5);
  background: linear-gradient(180deg, rgba(255, 251, 252, 0.84), rgba(255, 241, 244, 0.84));
}

.split-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.split-head h3 {
  margin: 0;
  font-size: 0.96rem;
  color: #8b676b;
}

.content-block h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: #8b676b;
}

.feed-list {
  display: grid;
  gap: 8px;
}

.item-card {
  background: var(--card);
  border: 1px solid rgba(255, 200, 188, 0.66);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.item-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px -18px rgba(202, 102, 118, 0.7);
}

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.item-desc,
.item-meta {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.item-actions {
  margin-top: 8px;
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.mini-btn,
.btn {
  border: 1px solid rgba(255, 150, 148, 0.62);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdfc, #fff3f1);
  color: #ae5f6e;
  font-size: 0.72rem;
  padding: 5px 10px;
}

.btn {
  border-radius: 10px;
  font-size: 0.85rem;
  padding: 9px 12px;
}

.primary-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
}

.danger-btn {
  border-color: #df7387;
  color: #d35671;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}

.badge-published, .badge-created, .badge-pending_review { background: #ffe8ed; color: #cb5d78; }
.badge-claimed, .badge-submitted, .badge-negotiating { background: #ffeede; color: #b8703c; }
.badge-approved, .badge-completed { background: #e9f8ef; color: #2f9c63; }
.badge-rejected, .badge-cancelled { background: #ffe6eb; color: #d6566f; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shop-card {
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 242, 0.95));
  border: 1px solid rgba(255, 190, 179, 0.72);
  padding: 11px;
  box-shadow: var(--shadow-card);
}

.shop-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.72);
}

.shop-name {
  margin: 9px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.shop-desc {
  margin: 5px 0 0;
  font-size: 0.74rem;
  color: var(--text-sub);
  min-height: 34px;
}

.shop-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}

.modal {
  border: none;
  border-radius: 16px;
  width: min(420px, 92vw);
  padding: 0;
}

.modal::backdrop {
  background: rgba(50, 32, 34, 0.38);
  backdrop-filter: blur(3px);
}

.modal-content {
  padding: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.close-modal {
  border: none;
  background: #ffe9df;
  border-radius: 50%;
  width: 30px;
  height: 30px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 193, 183, 0.7);
  background: #fffaf8;
  padding: 10px 11px;
}

.row-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.debug-panel {
  margin-top: 10px;
}

pre {
  font-size: 0.7rem;
  background: #fff7f1;
  border: 1px solid #f4d5c8;
  border-radius: 10px;
  padding: 8px;
  max-height: 150px;
  overflow: auto;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(255, 180, 156, 0.55);
  box-shadow: 0 -6px 18px rgba(255, 164, 127, 0.2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 12;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  border: none;
  background: transparent;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  color: #9f7570;
  font-size: 0.72rem;
}

.nav-item .icon {
  font-size: 1.23rem;
}

.nav-item .icon.pause {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--gradient-primary);
}

.nav-item.is-active {
  color: #ff6f5d;
  font-weight: 700;
}

.toast {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translate(-50%, -18px);
  opacity: 0;
  transition: all 0.25s ease;
  background: #3d2d2d;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.ok { background: #2f8c5e; }
.toast.err { background: #d15b73; }

body.login-gated .app-shell,
body.login-gated .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}

#settingsModal {
  width: min(360px, 90vw);
  background: transparent;
  box-shadow: none;
}

#settingsModal::backdrop {
  background: radial-gradient(circle at 20% 10%, #fff5e8 0%, #ffe9de 45%, #ffd9cc 100%);
  opacity: 1;
  backdrop-filter: none;
}

#settingsModal .modal-content {
  background: rgba(255, 249, 245, 0.95);
  border: 1px solid rgba(255, 190, 161, 0.74);
  border-radius: 16px;
  box-shadow: var(--shadow-main);
}

@media (min-width: 900px) {
  .app-shell {
    max-width: 460px;
    margin: 0 auto;
    border-left: 1px solid rgba(255, 173, 136, 0.4);
    border-right: 1px solid rgba(255, 173, 136, 0.4);
    box-shadow: 0 0 0 999vmax rgba(255, 239, 228, 0.55);
    clip-path: inset(0 -999vmax);
  }
}
