:root {
  color-scheme: light;
  --bg: #f7f2ea;
  --panel: #fffaf2;
  --panel-2: #f0f6f4;
  --text: #20211f;
  --muted: #72746e;
  --line: #ded8ce;
  --accent: #2f6b5f;
  --accent-strong: #1f4f46;
  --danger: #a23a35;
  --shadow: 0 18px 50px rgba(43, 35, 24, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 42px;
  align-items: center;
  padding: 56px;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(42px, 7vw, 82px);
}

h2 {
  font-size: 24px;
}

.subtle,
.message,
#saveState {
  color: var(--muted);
}

.subtle {
  margin-top: 18px;
  line-height: 1.8;
}

.auth-form {
  display: grid;
  gap: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .74);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 95, .14);
}

.auth-form input,
.search-wrap input,
.meta-row input {
  height: 46px;
  padding: 0 14px;
}

.auth-form button,
.new-button,
.editor-actions button {
  height: 46px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.auth-form .secondary {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--accent);
}

.message {
  min-height: 24px;
  margin: 0;
}

.diary {
  height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 242, .88);
  display: flex;
  flex-direction: column;
  padding: 22px;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  height: 38px;
  padding: 0 14px;
  background: #ebe2d5;
  color: var(--text);
}

.new-button {
  width: 100%;
}

.entry-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.entry-item {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
}

.entry-item:hover,
.entry-item.active {
  background: #ffffff;
  border-color: var(--line);
}

.entry-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-preview,
.entry-date {
  color: var(--muted);
  font-size: 13px;
}

.entry-preview {
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.editor {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fffdf8;
}

.editor-head {
  display: grid;
  gap: 14px;
  padding: 28px 34px 20px;
  border-bottom: 1px solid var(--line);
}

.title-input {
  height: 58px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 30px;
  font-weight: 700;
  box-shadow: none !important;
}

.meta-row {
  display: grid;
  grid-template-columns: 170px 120px 120px;
  gap: 10px;
}

#entryContent {
  min-height: 0;
  resize: none;
  border: 0;
  background: transparent;
  padding: 30px 34px;
  line-height: 1.9;
  font-size: 18px;
  box-shadow: none !important;
}

.editor-actions {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 34px;
  border-top: 1px solid var(--line);
}

.editor-actions #saveState {
  margin-right: auto;
}

.editor-actions .danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.empty {
  color: var(--muted);
  padding: 18px 4px;
  line-height: 1.8;
}

@media (max-width: 760px) {
  .auth-panel {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 34px 24px;
  }

  .diary {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .entry-list {
    max-height: 270px;
  }

  .editor {
    min-height: 620px;
  }

  .editor-head,
  #entryContent,
  .editor-actions {
    padding-left: 20px;
    padding-right: 20px;
  }

  .meta-row {
    grid-template-columns: 1fr;
  }
}
