:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #faf9f6;
  --accent: #4f46e5;
  --accent-ink: #fff;
  --max: 72rem;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.site-header .brand { font-weight: bold; font-size: 1.15rem; color: var(--ink); }
.site-header nav { display: flex; gap: 1rem; align-items: center; }

/* Layout */
/* Single site-wide content width (--max). */
.container, .column { max-width: var(--max); margin: 2rem auto; padding: 0 1.2rem; }
.column { margin-top: 0; margin-bottom: 0; padding: 0; }

/* Buttons */
.button, button, input[type="submit"] {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.button.primary, input[type="submit"].primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.button:hover { text-decoration: none; filter: brightness(0.98); }
.linkish {
  border: none; background: none; color: var(--accent);
  padding: 0; cursor: pointer; font: inherit;
}
.linkish.danger, .danger .linkish { color: #b91c1c; }

/* Flash */
.flash { max-width: var(--max); margin: 1rem auto 0; padding: 0.6rem 1rem; border-radius: 7px; }
.flash.notice { background: #ecfdf5; color: #065f46; }
.flash.alert { background: #fef2f2; color: #991b1b; }

/* Splash */
.splash { max-width: 38rem; margin: 4rem auto; padding: 0 1.2rem; text-align: center; }
.splash h1 { font-size: 3rem; margin: 0 0 0.5rem; }
.splash .tagline { font-size: 1.2rem; color: var(--muted); }
.splash .features { list-style: none; padding: 0; margin: 2rem 0; text-align: left; display: inline-block; }
.splash .features li { margin: 0.4rem 0; }
.splash .cta { display: flex; gap: 0.8rem; justify-content: center; margin-top: 1.5rem; }

/* Auth / simple forms */
.auth-card { max-width: 26rem; margin: 2rem auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.6rem; }
.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.85rem; color: var(--muted); font-family: system-ui, sans-serif; }
.field small { color: var(--muted); font-size: 0.8rem; }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%;
}
.errors { background: #fef2f2; color: #991b1b; border-radius: 7px; padding: 0.6rem 1rem 0.6rem 2rem; }
.profile h2 { margin-top: 1.6rem; font-size: 1.1rem; }
.profile fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.profile legend { padding: 0 0.4rem; color: var(--muted); font-family: system-ui, sans-serif; font-size: 0.85rem; }
.aux { color: var(--muted); font-size: 0.9rem; margin-top: 1rem; }

/* Writes index */
.page-head { display: flex; align-items: center; justify-content: space-between; }
.filters { display: flex; gap: 0.6rem; align-items: center; margin: 1rem 0; font-family: system-ui, sans-serif; }
.filters select { width: auto; }
.write-list, .version-list { list-style: none; padding: 0; margin: 1rem 0; }
.write-list li, .version-list li {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  padding: 0.9rem 0; border-bottom: 1px solid var(--line);
}
.write-title { font-size: 1.15rem; font-weight: bold; }
.meta { color: var(--muted); font-size: 0.85rem; font-family: system-ui, sans-serif; display: block; }
.badge { background: #eef2ff; color: var(--accent); padding: 0.1rem 0.5rem; border-radius: 20px; font-size: 0.75rem; }
.tags { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }
.tag { color: var(--muted); font-size: 0.8rem; font-family: system-ui, sans-serif; }
.empty { color: var(--muted); }

/* Reading (show): page is full-width, but the prose keeps a readable measure. */
.reading .prose { font-size: 1.15rem; max-width: 46rem; }
.reading .prose p { margin: 0 0 1.2rem; }
.status { font-family: system-ui, sans-serif; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.danger { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* Editor */
.editor { display: grid; grid-template-columns: 1fr 18rem; gap: 1.5rem; max-width: var(--max); margin: 1.5rem auto; padding: 0 1.2rem; }
.editor-bar { display: flex; align-items: center; gap: 1rem; font-family: system-ui, sans-serif; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.8rem; }
.editor-bar .back { margin-right: auto; }
.save-status { font-style: italic; }
.title-input { font-size: 1.6rem; font-weight: bold; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0.3rem 0; margin-bottom: 1rem; }
.title-input:focus { outline: none; border-bottom-color: var(--accent); }
.body-input {
  width: 100%; border: none; resize: vertical; min-height: 60vh;
  font-family: "Iowan Old Style", Georgia, serif; font-size: 1.15rem; line-height: 1.7; background: transparent;
}
.body-input:focus { outline: none; }
.editor-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-family: system-ui, sans-serif; }
.editor-meta .field { margin: 0; }
.editor-meta .grow { flex: 1; min-width: 12rem; }
.editor-footer { display: flex; gap: 0.8rem; align-items: center; margin-top: 1.2rem; }

/* Editor side: dictionary */
.editor-side { font-family: system-ui, sans-serif; font-size: 0.9rem; border-left: 1px solid var(--line); padding-left: 1.2rem; }
.editor-side h3 { margin-top: 0; }
.lookup { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; }
.definitions .hint { color: var(--muted); }
.definitions h4 { margin: 0.5rem 0 0.2rem; }
.definitions .phonetic { color: var(--muted); margin: 0 0 0.4rem; }
.definitions .pos { font-style: italic; color: var(--accent); margin: 0.6rem 0 0.2rem; }
.definitions ol { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.definitions li { margin-bottom: 0.3rem; }
.side-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.word-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.2rem 0 0.6rem; }
.word-chips .chip { background: #eef2ff; color: var(--accent); border-radius: 20px; padding: 0.1rem 0.55rem; font-size: 0.8rem; }

.version-list .preview { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 0; }

@media (max-width: 52rem) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 1rem; }
}
