:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #403c2f;
  background: #fff5cd;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; }
body { overflow: hidden; }
[hidden] { display: none !important; }

.note {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #fff5cd;
}

h1 {
  flex: 0 0 auto;
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  color: #786d4d;
  letter-spacing: .02em;
}

.editor { display: flex; flex: 1; flex-direction: column; min-height: 0; }
textarea {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 2px 10px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 18px;
  line-height: 1.65;
  tab-size: 4;
  overflow-wrap: anywhere;
  -webkit-appearance: none;
}
textarea:disabled { opacity: 1; -webkit-text-fill-color: #403c2f; }
textarea::selection { background: #ecd99e; }
.status {
  flex: 0 0 auto;
  min-height: 18px;
  margin: 7px 0 0;
  text-align: right;
  color: #807555;
  font-size: 11px;
  line-height: 18px;
}
.status[data-error="true"] { color: #936033; }

.login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 10px;
  flex: 1;
  width: min(100%, 340px);
  margin: 0 auto;
  padding-bottom: 10vh;
}
.login input, .login button {
  min-height: 46px;
  border: 1px solid #d5c69b;
  border-radius: 5px;
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.login input { min-width: 0; width: 100%; padding: 10px 12px; background: #fff9e2; }
.login input::placeholder { color: #8a8066; }
.login button { padding: 10px 16px; background: #f1e3b0; cursor: pointer; }
.login input:focus-visible, .login button:focus-visible { outline: 2px solid #988149; outline-offset: 2px; }
.login button:disabled { cursor: wait; opacity: .65; }
.login-error { grid-column: 1 / -1; min-height: 20px; margin: 0; color: #936033; font-size: 12px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  .note {
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  h1 { margin-bottom: 14px; }
  textarea { font-size: 17px; }
}

@media (max-height: 320px) {
  .note { padding-top: max(10px, env(safe-area-inset-top)); }
  h1 { margin-bottom: 8px; }
  .login { padding-bottom: 0; }
}
