:root {
  --ink: #1c1c1e;
  --secondary: #3a3a3c;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --soft: #f2f2f7;
  --card: #ffffff;
  --healthy: #1ca45c;
  --danger: #e24b4b;
  --blue: #007aff;
  --warm: #ff6b4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 30% 10%, rgba(120, 180, 255, 0.28), transparent 34%),
    linear-gradient(150deg, #162033, #080b11 72%);
  background-size: 22px 22px, 22px 22px, 100% 100%, 100% 100%;
}

button,
select,
input {
  font: inherit;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone-shell {
  position: relative;
  width: min(390px, calc(100vw - 28px));
  aspect-ratio: 0.49;
  padding: 13px;
  border-radius: 52px;
  background: linear-gradient(145deg, #2a2d33, #050608);
  box-shadow: 0 34px 88px rgba(0, 0, 0, 0.42);
}

.phone-shell::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 48px;
  pointer-events: none;
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 39px;
  background: var(--soft);
}

.phone-buttons {
  position: absolute;
  left: -4px;
  width: 4px;
  border-radius: 999px;
  background: #181b20;
}

.phone-volume-top { top: 122px; height: 42px; }
.phone-volume-bottom { top: 178px; height: 70px; }
.phone-power { left: auto; right: -4px; top: 152px; height: 86px; }

.status-bar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 43px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 24px 7px;
  background: rgba(242, 242, 247, 0.92);
  font-weight: 600;
  font-size: 15px;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 7px;
}

.signal {
  width: 20px;
  height: 14px;
  background: linear-gradient(to top, #000 35%, transparent 35% 100%);
  clip-path: polygon(0 100%, 18% 100%, 18% 65%, 36% 65%, 36% 45%, 54% 45%, 54% 25%, 72% 25%, 72% 8%, 100% 8%, 100% 100%);
}

.wifi {
  width: 18px;
  height: 13px;
  border: 4px solid #000;
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
}

.battery {
  position: relative;
  width: 26px;
  height: 13px;
  border: 2px solid #111;
  border-radius: 4px;
}

.battery::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 2px;
  background: #111;
}

.battery::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 3px;
  width: 3px;
  height: 5px;
  border-radius: 0 2px 2px 0;
  background: #111;
}

.app-view {
  position: absolute;
  inset: 43px 0 0;
  display: none;
  flex-direction: column;
  background: var(--soft);
}

.app-view.active {
  display: flex;
}

.top-nav {
  min-height: 52px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 242, 247, 0.86);
  backdrop-filter: blur(18px);
}

.top-nav h1 {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

.detail-nav {
  grid-template-columns: 48px 1fr 48px;
}

.nav-actions {
  display: flex;
  gap: 8px;
}

.nav-spacer {
  width: 48px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--blue);
}

.icon-button svg,
.setting-row svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ghost {
  opacity: 0;
  pointer-events: none;
}

.mood-chip {
  display: grid;
  justify-items: center;
  gap: 1px;
  font-size: 12px;
  color: var(--muted);
}

.mood-chip span {
  font-size: 26px;
}

.scroll-area {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.scroll-area::-webkit-scrollbar {
  display: none;
}

.diary-scroll {
  padding: 10px 12px 20px;
}

.module-stack {
  display: grid;
  gap: 10px;
}

.module-card {
  position: relative;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  padding: 13px 16px 14px;
  overflow: hidden;
}

.module-card h2 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
}

.todo-complete {
  background: #dff5e8;
}

.todo-complete::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 14px;
  width: 60px;
  height: 34px;
  border-left: 12px solid rgba(255, 255, 255, 0.82);
  border-bottom: 12px solid rgba(255, 255, 255, 0.82);
  border-radius: 4px;
  transform: rotate(-45deg);
  pointer-events: none;
}

.todo-complete .todo-list,
.todo-complete h2 {
  position: relative;
  z-index: 1;
}

.todo-list {
  display: grid;
  gap: 9px;
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: #252529;
  font-size: 15px;
  line-height: 1.35;
}

.box {
  width: 17px;
  height: 17px;
  border: 1.7px solid #555;
  border-radius: 4px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.todo-row.done .box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.todo-row.done .box {
  border-color: #999;
  background: #999;
}

.todo-row.done span:last-child {
  color: #aaa;
  text-decoration: line-through;
}

.doubao-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 11px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #d9ecff;
}

.bubble {
  width: 100%;
  max-width: none;
  border-radius: 5px 14px 14px;
  background: var(--soft);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.calorie-visual {
  margin: 3px 0 10px;
}

.calorie-visual strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.meter {
  height: 7px;
  border-radius: 99px;
  background: #eeeeef;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 24.4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ad89f, #78a7ff);
}

.food-list,
.meeting-list {
  display: grid;
  gap: 8px;
}

.food-row,
.meeting-row {
  display: grid;
  grid-template-columns: 38px 34px minmax(0, 1fr) 48px;
  column-gap: 8px;
  row-gap: 0;
  align-items: start;
  font-size: 13px;
  line-height: 1.35;
}

.food-row time {
  color: var(--muted);
}

.meal-type {
  color: var(--secondary);
  font-weight: 600;
}

.food-main {
  min-width: 0;
}

.health {
  display: inline;
  margin-right: 3px;
}

.health.bad {
  color: var(--danger);
  font-weight: 700;
}

.kcal {
  color: #555;
  white-space: nowrap;
}

.meeting-row {
  width: 100%;
  grid-template-columns: 1fr;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.meeting-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.meeting-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.meeting-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 3px;
  padding: 0 7px;
  border-radius: 99px;
  background: #eaf3ff;
  color: #007aff;
  font-size: 11px;
  font-weight: 500;
}

.tag-audio {
  background: #fff3df;
  color: #c77700;
}

.tag-note {
  background: #eaf3ff;
  color: #007aff;
}

.time-layout {
  display: grid;
  gap: 9px;
}

.time-chart-row {
  display: grid;
  grid-template-columns: 122px 1fr;
  align-items: center;
  gap: 12px;
}

.donut-wrap {
  position: relative;
  width: 122px;
  height: 122px;
  display: grid;
  place-items: center;
}

.donut {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: conic-gradient(#4f7cff 0 11.5%, #2dbf83 11.5% 23%, #ffb43c 23% 53.8%, #8b63e6 53.8% 76.9%, #ff6b4a 76.9% 100%);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: #fff;
}

.donut-label {
  position: absolute;
  text-align: center;
  font-size: 11px;
  color: #777;
}

.donut-label strong {
  display: block;
  color: #111;
  font-size: 20px;
  font-weight: 600;
}

.legend {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.2;
  justify-items: end;
  text-align: right;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--dot);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  justify-self: end;
}

.diary-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 0 12px;
}

.diary-date {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.diary-date strong {
  font-size: 44px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
}

.diary-date span {
  padding-bottom: 1px;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.25;
}

.diary-title {
  margin: 4px 0 8px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.28;
}

.diary-copy p {
  margin: 0;
  color: var(--secondary);
  font-size: 15px;
  line-height: 1.65;
}

.diary-copy h3 {
  margin: 12px 0 5px;
  font-size: 16px;
  font-weight: 600;
}

.detail-body {
  padding: 19px;
}

.detail-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.detail-meta {
  margin: 0 0 18px;
  color: var(--muted);
}

.detail-card h3 {
  margin: 18px 0 8px;
}

.detail-card ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.event-list,
.settings-list,
.module-settings {
  padding: 18px;
}

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

.event-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  padding: 13px;
  border-radius: 8px;
  background: var(--soft);
}

.event-list h3 {
  margin: 0;
  font-size: 15px;
}

.event-list span {
  padding: 2px 7px;
  border-radius: 99px;
  background: #fff;
  color: #4b66c0;
  font-size: 12px;
  font-weight: 800;
}

.event-list p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.calendar-panel {
  padding: 20px 18px;
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.week-row {
  margin-bottom: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.calendar-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-weight: 700;
}

.calendar-day.muted {
  color: #c7c7cc;
}

.calendar-day.active-day {
  background: #111;
  color: #fff;
}

.settings-list {
  display: grid;
  gap: 12px;
}

.setting-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row-button {
  text-align: left;
}

.switch {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #d8d8dd;
  position: relative;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.switch:checked {
  background: #30d158;
}

.switch:checked::after {
  transform: translateX(20px);
}

select {
  border: 0;
  background: #f3f3f5;
  border-radius: 8px;
  padding: 7px 9px;
}

.module-settings {
  display: grid;
  gap: 18px;
}

.module-zone h2 {
  margin: 0 0 9px;
  font-size: 14px;
  color: #666;
}

.module-bin {
  min-height: 58px;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 9px;
  border: 1px dashed #d8d8de;
  border-radius: 8px;
  background: #fbfbfc;
}

.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-weight: 800;
}

.module-item::after {
  content: "⋮⋮";
  color: #aaa;
  letter-spacing: -2px;
}

.hidden-bin .module-item {
  color: #aaa;
}

.module-item.locked {
  color: #111;
}

.module-item.locked::after {
  content: "固定";
  letter-spacing: 0;
  font-size: 12px;
  color: #aaa;
}

.module-item.dragging {
  opacity: 0.45;
}

.popover {
  position: absolute;
  z-index: 30;
  top: 92px;
  right: 19px;
  display: none;
  width: 128px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}

.popover.open {
  display: grid;
}

.popover button {
  height: 45px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 0 15px;
}

.popover button:last-child {
  border-bottom: 0;
}

#delete-button {
  color: #ff3b30;
}

.modal-layer {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: none;
  place-items: center;
  padding: 25px;
  background: rgba(0, 0, 0, 0.25);
}

.modal-layer.open {
  display: grid;
}

.modal-card {
  width: 100%;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions button {
  height: 42px;
  border: 0;
  border-radius: 9px;
  background: #f0f0f2;
  font-weight: 800;
}

.modal-actions button:last-child {
  background: #ff3b30;
  color: #fff;
}

@media (max-height: 760px) {
  .phone-shell {
    width: min(350px, calc(100vw - 24px));
  }

  .diary-copy p {
    font-size: 15px;
  }
}
