:root {
  --bg: #e7dcc8;
  --ink: #1c1914;
  --muted: #5e564c;
  --paper: #fbf7ef;
  --line: #c4452d;
  --line-soft: rgba(196, 69, 45, 0.14);
  --button: #1c1914;
  --button-ink: #fbf7ef;
  --live: #f3e2c2;
  --ok: #2c6b45;
  --warn: #8a5a12;
  --bad: #9c3b2e;
  --shadow: 0 18px 50px rgba(48, 32, 16, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255, 250, 240, 0.7), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 7vw 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 22px;
  border-left: 3px solid var(--line);
  background: linear-gradient(var(--ink), var(--ink)) 6px 4px / 8px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 6px 10px / 8px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 6px 16px / 8px 2px no-repeat;
}

.brand-name {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.brand-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

main {
  width: min(920px, calc(100% - 10vw));
  margin: 0 auto 64px;
}

.join, .access {
  margin-top: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
}

input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: var(--paper);
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  box-shadow: var(--shadow);
}

input:focus, textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid transparent;
  background: #f3eee4;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: Literata, Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.5;
}

button {
  font: inherit;
  font-weight: 560;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

button.primary {
  background: var(--button);
  color: var(--button-ink);
  padding-inline: 20px;
}

button.primary:hover { background: #000; }

button.ghost { background: transparent; }

button.text-button {
  margin-top: 12px;
  padding: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.text-button span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
}

.hint, .form-error, .meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.hint { margin: 10px 0 0; max-width: 62ch; }

.hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

.form-error {
  color: var(--bad);
  margin: 8px 0 0;
  font-weight: 560;
}

.access { margin-top: 16px; }

.prefix {
  margin-bottom: 12px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}

.prefix .row { margin-top: 10px; }
.prefix .hint { margin: 10px 0 0; }
.prefix .form-error { margin-top: 8px; }

#prefix-open[aria-expanded="true"] {
  background: var(--ink);
  color: var(--paper);
}

.stage { margin-top: 22px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.status.live .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(44, 107, 69, 0.15); }
.status.wait .dot { background: var(--warn); }
.status.bad .dot { background: var(--bad); }

.langs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.lang-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.langs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.actions { margin-left: auto; display: flex; gap: 6px; }

.paper {
  position: relative;
  min-height: 52vh;
  max-height: 68vh;
  overflow: auto;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 28px 36px 42px;
}

.paper::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 22px;
  width: 2px;
  background: var(--line);
}

.empty {
  margin: 0;
  color: var(--muted);
  font-family: Literata, Georgia, serif;
  font-style: italic;
}

.text {
  font-family: Literata, Georgia, serif;
  font-size: 1.18rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text .live {
  background: var(--live);
  border-radius: 2px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.jump {
  position: fixed;
  right: 18px;
  bottom: 18px;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .top { flex-direction: column; align-items: flex-start; padding: 18px 5vw 4px; }
  main { width: min(920px, calc(100% - 10vw)); }
  .row, .toolbar, .actions, .prefix .row { flex-direction: column; align-items: stretch; }
  .actions { margin-left: 0; }
  .actions button, .row button { width: 100%; }
  .paper { max-height: none; padding: 22px 16px 28px 28px; }
  .paper::before { left: 12px; }
  .text { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .status.live .dot { box-shadow: none; }
}
