:root {
  --pink-bg: #f8d6de;
  --pink-soft: #ffe9ef;
  --pink-strong: #ee9fb0;
  --mint: #bfe5da;
  --mint-strong: #79b9a7;
  --cream: #fffaf7;
  --card: #ffffff;
  --ink: #6d5151;
  --ink-dark: #4d3b3b;
  --muted: #9b8787;
  --line: #f2e7e4;
  --warn: #d36b77;
  --shadow: 0 18px 42px rgba(139, 88, 98, 0.14);
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  background: linear-gradient(180deg, #e4f3eb 0, var(--pink-bg) 110px, #fff8f6 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  max-width: 100%;
  background: #fff8f6;
}

button,
input {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

body.locked {
  overflow: hidden;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #e3f2eb 0, #f8d6de 46%, #fff9f7 100%);
}

body.locked .lock-screen {
  display: grid;
}

body.locked .app-shell,
body.locked .drawer {
  display: none;
}

.lock-card {
  width: min(100%, 360px);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.lock-logo {
  width: 78px;
  height: 78px;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: #fffaf2 url("./icons/icon-192.png") center / cover no-repeat;
  box-shadow: 0 12px 26px rgba(128, 80, 64, 0.16);
}

.lock-card h1 {
  margin: 0;
  color: var(--ink-dark);
  font-size: 27px;
}

.lock-card p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.lock-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff8f6;
  color: var(--ink-dark);
  font-size: 18px;
  padding: 14px 15px;
  text-align: center;
  outline: none;
}

.lock-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 18px;
  background: var(--mint-strong);
  color: #fff;
  padding: 14px 16px;
  font-weight: 850;
}

.lock-error {
  display: none;
  margin-bottom: 0 !important;
  color: var(--warn) !important;
  font-weight: 750;
}

.lock-error.show {
  display: block;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(82px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #e3f2eb 0, #f8d6de 110px, #fff9f7 100%);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 14px;
  background: linear-gradient(180deg, rgba(227, 242, 235, 0.98), rgba(248, 214, 222, 0.9));
  backdrop-filter: blur(14px);
}

.topbar > div {
  min-width: 0;
}

.app-shell[data-page="home"] .topbar {
  display: none;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-dark);
  font-size: 23px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(93, 72, 72, 0.1);
}

.category-button {
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 0;
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 244, 246, 0.95));
  box-shadow: 0 14px 28px rgba(137, 85, 94, 0.16);
  display: grid;
  place-items: center;
}

.category-button::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(191, 229, 218, 0.9), rgba(238, 159, 176, 0.72));
  z-index: -1;
}

.category-logo {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 23px;
  height: 23px;
  border-radius: 8px;
  background: #fffaf2 url("./icons/icon-192.png") center / cover no-repeat;
  box-shadow: 0 4px 10px rgba(122, 72, 57, 0.16);
}

.category-lines {
  position: absolute;
  right: 9px;
  bottom: 12px;
  display: grid;
  gap: 5px;
}

.category-lines i {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: #7c5a5a;
}

.category-dot {
  position: absolute;
  right: 11px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--mint-strong);
  box-shadow: 0 0 0 5px rgba(121, 185, 167, 0.16);
}

.icon-button.muted {
  margin-left: auto;
  background: #f8f2f0;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 2px;
  color: #a98b8b;
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--ink-dark);
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.18;
  letter-spacing: 0;
}

.page {
  display: grid;
  gap: 16px;
  max-width: 100%;
  overflow-x: hidden;
}

.card {
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.card.compact {
  padding: 14px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head > div {
  min-width: 0;
}

.card-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--mint);
  font-size: 22px;
}

.card h2 {
  margin: 0;
  color: var(--ink-dark);
  font-size: 21px;
  line-height: 1.24;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.card-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.hero {
  background:
    radial-gradient(circle at top right, rgba(191, 229, 218, 0.9), transparent 34%),
    #fff;
}

.workbench-home {
  min-height: calc(100vh - 110px);
  border-radius: 26px;
  background: transparent;
  padding: 2px 0 20px;
  box-shadow: none;
}

.workbench-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 92% 14%, rgba(191, 229, 218, 0.95), transparent 34%),
    rgba(255, 255, 255, 0.96);
  padding: 18px;
  box-shadow: var(--shadow);
}

.workbench-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  background: #fffaf2 url("./icons/icon-192.png") center / cover no-repeat;
  box-shadow: 0 10px 22px rgba(128, 80, 64, 0.15);
}

.workbench-brand h2 {
  margin: 0;
  color: var(--ink-dark);
  font-size: 25px;
  line-height: 1.15;
}

.workbench-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.directory-group {
  margin-top: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  padding: 15px;
  box-shadow: 0 12px 28px rgba(139, 88, 98, 0.1);
  max-width: 100%;
  overflow: hidden;
}

.directory-group h3 {
  margin: 0 0 12px;
  color: var(--ink-dark);
  font-size: 16px;
}

.workbench-list {
  display: grid;
  grid-template-columns: repeat(2, calc((100% - 11px) / 2));
  gap: 11px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.workbench-link {
  width: 100%;
  min-width: 0;
  min-height: 118px;
  display: grid;
  justify-items: center;
  align-content: center;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 20px;
  background: #fff8f6;
  color: var(--ink-dark);
  padding: 12px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.22;
  overflow: hidden;
  word-break: break-all;
  box-shadow: inset 0 0 0 1px var(--line);
}

.workbench-link span:last-child {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.workbench-link.active {
  background: var(--mint);
}

.workbench-link-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 16px rgba(128, 80, 64, 0.1);
  overflow: hidden;
}

.workbench-link.active .workbench-link-icon {
  background: rgba(255, 255, 255, 0.72);
}

.workbench-link-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.workbench-actions {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.workbench-actions p {
  margin: 0 0 3px;
  color: #b28d8c;
  font-size: 13px;
  font-weight: 850;
}

.workbench-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 17px;
  background: #fff8f6;
  color: var(--ink);
  padding: 13px 15px;
  text-align: left;
  font-weight: 850;
}

.week-big {
  margin: 0;
  color: var(--ink-dark);
  font-size: 48px;
  font-weight: 900;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 15px 0;
}

.stat {
  min-height: 70px;
  border-radius: 18px;
  background: #fbf4f1;
  padding: 12px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-dark);
  font-size: 18px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1ebe8;
}

.progress > span {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: inherit;
  background: #9b6b65;
}

.stage-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.pill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-width: 100%;
  overflow: visible;
}

.pill {
  border: 0;
  border-radius: 999px;
  padding: 10px 13px;
  background: #f6efec;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.1;
  max-width: 100%;
  white-space: normal;
  word-break: break-all;
  text-align: center;
  min-width: 0;
}

.pill.active {
  background: var(--mint-strong);
  color: #fff;
}

.pill.warn {
  background: #ffe0e6;
  color: #9e4c57;
}

.pill.warn.active {
  background: var(--warn);
  color: #fff;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border-radius: 18px;
  background: #fff9f6;
  padding: 13px;
  border: 1px solid var(--line);
}

.item-title {
  color: var(--ink-dark);
  font-weight: 850;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.item p,
.item li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.item p:last-child {
  margin-bottom: 0;
}

.detail {
  border: 0;
  border-radius: 20px;
  background: #fff9f6;
  overflow: hidden;
}

.detail + .detail {
  margin-top: 10px;
}

.detail summary {
  cursor: pointer;
  list-style: none;
  padding: 15px;
  color: var(--ink-dark);
  font-weight: 850;
}

.detail summary::-webkit-details-marker {
  display: none;
}

.detail-body {
  padding: 0 15px 15px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.detail-body h4 {
  margin: 12px 0 4px;
  color: var(--ink-dark);
  font-size: 14px;
}

.detail-body ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.soft-button {
  border: 0;
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink-dark);
  padding: 10px 15px;
  font-weight: 850;
}

.soft-button.pink {
  background: #ffdce5;
}

.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink-dark);
  font-size: 16px;
  padding: 13px 14px;
  outline: none;
}

.counter {
  display: grid;
  place-items: center;
  min-height: 160px;
  border-radius: 22px;
  background: linear-gradient(135deg, #f9dce5, #dff1e8);
}

.counter strong {
  display: block;
  color: var(--ink-dark);
  font-size: 64px;
  line-height: 1;
}

.counter span {
  color: var(--ink);
  font-weight: 750;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(100%, 430px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  background: rgba(255, 250, 247, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tab {
  border: 0;
  border-radius: 18px;
  background: #fff8f6;
  color: var(--ink);
  padding: 13px 8px;
  font-size: 15px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px var(--line);
}

.tab.active {
  background: var(--mint);
  color: var(--ink-dark);
}

.install-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border-radius: 22px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(139, 88, 98, 0.1);
}

.install-card strong {
  display: block;
  color: var(--ink-dark);
  font-size: 16px;
}

.install-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.install-card .soft-button {
  flex: 0 0 auto;
}

.install-toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 90;
  width: min(calc(100% - 28px), 400px);
  transform: translateX(-50%);
  border-radius: 22px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(75, 48, 54, 0.24);
}

.install-toast strong {
  color: var(--ink-dark);
  font-size: 17px;
}

.install-toast p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(70, 45, 48, 0.34);
  overscroll-behavior: contain;
}

.drawer.open {
  display: block;
}

.drawer-panel {
  width: min(82vw, 360px);
  height: 100%;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top)) 18px 18px;
  background: #fff;
  box-shadow: 24px 0 60px rgba(75, 48, 54, 0.22);
}

@supports (min-height: 100dvh) {
  .app-shell {
    min-height: 100dvh;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.app-icon-small {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: #fffaf2 url("./icons/icon-192.png") center / cover no-repeat;
  box-shadow: 0 8px 18px rgba(128, 80, 64, 0.14);
  overflow: hidden;
}

.drawer-head h2 {
  margin: 0;
  color: var(--ink-dark);
  font-size: 20px;
}

.drawer-head p,
.drawer-foot p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.drawer-label {
  margin: 0 0 10px;
  color: #b28d8c;
  font-size: 13px;
  font-weight: 850;
}

.drawer-menu {
  display: grid;
  gap: 10px;
}

.drawer-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  background: #fff8f6;
  color: var(--ink-dark);
  padding: 14px;
  text-align: left;
  font-weight: 850;
  line-height: 1.35;
  word-break: break-all;
}

.drawer-link.active {
  background: var(--mint);
}

.drawer-link span {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef9f5;
}

.drawer-link.active span {
  background: rgba(255, 255, 255, 0.72);
}

.drawer-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.source-note {
  margin: 12px 0 0;
  color: #aa9292;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 24px;
  }

  .week-big {
    font-size: 40px;
  }

  .stats,
  .two-col {
    grid-template-columns: 1fr;
  }

  .pill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: min(100%, 430px);
    max-width: 430px;
    margin: 0;
  }

  .bottom-tabs {
    left: 0;
    width: min(100%, 430px);
    max-width: 430px;
    transform: none;
  }

  .pill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
