:root{
  --bg:#fafaf9; --card:#ffffff; --ink:#0f172a; --muted:#6b7280; --border:#e5e7eb; --brand:#111827;
  --maxw: 820px; --pad: 16px; --radius: 12px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* Header */
.appbar.chrome { background: #fff7ca; }           /* pale yellow strip like before */
.appbar .bar{
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 12px;
}
.brand{font-weight:700; letter-spacing:.2px}
.spacer{flex:1}
.btn{
  border:1px solid var(--border); padding:6px 10px;
  border-radius:10px; background:#fff; cursor:pointer;
}
.btn.subtle{background:#f9fafb}
.check{display:inline-flex; align-items:center; gap:6px; color:var(--muted); font-size:14px}

/* --- Layout: keep header and editor the same width --- */
.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.appbar { position: sticky; top: 0; z-index: 100; }
.appbar .bar {                 /* header content matches editor width */
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Editor block provides anchors for the button + notice --- */
.editor-wrap { position: relative; margin-bottom: 88px; } /* room for button+pill */
#editor{
  width:100%; min-height:220px; resize:vertical;
  border:1px solid var(--border); border-radius:var(--radius);
  padding:14px; outline:none; background:#fff;
  box-shadow:0 1px 0 #00000005;
  font-size: 18px;
  line-height: 1.6;
}
#editor::placeholder{color:#9ca3af}

/* Commit button fixed to bottom-right of the editor box */
#commitBtn.commit {
  position: absolute;
  right: 16px;
  bottom: -42px;      /* slightly outside the textarea */
}

/* The green "Committed ✓ Digest …" pill under the editor */
#commitNotice {
  position: absolute;
  left: 0;
  bottom: -44px;
  display: none;                 /* shown by JS for ~2s */
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #b6f2c1;
  background: #e6ffed;
  color: #0a5a2b;
  font-size: 14px;
}
#commitNotice.show { display: inline-block; }

/* Big round black commit button */
#commitBtn.commit {
  border: 0;
  background: #0a1020;      /* deep navy/black */
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  padding: 16px 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background .2s ease;
}
#commitBtn.commit:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

/* Focus mode - hide chrome elements */
.focus .chrome{display:none}
.focus .entry-meta{display:none}

/* Focus reveal strip at the very top */
#focus-reveal {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 8px; z-index: 10000;
  cursor: ns-resize;
  display: none;
}
body.focus #focus-reveal { display: block; }

/* Hide toolbar/header in focus mode */
body.focus .appbar, body.focus header { display: none; }

/* Floating commit button for focus mode */
.commit-bar{position:fixed; right:24px; bottom:24px; z-index:20}

/* Entries */
.entry{
  border:1px solid var(--border); border-radius:var(--radius); padding:14px;
  background:#fff; margin-bottom:12px;
}
.entry .badge{font-size:12px; color:var(--muted); margin-bottom:12px; display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.entry .content{margin-bottom:12px; line-height:1.6; white-space:pre-wrap}
.entry .tools{display:flex; gap:10px; align-items:center; margin-top:6px}

/* Button hover states */
.btn:hover{opacity:0.9; transform:translateY(-1px)}
.commit:hover{opacity:0.9; transform:translateY(-1px)}

/* Digest styling */
.dgst{font-family:monospace; background:var(--bg); padding:2px 6px; border-radius:4px; font-size:11px}

/* Proof chip styling */
.digest-chip{font-size:12px; color:#555; background:#f6f7f8; border-radius:999px; padding:4px 10px; font-family:monospace}

/* Word count */
.word-count{position:absolute; bottom:8px; right:12px; font-size:12px; color:var(--muted); background:rgba(255,255,255,0.9); padding:2px 6px; border-radius:4px}

/* Entry metadata with hover effect */
.entry .meta{
  color:var(--muted); font-size:12.5px; display:flex; gap:10px; align-items:center;
}
.entry .meta .digest{opacity:0; transition:.15s}
.entry:hover .meta .digest{opacity:1}
.entry .meta .actions{margin-left:auto; display:flex; gap:8px}
.link{color:#2563eb; text-decoration:none; font-size:12.5px}

/* Smaller black pill commit */
#commitBtn.commit{
  background:#0a1020;
  color:#fff;
  border:0;
  font-weight:800;
  font-size:18px;        /* was 20px */
  line-height:1;
  padding:12px 22px;     /* was 16px 28px */
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  box-shadow:0 10px 22px rgba(0,0,0,.16);
  cursor:pointer;
  transition:transform .06s ease, box-shadow .12s ease, background .2s ease;
}
#commitBtn.commit:active{
  transform:translateY(1px);
  box-shadow:0 6px 14px rgba(0,0,0,.18);
}

/* Optional: a touch smaller on very narrow screens */
@media (max-width:480px){
  #commitBtn.commit{ font-size:16px; padding:10px 18px; }
}