:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --surface: #fffefb;
  --ink: #2f2f2f;
  --muted: #9a948b;
  --line: #e7dfd3;
  --gold: #c18800;
  --gold-soft: #f7eddb;
  --danger: #c2410c;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, "Times New Roman", serif;
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

.icon-button,
.text-button,
.secondary-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.icon-button,
.text-button {
  background: transparent;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
}

.composer {
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 16px 50px rgba(101, 75, 34, 0.08);
}

textarea {
  display: block;
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.8;
}

textarea::placeholder {
  color: #beb8ae;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.primary-button {
  min-width: 88px;
  padding: 13px 22px;
  background: var(--gold);
  color: #fff;
  font-weight: 800;
}

.primary-button.subtle {
  background: var(--gold-soft);
  color: var(--gold);
}

.secondary-button {
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.settings-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
}

.settings-panel label {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
  outline-color: var(--gold);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 28px;
  color: var(--muted);
  font-size: 14px;
}

.online {
  color: #8a6500;
}

.offline {
  color: var(--danger);
}

.recent-section {
  margin-top: 6px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.recent-list {
  display: grid;
  gap: 12px;
}

.recent-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.recent-item p {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.7;
}

.recent-item small {
  display: block;
  margin-top: 10px;
  color: var(--danger);
}

.sync-pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: #f4efe7;
  color: var(--muted);
  font-weight: 700;
}

.sync-pill.synced {
  background: var(--gold-soft);
  color: var(--gold);
}

.sync-pill.failed {
  background: #fff1eb;
  color: var(--danger);
}

.sync-pill.syncing {
  background: #f7eddb;
  color: var(--gold);
}

.empty {
  padding: 20px 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .shell {
    padding-inline: 14px;
  }

  h1 {
    font-size: 30px;
  }

  textarea {
    min-height: 260px;
    font-size: 20px;
  }

  .composer-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    justify-content: flex-start;
  }
}
