:root {
  --paper: #f4f1ea;        /* the warm white page */
  --card: #fffdf9;         /* the editor card */
  --ink: #1c1b18;          /* the written text */
  --soft: #5e5a52;         /* field values, status */
  --muted: #9a958b;        /* labels, small print */
  --ghost: #b5b0a5;        /* the ghost text of the suggestion */
  --line: #ebe6dc;         /* hairlines */
  --accent: #2f7a5c;       /* the single accent: the light over accepted words, the pressed keys */
  --accent-soft: #e3efe8;  /* the accent's pale tint behind accepted words */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 2vh 14px;
}

.editor {
  width: min(600px, 92vw);
  background: var(--card);
  border: 1px solid #ebe5da;
  border-radius: min(22px, 4vh);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 1px 2px rgba(40, 30, 10, .05),
    0 10px 24px -14px rgba(40, 30, 10, .16),
    0 30px 60px -30px rgba(40, 30, 10, .26);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: min(14px, 2.6vh) min(20px, 4.6vw);
  border-bottom: 1px solid var(--line);
}

.app { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.app__mark {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--card);
}
.app__mark svg { width: 14px; height: 14px; display: block; }
.app__name { font-weight: 640; letter-spacing: -.01em; }
.app__sep { width: 1px; height: 12px; background: var(--line); }
.app__doc { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ai {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 11.5px; font-weight: 560; color: var(--accent);
  padding: 4px 9px 4px 7px; border-radius: 999px;
  background: var(--accent-soft);
}
.ai svg { width: 13px; height: 13px; display: block; }

.fields { padding: min(8px, 1.4vh) min(20px, 4.6vw) 0; }
.field {
  display: flex; gap: 12px; align-items: baseline;
  font-size: 13px; padding: min(7px, 1.2vh) 0;
  border-bottom: 1px solid var(--line);
}
.field__k { width: 54px; flex: none; color: var(--muted); }
.field__v { color: var(--soft); font-weight: 520; }

.body {
  padding: min(16px, 2.8vh) min(20px, 4.6vw) min(10px, 1.8vh);
  height: clamp(132px, 24vh, 196px);
  outline: none;
  cursor: text;
}
.body:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-soft); }

.text {
  font-family: "Newsreader Variable", Georgia, serif;
  font-variation-settings: "opsz" 18;
  font-size: clamp(15px, 1.4vh + 8px, 21px);
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -.003em;
}

/* the words that the AI wrote and you accepted: a pale light runs under them, then fades */
.acc { position: relative; --s: 0; --o: 0; }
.acc::before {
  content: "";
  position: absolute;
  left: -.28em; right: 0; top: .62em; bottom: .04em;
  border-radius: 2px;
  background: var(--accent-soft);
  transform: scaleX(var(--s));
  transform-origin: 0 50%;
  opacity: var(--o);
  z-index: -1;
}
.text { position: relative; z-index: 0; }

.caret {
  display: inline-block;
  width: 2px;
  height: 1.12em;
  margin: 0 -1px 0 0;
  vertical-align: -.2em;
  border-radius: 1px;
  background: var(--accent);
}

.ghost { color: var(--ghost); }
.ghost .gw { display: inline; }
.tabchip {
  display: inline-block;
  position: relative;
  margin-left: .35em;
  vertical-align: .12em;
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  font-size: 10.5px;
  line-height: 1;
}
.tabchip > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid #ddd7cb;
  border-bottom-width: 2px;
  background: #fff;
  color: var(--soft);
  font-weight: 600;
  letter-spacing: .02em;
}

.editor__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: min(11px, 2vh) min(20px, 4.6vw);
  border-top: 1px solid var(--line);
  background: #fcfaf5;
}

.status {
  position: relative;
  height: 16px;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  flex: 1 1 auto;
}
.status__roll { display: block; line-height: 16px; white-space: nowrap; }

.keys { display: flex; gap: min(12px, 2.4vw); flex: none; }
.key-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.cap {
  display: inline-grid;
  place-items: center;
  height: 20px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #ddd7cb;
  background: #fff;
  box-shadow: 0 1.5px 0 #ddd7cb;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 620;
  color: var(--soft);
}
.cap > span { grid-area: 1 / 1; }
.cap--wide { grid-auto-flow: column; gap: 3px; }
.cap--wide svg { width: 10px; height: 10px; display: block; }
.key-hint.is-on { color: var(--accent); }
.key-hint.is-on .cap { border-color: color-mix(in srgb, var(--accent) 45%, #ddd7cb); color: var(--accent); }

@media (max-width: 460px) {
  .key-hint__l { display: none; }
  .ai span { display: none; }
  .ai { padding: 4px; }
}

@media (hover: hover) {
  .key-hint:hover .cap { border-color: #cfc8ba; }
}
