:root {
  color-scheme: light;
  --paper: #f6f3ed;
  --card: #fffdfa;
  --ink: #252820;
  --muted: #7a7d73;
  --line: #e7e3d9;
  --green: #3e6651;
  --green-dark: #2e4e3e;
  --soft-green: #e7efe9;
  --accent: #c88459;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.shell { max-width: 1440px; margin: 0 auto; padding: 26px 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 4px 24px; border-bottom: 1px solid var(--line); }
.topbar h1, .login-card h1 { margin: 5px 0 0; font-family: Georgia, "Songti SC", "Noto Serif CJK SC", serif; font-size: 32px; font-weight: 500; letter-spacing: .03em; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .19em; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.button { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); transition: background .15s ease, transform .15s ease; }
.button:hover { background: #f0eee7; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .6; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.quiet { background: transparent; }
.status-pill { padding: 8px 11px; border: 1px solid var(--line); border-radius: 100px; color: var(--muted); font-size: 12px; }
.link-card, .login-card { margin: 46px auto; padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 16px 48px #3936230b; }
.link-card { max-width: 850px; }
.login-card { width: min(100%, 430px); margin-top: min(15vh, 140px); }
.link-card h2 { margin: 8px 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.muted { color: var(--muted); line-height: 1.65; }
.stack { display: grid; gap: 11px; margin-top: 24px; }
label { color: #4f534a; font-size: 13px; }
input { min-width: 0; height: 44px; padding: 0 13px; border: 1px solid #dcd9d0; border-radius: 7px; outline: none; background: #fff; color: var(--ink); }
input:focus { border-color: #76917f; box-shadow: 0 0 0 3px #3e66511a; }
.link-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 14px; margin-top: 24px; }
.link-form label { display: grid; gap: 8px; }
.message { min-height: 20px; color: #9b4c3b; font-size: 13px; }
.global-message { margin: 12px 4px; }
.diary-workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); min-height: calc(100vh - 155px); margin-top: 22px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.sidebar { display: flex; flex-direction: column; min-height: 560px; border-right: 1px solid var(--line); background: #fbfaf6; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; padding: 21px 20px 16px; }
.sidebar-heading h2 { margin: 7px 0 0; font-size: 19px; font-weight: 550; }
.account-name { max-width: 140px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.image-host-note { margin: -5px 18px 12px; font-size: 11px; overflow-wrap: anywhere; }
.search-box { display: block; padding: 0 16px 14px; }
.search-box input { width: 100%; height: 40px; border-color: transparent; background: #f1efe8; }
.diary-list { flex: 1; overflow: auto; }
.diary-card { display: block; width: 100%; padding: 15px 19px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; text-align: left; }
.diary-card:hover { background: #f7f6f0; }
.diary-card.active { background: var(--soft-green); box-shadow: inset 3px 0 var(--green); }
.diary-card-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.diary-card-title { display: block; margin-top: 8px; overflow: hidden; font-family: Georgia, "Songti SC", serif; font-size: 16px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.diary-card-preview { display: -webkit-box; margin-top: 5px; overflow: hidden; color: #77796f; font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.load-more { align-self: center; margin: 12px; }
.detail-panel { min-width: 0; padding: clamp(24px, 5vw, 68px); overflow: auto; }
.detail-header { max-width: 780px; margin: 0 auto 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-date { color: var(--green); font-size: 12px; letter-spacing: .06em; }
.detail-title { margin: 9px 0 0; font-family: Georgia, "Songti SC", "Noto Serif CJK SC", serif; font-size: clamp(24px, 3vw, 38px); font-weight: 500; line-height: 1.35; }
.detail-category { display: inline-block; margin-top: 12px; padding: 5px 9px; border-radius: 99px; background: var(--soft-green); color: var(--green-dark); font-size: 11px; }
.content-body { max-width: 780px; margin: 0 auto; font-family: Georgia, "Songti SC", "Noto Serif CJK SC", serif; font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; }
.content-body p { margin: 0 0 12px; white-space: pre-wrap; }
.content-image { display: block; max-width: 100%; height: auto; margin: 18px auto 24px; border-radius: 8px; }
.empty-detail, .empty-list { display: grid; align-content: center; justify-items: center; min-height: 400px; padding: 36px; color: var(--muted); text-align: center; }
.empty-detail h2 { margin-bottom: 2px; color: var(--ink); font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.empty-mark { color: var(--accent); font-size: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .shell { padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .link-form { grid-template-columns: 1fr; }
  .link-card, .login-card { margin: 22px auto; padding: 24px; }
  .diary-workspace { grid-template-columns: 1fr; }
  .sidebar { min-height: 0; max-height: 44vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .diary-list { min-height: 180px; }
  .detail-panel { min-height: 44vh; padding: 28px 20px; }
}
