:root {
  --brand-red: #a31f1f;
  --page-bg-image: url("../../小图/微信图片_20260414214619_122_535.jpg");
  --card-bg: rgba(255, 255, 255, 0.52);
  --text-main: #3f2920;
  --text-sub: #8f7e72;
  --line: rgba(149, 114, 82, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #e8e2d5;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #2f2520;
}

.page {
  max-width: 375px;
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(rgba(244, 239, 228, 0.85), rgba(244, 239, 228, 0.85)),
    var(--page-bg-image) center top / cover no-repeat;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 80px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand-red);
  color: #fff;
}

.topbar-main {
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
}

.back-btn {
  font-size: 28px;
  color: #fff;
  text-decoration: none;
  line-height: 1;
}

.topbar h1.centered-title {
  margin: 0;
  justify-self: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: #fff;
}

.content {
  padding: 14px 12px;
}

.month-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 38px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #3d322d;
}

.month-text {
  font-size: 39px;
  line-height: 1;
}

.arrow-down {
  font-size: 22px;
  margin-top: 8px;
  color: #842425;
}

.calendar-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 12px 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(225, 212, 191, 0.75);
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #713132;
  margin-bottom: 8px;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px 0;
}

.day {
  height: 43px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #66292c;
  line-height: 1;
  position: relative;
  font-weight: 500;
}

.day.empty {
  visibility: hidden;
}

.day.has-diary .diary-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin-bottom: 0;
}

.calendar-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(123, 77, 67, 0.28);
  text-align: center;
  font-size: 12px;
  color: #443633;
}

.diary-stream {
  display: flex;
  flex-direction: column;
}

.stream-item {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 8px;
  position: relative;
  margin-bottom: 10px;
}

.time-rail {
  position: relative;
  color: var(--text-sub);
}

.date-big {
  font-size: 42px;
  font-weight: 700;
  color: rgba(82, 70, 65, 0.5);
  line-height: 1;
}

.ym-small {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(82, 70, 65, 0.62);
}

.time-small {
  margin-top: 3px;
  font-size: 13px;
  color: rgba(82, 70, 65, 0.7);
}

.rail-line {
  position: absolute;
  left: 20px;
  top: 72px;
  bottom: -8px;
  width: 1px;
  background: var(--line);
}

.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 9px 9px 10px;
  border: 1px solid rgba(229, 217, 195, 0.85);
}

.tag-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 2px;
}

.t-orange { background: #ffeec2; color: #b08100; }
.t-blue { background: #d7e8ff; color: #0056b3; }
.t-green { background: #e0ffd7; color: #2d8a00; }
.t-purple { background: #f3d7ff; color: #7a00b3; }

.text {
  font-size: 15px;
  line-height: 1.72;
  color: var(--text-main);
  text-align: justify;
  margin-bottom: 9px;
}

.img-row {
  display: grid;
  gap: 6px;
}

.img-row.two {
  grid-template-columns: repeat(2, 1fr);
}

.img-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.img-row img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.img-row.compact {
  max-width: 92%;
}

.bottom-tab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(375px, 100vw);
  height: calc(70px + env(safe-area-inset-bottom));
  background: #f1ebdf;
  border-top: 1px solid #ded5c3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 2px env(safe-area-inset-bottom);
  z-index: 20;
}

.tab-item {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #8c7e75;
  font-size: 12px;
}

.tab-item.active {
  color: #a08d7a;
}

.tab-item .icon {
  font-size: 24px;
}
