:root {
  --brand: #c93e38;
  --brand-dark: #a93732;
  --ink: #333942;
  --muted: #737985;
  --line: #e9e1de;
  --page: #f7f5f3;
  --surface: #ffffff;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, textarea, a { font: inherit; }
button { cursor: pointer; border: 0; }
[hidden] { display: none !important; }

.page {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1fr);
  align-items: start;
  gap: 28px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0;
}

.calendar-panel, .content-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.calendar-panel {
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 18px 18px 0 0;
}

.topbar a, .topbar button {
  color: #ffffff;
  text-decoration: none;
  background: transparent;
  font-size: 30px;
}

.topbar strong { font-size: 22px; font-weight: 550; }
.calendar { padding: 20px 22px 18px; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays span { color: var(--muted); font-size: 16px; }
.days { gap: 8px 0; margin-top: 14px; }
.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 56px;
  margin: 0 auto;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border-radius: 50%;
  line-height: 1.1;
}
.day.blank { visibility: hidden; }
.day.selected { color: #ffffff; background: var(--brand); }
.solar-day {
  font-size: 20px;
}
.lunar-day {
  display: block;
  max-width: 58px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day.holiday .lunar-day {
  color: var(--brand-dark);
}
.day.selected .lunar-day {
  color: #ffffff;
}
.day-dot {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
}
.day.selected .day-dot { background: #ffffff; }

.content-panel { padding: 28px; }
.date-line h1 { margin: 0; font-size: 28px; font-weight: 550; }
.date-line p { min-height: 22px; margin: 6px 0 0; color: var(--brand-dark); font-size: 14px; }
.login-gate {
  margin: 20px 0;
  padding: 22px;
  color: var(--muted);
  background: #fff7f5;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.login-gate a { color: var(--brand); font-weight: 550; }
.diary-list-panel {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.list-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 550;
}
.list-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.record-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.record-pager button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--brand);
  background: #fff4f2;
  border-radius: 999px;
}
.record-pager button:disabled {
  color: var(--muted);
  cursor: default;
  background: #f4efed;
}
.records { display: grid; gap: 14px; margin: 0; }
.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.record {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.record p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}
.record-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}
.record-actions { display: flex; gap: 8px; }
.record-actions button, .quick-row button, .ghost {
  min-height: 38px;
  padding: 0 16px;
  color: var(--brand);
  background: #fff4f2;
  border-radius: 999px;
}
.voice-input-wrap {
  position: relative;
}
.editor textarea {
  width: 100%;
  height: 180px;
  padding: 16px 16px 58px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  resize: vertical;
}
.voice-input-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}
.voice-icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--brand);
  background: transparent;
  border-radius: 10px;
}
.voice-icon-btn:hover,
.voice-icon-btn:focus-visible {
  color: var(--brand-dark);
  background: #fff4f2;
  outline: 0;
}
.voice-icon-btn.is-listening {
  color: var(--brand-dark);
}
.voice-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.editor-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}
#submitBtn {
  min-height: 42px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 999px;
}
.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.quick-row button {
  color: var(--brand-dark);
  background: #ffffff;
  border: 1px solid var(--brand);
}

html.is-embedded,
html.is-embedded body {
  min-height: 0;
  background: transparent;
}

html.is-embedded .page {
  min-height: 0;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

html.is-embedded .topbar {
  display: none;
}

html.is-embedded .calendar-panel {
  border-radius: 18px;
}

@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; width: min(100% - 28px, 680px); padding: 18px 0; }
  .content-panel { padding: 20px; }
  .quick-row { grid-template-columns: 1fr; }
  .day { width: 48px; height: 54px; }
  .solar-day { font-size: 18px; }
  .lunar-day { max-width: 44px; font-size: 11px; }
  .list-head { align-items: flex-start; flex-direction: column; }
}
