:root {
  --brand-red: #a31f1f;
  --accent-gold: #c8a24a;
  --tag-bg: #8b251e;
  --text-main: #3d322d;
  --text-sub: #8c7e75;
  --page-bg-image: url("../../小图/微信图片_20260414214619_122_535.jpg");
}

* {
  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(50px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.topbar h1.centered-title {
  margin: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}

.right-actions {
  width: 86px;
  height: 32px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  font-size: 14px;
}

.right-actions .divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
}

.content {
  padding: 15px 12px;
}

.tag-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 200px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.tag-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 2px 0;
}

.tag-row::-webkit-scrollbar {
  display: none;
}

.pill-tag {
  background: var(--tag-bg);
  color: #fff;
  border-radius: 13px;
  padding: 4px 9px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-tag:active {
  transform: scale(0.95);
  opacity: 0.9;
}

.pill-tag .icon {
  font-size: 12px;
}

.edit-area {
  background: transparent;
}

.collapse-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
}

.collapse-row span:hover {
  text-decoration: underline;
}

.title-input input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  padding: 8px 0;
  outline: none;
}

.title-input input::placeholder {
  color: #c0b3a9;
}

.divider {
  width: 100%;
  height: 1px;
  background: #d4c8b8;
  margin: 8px 0;
}

.content-input textarea {
  width: 100%;
  min-height: 150px;
  border: 0;
  background: transparent;
  font-size: 15px;
  color: var(--text-main);
  padding: 8px 0;
  outline: none;
  resize: none;
  line-height: 1.5;
}

.content-input textarea::placeholder {
  color: #c0b3a9;
}

.upload-area {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-img {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
}

.upload-btn {
  width: 100px;
  height: 100px;
  background: #ebdcc3;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.plus-icon {
  font-size: 40px;
  color: #8c7e75;
  font-weight: 300;
}

.upload-hint {
  width: 100%;
  font-size: 12px;
  color: #8c7e75;
  margin-top: 5px;
}

.save-btn {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(70px + env(safe-area-inset-bottom) + 15px);
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--brand-red);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(163, 31, 31, 0.4);
  z-index: 10;
}

.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;
}
