/* Same look as the Mac app: light background, dark grey text,
   one line per note with a faint rule under it, generous padding. */
:root {
  --bg: #fafafa;
  --text: rgba(0, 0, 0, 0.85);
  --faint: rgba(0, 0, 0, 0.4);
  --rule: rgba(0, 0, 0, 0.1);
  --size: 17px;
  --gap: 15px;           /* space between notes; the rule sits in the middle */
  --side: 28px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --text: rgba(255, 255, 255, 0.85);
    --faint: rgba(255, 255, 255, 0.4);
    --rule: rgba(255, 255, 255, 0.12);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font: var(--size)/1.3 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
[hidden] { display: none !important; }

/* A solid strip behind the clock and battery, so the note never shows
   (or blurs) underneath them when you scroll. */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top);
  background: var(--bg);
  z-index: 3;
}

#app {
  min-height: 100vh;
  padding: calc(max(env(safe-area-inset-top), 20px) + 20px)
           calc(env(safe-area-inset-right) + var(--side))
           calc(env(safe-area-inset-bottom) + 40px)
           calc(env(safe-area-inset-left) + var(--side));
}

#note { min-height: 60vh; cursor: text; -webkit-tap-highlight-color: transparent; }
.line {
  padding: calc(var(--gap) / 2) 0;
  min-height: calc(var(--size) * 1.3 + var(--gap));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.line.ruled { background: linear-gradient(var(--rule), var(--rule)) bottom / 100% 1px no-repeat; }
.line a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.empty { color: var(--faint); padding-top: calc(var(--gap) / 2); }

/* While editing, the text sits in a plain text box. Behind it, an invisible
   copy of the same text draws the faint rules, so they stay in place. Each
   line is as tall as a one-line note in the normal view, so nothing jumps. */
#editwrap { position: relative; min-height: 60vh; }
#editor, #rules {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  line-height: calc(var(--size) * 1.3 + var(--gap));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#rules {
  position: absolute;
  top: 0; left: 0; right: 0;
  color: transparent;
  pointer-events: none;
}
#rules .ruled {
  background: linear-gradient(var(--rule), var(--rule)) bottom / 100% 1px no-repeat;
}
#editor {
  position: relative;
  min-height: 60vh;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: inherit;
}

#status { margin: 24px 0 0; font-size: 13px; color: var(--faint); }

#login {
  max-width: 340px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18vh) 28px 40px;
}
#login h1 { font-size: 28px; font-weight: 600; margin: 0 0 8px; }
#login p { color: var(--faint); margin: 0 0 20px; }
#login input, #login button {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  border-radius: 10px;
}
#login input { border: 1px solid var(--rule); background: transparent; color: inherit; margin-bottom: 12px; }
#login button { border: 0; background: var(--text); color: var(--bg); font-weight: 600; }
#login .error { color: #c0392b; margin-top: 14px; }
