:root{--memo-ink:#173c32;--memo-green:#21634e;--memo-paper:#f4f6ef;--memo-line:#dce3d6}
html:has(body.memo-page){scrollbar-gutter:stable}
.memo-page{margin:0;background:var(--memo-paper);color:#243c32;font:15px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}
.memo-page *{box-sizing:border-box}.memo-page a{color:var(--memo-green)}.memo-page button,.memo-page input,.memo-page select,.memo-page textarea{font:inherit}
.memo-page button{border:1px solid #c4d2c6;border-radius:9px;background:#fff;color:var(--memo-ink);padding:9px 13px;min-height:44px;cursor:pointer}
.memo-page button:disabled{opacity:.55;cursor:wait}.memo-page button.primary{background:var(--memo-green);color:#fff;border-color:var(--memo-green)}.memo-page button.danger{color:#9d3731}
.memo-page input:not([type=checkbox]),.memo-page select,.memo-page textarea{border:1px solid #c4d2c6;border-radius:8px;background:#fff;color:#243c32;padding:10px;min-height:44px;max-width:100%}
.memo-page :focus-visible{outline:3px solid #d99726;outline-offset:2px}.memo-page [hidden]{display:none!important}
.memo-header{display:flex;align-items:center;justify-content:space-between;gap:12px;max-width:1280px;margin:auto;padding:15px 24px;border-bottom:1px solid var(--memo-line)}
.memo-header strong{font-size:17px}.memo-header a{text-decoration:none}.memo-header button{font-size:13px}
.memo-layout{display:grid;grid-template-columns:320px minmax(0,1fr);gap:22px;max-width:1280px;margin:22px auto;padding:0 24px}
.memo-library,.memo-editor{min-width:0}.memo-library-top{display:flex;align-items:center;justify-content:space-between;gap:10px}.memo-page h1{font-size:24px;margin:0 0 14px}.memo-page h2{font-size:16px;margin:0 0 10px}.memo-page h3{font-size:13px;margin:8px 0}
#search{width:100%;margin-top:8px}.memo-filter,.memo-properties{display:flex;gap:12px;align-items:center;margin:12px 0}.memo-filter>label:first-child{flex:1}.memo-page label{font-size:12px}.memo-page label select{display:block;width:100%;font-size:14px}
.checkbox{display:flex;align-items:center;gap:6px}.checkbox input{accent-color:var(--memo-green);width:17px;height:17px}.memo-list{display:grid;gap:8px;max-height:50vh;overflow:auto}
.memo-note{text-align:left!important;width:100%;padding:12px!important}.memo-note strong,.memo-note span,.memo-note small{display:block;overflow-wrap:anywhere}.memo-note strong{font-size:15px}.memo-note span{font-size:12px;color:#657268;white-space:pre-wrap}.memo-note small{font-size:11px;color:#657268}.memo-note[aria-current=true]{border:2px solid var(--memo-green)}
.memo-editor{background:#fff;border:1px solid var(--memo-line);border-radius:14px;padding:22px}.memo-editor-top{display:flex;gap:12px;align-items:center}#title{flex:1;min-width:0;font-size:20px;border-color:transparent;padding-left:0;font-weight:650}#save-status{font-size:12px;white-space:nowrap;color:#657268}
.memo-properties>label{flex:1;min-width:0}#body{display:block;width:100%;min-height:380px;resize:vertical;line-height:1.85;padding:14px;white-space:pre-wrap}
.memo-editor-bottom{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-top:9px;font-size:12px}.memo-page small{color:#6b776c;font-size:11px}.memo-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:17px}#message{font-size:13px;margin-bottom:0;white-space:pre-wrap;overflow-wrap:anywhere}
.memo-backups{margin-top:20px;font-size:12px}.memo-backups summary{cursor:pointer;font-weight:650}.memo-backups a,.memo-backups small{display:block;margin-top:9px}
.memo-drafts{padding:13px;border:1px solid #dfc58d;background:#fff8e9;border-radius:10px;margin:12px 0}.memo-drafts button{display:block;width:100%;margin:5px 0;text-align:left;font-size:12px}
.memo-conflict,.memo-history{margin-top:18px;padding:16px;border:1px solid #dfc58d;border-radius:10px;background:#fff9ee;font-size:13px}.memo-compare{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.memo-page pre{white-space:pre-wrap;overflow-wrap:anywhere;font-family:inherit;font-size:13px;line-height:1.7;max-height:260px;overflow:auto;background:#fff;padding:10px;border:1px solid var(--memo-line);border-radius:6px}
#history-list{display:flex;flex-wrap:wrap;gap:7px}.memo-entry-link{display:inline-block;margin:8px 14px;padding:7px 12px;border:1px solid #c4d2c6;border-radius:20px;color:#21634e;background:#fff;text-decoration:none;font:14px system-ui}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.memo-backup-notice{display:block;padding:8px 14px;max-width:100%;font:12px/1.6 system-ui;color:#536758;overflow-wrap:anywhere}
.memo-confirm{box-sizing:border-box;width:min(460px,calc(100% - 32px));max-height:calc(100% - 32px);overflow:auto;padding:22px;border:1px solid #cdd6ca;border-radius:14px;background:#fff;color:#253e32;font:16px/1.7 system-ui;box-shadow:0 14px 60px #122b2940}.memo-confirm::backdrop{background:#152d2b66}.memo-confirm p{margin:0 0 20px;white-space:pre-wrap;overflow-wrap:anywhere}.memo-confirm-actions{display:flex;gap:10px;flex-wrap:wrap}.memo-confirm button{min-height:44px;flex:1;padding:9px 14px;border:1px solid #cdd6ca;border-radius:8px;background:#fff;color:#253e32;font:15px system-ui;cursor:pointer}.memo-confirm button.primary{background:#21634e;color:#fff;border-color:#21634e}.memo-confirm button:focus-visible{outline:3px solid #69a48c;outline-offset:3px}
@media(max-width:760px){.memo-header{padding:12px 14px;gap:8px}.memo-header strong{font-size:15px}.memo-header a{font-size:13px}.memo-layout{display:block;margin:16px auto;padding:0 14px}.memo-library{margin-bottom:16px}.memo-library-top h1{font-size:21px}.memo-list{max-height:220px}.memo-editor{padding:15px;border-radius:11px}#title{font-size:18px}.memo-editor-top{align-items:flex-start;flex-direction:column;gap:3px}#title{width:100%}#body{min-height:340px;font-size:16px}.memo-properties{gap:9px}.memo-editor-bottom{align-items:flex-start;flex-direction:column}.memo-actions button{flex:1;min-width:120px}.memo-compare{grid-template-columns:1fr}.memo-page input:not([type=checkbox]),.memo-page select{font-size:16px}}

.memo-view-tabs{display:flex;gap:8px;margin:6px 0 12px}.memo-view-tabs button{flex:1}.memo-view-tabs [aria-pressed=true]{background:#e4efe4;border-color:var(--memo-green);font-weight:650}
.memo-calendar{background:#fff;border:1px solid var(--memo-line);border-radius:12px;padding:12px;margin-bottom:12px}.calendar-top{display:flex;justify-content:space-between;align-items:center}.calendar-week,.calendar-days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}.calendar-week{text-align:center;font-size:11px;color:#69776d;margin:10px 0 3px}.calendar-days button{position:relative;padding:5px 0;min-width:0;min-height:44px;border:0;font-size:13px;border-radius:8px}.calendar-days .has-entry{background:#edf4e9;font-weight:650}.calendar-days small{display:block;font-size:9px;line-height:1.1;color:#42644d}.calendar-days [aria-pressed=true]{background:var(--memo-green);color:#fff}.calendar-days [aria-pressed=true] small{color:#fff}.calendar-days .is-today{box-shadow:inset 0 0 0 1px #c99740}.calendar-tools{display:flex;gap:6px;margin-top:9px}.calendar-tools button{font-size:12px;flex:1}.calendar-caption{font-size:12px;color:#5c7164;margin:8px 0 0}.diary-articles .memo-note{border-left:3px solid #b2cbb4;padding:15px!important}.diary-articles .memo-note strong{font-size:16px;margin-bottom:6px}.diary-articles .memo-note span{line-height:1.8;font-size:13px}.memo-related-filter{padding:10px;background:#eaf2e8;border-radius:9px;margin:8px 0}.memo-related-filter strong{display:block;font-size:13px}.memo-related-filter button{font-size:11px;margin-top:7px}.memo-game-picker{border:1px solid var(--memo-line);border-radius:9px;padding:10px 12px;margin:10px 0 16px}.memo-game-picker summary{cursor:pointer;font-size:13px;color:var(--memo-green);overflow-wrap:anywhere}.memo-game-picker label{display:block;margin:9px 0 4px}.memo-game-picker input,.memo-game-picker select{width:100%}.memo-game-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:10px}.memo-game-tools button,.memo-game-tools a{font-size:12px}.game-candidates button{display:block;width:100%;text-align:left;margin:6px 0}#game-dialog label{display:block;font-size:13px}#game-name{box-sizing:border-box;max-width:100%;width:100%;font:inherit;min-height:44px;padding:9px;border:1px solid #cdd6ca;border-radius:8px}#game-create-status{font-size:13px;white-space:pre-wrap}#diary-date-label small{display:block}#diary-date{width:100%}
@media(max-width:760px){.memo-calendar{max-width:420px;margin-left:auto;margin-right:auto}.calendar-days button{min-height:44px}.memo-game-tools button{flex:1}.memo-view-tabs button{font-size:14px}.diary-articles{max-height:340px}.memo-properties{flex-wrap:wrap}.memo-properties>label{min-width:120px}}

/* iOS only: preserve a 16px editing font and zoom, while fitting more lines. */
@media(max-width:760px){
  html:has(body.memo-ios){scrollbar-gutter:auto}
  .memo-ios #body{min-height:420px;min-height:max(420px,58svh);font-size:16px;line-height:1.45;padding:10px}
  .memo-ios.memo-writing .memo-editor{position:fixed;z-index:20;top:var(--memo-writing-top,0px);left:var(--memo-writing-left,0px);width:var(--memo-writing-width,100%);height:var(--memo-writing-height,100svh);border-radius:0;padding:8px 10px;display:flex;flex-direction:column;overflow:hidden}
  .memo-ios.memo-writing #editor{display:flex;flex-direction:column;flex:1;min-height:0}
  .memo-ios.memo-writing .memo-editor-top{flex:0 0 auto;margin-bottom:4px}
  .memo-ios.memo-writing #title,.memo-ios.memo-writing .memo-properties,.memo-ios.memo-writing .memo-game-picker,.memo-ios.memo-writing .memo-editor-bottom,.memo-ios.memo-writing #editor>small,.memo-ios.memo-writing #history-toggle,.memo-ios.memo-writing #trash{display:none}
  .memo-ios.memo-writing #body{flex:1;min-height:0;resize:none;overflow:auto}
  .memo-ios.memo-writing .memo-actions{flex:0 0 auto;flex-wrap:nowrap;gap:6px;margin-top:6px}
  .memo-ios.memo-writing .memo-actions button{min-width:0;min-height:44px;padding:8px 5px;font-size:13px}
  .memo-ios.memo-writing #message{flex:0 0 auto;max-height:72px;overflow:auto;margin:4px 0 0}
}
