:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: #202d40;
  background: #f1f2f4;
  line-height: 1.5;
  color-scheme: light;
  font-synthesis: none;
  --ink: #17304f;
  --blue: #1d4ed8;
  --muted: #4b596c;
  --line: #c7ced8;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; min-height: 44px; border: 0; background: none; border-radius: 4px; }
button:disabled { color: #697587; background: #f0f2f5; cursor: default; opacity: 1; }
button, input, textarea, summary { -webkit-tap-highlight-color: transparent; transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
main { position: absolute; top: var(--viewport-top,0px); left: 0; right: 0; display: flex; flex-direction: column; max-width: 600px; height: 100dvh; height: var(--viewport-height,100dvh); margin: auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-inline: 1px solid var(--line); }
header, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
header { flex-shrink: 0; margin: calc(-12px - env(safe-area-inset-top)) -16px 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 8px; background: var(--ink); color: #fff; }
h1 { font-size: 20px; font-weight: 650; margin: 0; }
h2 { font-size: 17px; font-weight: 650; margin: 0; color: #192436; }
.text-button { font-size: 14px; color: #174986; padding: 8px 6px; }
.text-button:hover { background: #eef3fc; }
#open-menu { color: #fff; font-size: 19px; letter-spacing: 2px; min-width: 44px; text-align: center; }
#open-menu:hover { background: #29496d; }
textarea { display: block; width: 100%; padding: 12px; resize: none; min-height: 76px; border: 1px solid #7d899b; border-radius: 4px; background: #fff; font-size: 17px; line-height: 1.65; }
textarea:focus { border-color: var(--blue); }
textarea::placeholder, input::placeholder { color: #566477; opacity: 1; }
#editor-title { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
#time-options { margin-top: 4px; color: var(--muted); font-size: 13px; }
summary { cursor: pointer; min-height: 36px; align-content: center; }
input[type=datetime-local] { display: block; width: 100%; min-width: 0; max-width: 100%; font-size: 16px; padding: 10px; border: 1px solid #7d899b; border-radius: 4px; background: #fff; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.spacer { flex: 1; }
.primary, .secondary { padding: 10px 20px; border-radius: 4px; font-size: 14px; font-weight: 550; border: 1px solid transparent; }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.primary:not(:disabled):hover { background: #183da8; }
.secondary { border-color: #7d899b; background: #fff; color: #243247; }
.secondary:hover { background: #edf2fa; }
.danger { color: #9b2535; }
.history { display: flex; flex: 1; flex-direction: column; min-height: 0; }
#history-list { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; overflow-anchor: none; padding-bottom: 12px; }
#records { flex-shrink: 0; margin-top: auto; }
#more { flex-shrink: 0; }
#memo-form { flex-shrink: 0; max-height: 70%; overflow-y: auto; border-top: 1px solid #aeb8c6; padding-top: 10px; }
#history-tools, #deleted-heading { flex-shrink: 0; }
.day-heading { font-size: 12px; color: #415168; font-weight: 550; text-align: center; margin: 16px 0 8px; }
.record { border-bottom: 1px solid #d0d5dd; }
.record-button { width: 100%; text-align: left; display: block; padding: 12px 0; border-radius: 0; }
.record-button:hover { background: #f0f4ff; }
.record-content { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; margin: 0 0 4px; }
.record time, .restore-label { font-size: 12px; color: var(--muted); }
.restore-label { float: right; margin-left: 12px; color: #174986; }
.empty { font-size: 14px; color: var(--muted); text-align: center; margin: 32px 0; }
#history-tools, #deleted-heading { display: flex; align-items: center; gap: 10px; padding-block: 6px; font-size: 14px; color: #415168; }
#history-tools input { flex: 1; min-width: 0; width: 100%; font-size: 16px; border: 1px solid #7d899b; border-radius: 4px; padding: 10px; background: #fff; }
#deleted-heading { justify-content: space-between; border-bottom: 1px solid var(--line); }
#more { display: block; margin: 12px auto; }
.error { font-size: 13px; color: #9b2535; overflow-wrap: anywhere; }
.hint, .help { font-size: 12px; color: var(--muted); line-height: 1.7; }
.help { border-top: 1px solid var(--line); padding-top: 10px; }
.help p { margin: 8px 0; }
dialog { width: 380px; max-width: calc(100% - 24px); max-height: calc(100dvh - 24px); overflow: auto; padding: 0; border: 1px solid #aeb8c6; border-top: 3px solid var(--ink); border-radius: 4px; color: inherit; background: #fff; }
dialog::backdrop { background: #17273f40; }
.sheet { padding: 18px; }
.menu-item { display: block; text-align: left; width: 100%; font-size: 15px; padding: 12px 4px; border-bottom: 1px solid var(--line); border-radius: 0; }
.menu-item:not(:disabled):hover { background: #f0f4ff; }
.dialog-heading { margin-bottom: 6px; }
#export-dialog .sheet > button { display: block; width: 100%; margin-top: 10px; }
#toast { position: fixed; top: calc(var(--viewport-top,0px) + 72px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 13px; z-index: 5; }
@media (max-width: 600px) { main { border-inline: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
