:root {
  --ink: #18332d;
  --muted: #63736f;
  --paper: #f5f7f2;
  --white: #ffffff;
  --green: #1f6f5f;
  --green-dark: #155247;
  --yellow: #f2c14e;
  --coral: #df725f;
  --line: #dce3dc;
  --shadow: 0 18px 50px rgba(28, 57, 50, 0.11);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background-color: var(--paper); background-image: linear-gradient(rgba(31, 111, 95, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 111, 95, .035) 1px, transparent 1px); background-size: 28px 28px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.topbar { height: 68px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .88); }
.brand { color: var(--ink); font: 700 20px Georgia, "Songti SC", serif; text-decoration: none; }
.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.account form { display: flex; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); font-size: 20px; }
.icon-button:hover { border-color: var(--green); color: var(--green); }

.app-shell { width: min(1180px, calc(100% - 48px)); margin: 48px auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr); gap: 70px; align-items: start; }
.entry-section { padding: 18px 0; }
.eyebrow { margin: 0 0 8px; color: var(--coral); font-size: 12px; font-weight: 800; letter-spacing: 1.8px; }
h1, h2 { margin: 0; font-family: Georgia, "Songti SC", serif; letter-spacing: 0; }
h1 { font-size: clamp(38px, 6vw, 68px); line-height: 1.05; }
h2 { font-size: 30px; }
.date-copy { margin: 14px 0 34px; color: var(--muted); }
.message { margin-bottom: 18px; padding: 12px 14px; border-left: 4px solid var(--green); background: #e5f1ed; color: var(--green-dark); }

.mood-form { display: grid; gap: 18px; }
.field-row, .score-heading, .note-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
label { font-weight: 700; }
input[type="date"] { width: 160px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--white); }
.score-heading { margin-top: 8px; }
#score-output { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: var(--yellow); font: 700 30px Georgia, serif; box-shadow: 0 5px 0 #d3a128; }
.mood-scale { display: flex; justify-content: space-between; margin-bottom: -12px; color: var(--muted); font-size: 12px; }
input[type="range"] { --score: 50%; width: 100%; height: 28px; margin: 0; appearance: none; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--coral) 0%, var(--yellow) var(--score), var(--line) var(--score)); }
input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -8px; appearance: none; border: 4px solid var(--white); border-radius: 50%; background: var(--green); box-shadow: 0 2px 8px rgba(24, 51, 45, .3); }
.note-heading { margin-top: 6px; }
#note-count { color: var(--muted); font-size: 12px; }
textarea { width: 100%; resize: vertical; min-height: 112px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); line-height: 1.6; }
textarea:focus, input:focus { outline: 3px solid rgba(31, 111, 95, .15); border-color: var(--green); }
.save-button { min-height: 50px; border: 0; border-radius: 6px; color: var(--white); background: var(--green); font-weight: 800; box-shadow: 0 5px 0 var(--green-dark); }
.save-button:hover { background: var(--green-dark); }
.errorlist { margin: -10px 0 0; padding: 0; list-style: none; color: #a33f31; font-size: 13px; }

.history-section { min-height: 510px; padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; padding-bottom: 22px; border-bottom: 2px solid var(--ink); }
.entry-count { color: var(--muted); font-size: 13px; }
.history-list { display: grid; }
.history-item { min-height: 92px; display: grid; grid-template-columns: 54px 46px 1fr; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.history-item time { display: grid; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.history-item time strong { color: var(--ink); font: 700 17px Georgia, serif; }
.score-badge { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #f8df9e; font: 700 18px Georgia, serif; }
.history-item p { margin: 0; overflow-wrap: anywhere; line-height: 1.5; }
.muted { color: #98a39f; }
.empty-state { padding: 80px 16px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }

.site-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--green); text-decoration: underline; }

.login-page { display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; padding: 24px; }
.login-shell { width: min(960px, 100%); min-height: 560px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.login-intro { padding: 70px 56px; display: flex; flex-direction: column; justify-content: end; color: var(--white); background: var(--green); }
.login-intro h1 { max-width: 430px; font-size: clamp(42px, 6vw, 72px); }
.login-intro p:last-child { max-width: 340px; margin-top: 22px; line-height: 1.8; color: #d9ebe5; }
.login-panel { padding: 70px 48px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { margin-bottom: 28px; }
.login-panel form { display: grid; gap: 11px; }
.login-panel input { width: 100%; height: 44px; margin-bottom: 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; }
.login-panel button { height: 48px; margin-top: 8px; border: 0; border-radius: 5px; color: var(--white); background: var(--green); font-weight: 800; }
.form-error { padding: 10px 12px; color: #8b3429; background: #fce7e2; font-size: 13px; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 32px, 620px); margin: 26px auto; grid-template-columns: 1fr; gap: 32px; }
  .history-section { padding: 22px; }
  .site-footer { width: min(100% - 32px, 620px); }
  .login-shell { max-width: 480px; min-height: auto; grid-template-columns: 1fr; }
  .login-intro { min-height: 250px; padding: 36px 30px; }
  .login-panel { padding: 40px 30px; }
}

@media (max-width: 460px) {
  .topbar { padding: 0 16px; }
  .app-shell { width: calc(100% - 24px); }
  h1 { font-size: 42px; }
  .history-item { grid-template-columns: 48px 42px minmax(0, 1fr); gap: 10px; }
  .history-section { padding: 18px; }
}
