

/* ============================================================
   Base styles
   Source: styles.css
   Integrated build: v90_unified_flow_memo
   ============================================================ */
/* Dark, calm, readable UI */
:root{
  --bg:#0f141b;
  --panel:#1b222c;
  --panel2:#151b23;
  --text:#e2ecf7;
  --muted:#8b96a6;
  --line:#2b3441;
  --accent:#66b3ff;
  --warn:#c7905b;
  --warn2:#d4b06a;
  --ok:#8bc26b;
  --shadow: 0 8px 22px rgba(0,0,0,.35);
  --radius: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:linear-gradient(180deg, #0f141b, #0c1016);
  color:var(--text);
}

.topbar{
  position:sticky;
  top:0;
  z-index:1000;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0;
  background:rgba(18,24,33,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 14px;
}

.brand{
  font-weight:700;
  letter-spacing:.2px;
  color:#e8eef7;
  opacity:.9;
}

.tabs{
  display:flex;
  gap:10px;
  align-items:stretch;
}

.tab{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width:70px;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  cursor:pointer;
}
.tab:hover{background:rgba(255,255,255,.04)}
.tab.is-active{
  border-color:rgba(85,170,255,.55);
  box-shadow:0 0 0 2px rgba(85,170,255,.18) inset;
}
.tab-label{font-size:13px; line-height:1.1}
.tab-count{font-size:12px; color:var(--muted); margin-top:3px}

.spacer{flex:1}

.auth-controls{
  display:flex;
  gap:8px;
  align-items:center;
}

/* default: hide logout until JS shows it (prevents "ログアウト"が2つ見える一瞬のチラつき) */
.auth-controls #btn_logout{display:none}

.search input{
  width:min(360px, 42vw);
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#0b0f14;
  color:var(--text);
  outline:none;
}
.search input:focus{
  border-color:rgba(85,170,255,.55);
  box-shadow:0 0 0 3px rgba(85,170,255,.18);
}

.container{
  padding:16px;
  max-width:1280px;
  margin:0 auto;
}

.view{display:block}
.view.is-hidden{display:none}

.quiz-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin:10px 0 14px;
}

.btn{
  appearance:none;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 14px;
  border-radius:14px;
  cursor:pointer;
  box-shadow:0 1px 0 rgba(255,255,255,.06) inset;
}
.btn:hover{background:rgba(255,255,255,.09)}
.btn:active{transform:translateY(1px)}
.btn-mini{padding:8px 12px; font-size:13px; border-radius:12px}

.btn-primary{background:rgba(85,170,255,.18); border-color:rgba(85,170,255,.35)}
.btn-warn{background:rgba(199,144,91,.22); border-color:rgba(199,144,91,.35)}
.btn-warn2{background:rgba(212,176,106,.2); border-color:rgba(212,176,106,.35)}
.btn-success{background:rgba(139,194,107,.2); border-color:rgba(139,194,107,.35)}

.card{
  background:linear-gradient(180deg, rgba(27,34,44,.98), rgba(21,27,35,.98));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.quiz-card{
  scroll-margin-top: calc(var(--chrome-h) + 10px);
  display:grid;
  grid-template-columns: 1.05fr .95fr;
  gap:0;
}
@media (max-width: 980px){
  .quiz-card{grid-template-columns: 1fr}
}

.quiz-left{
  padding:14px;
  border-right:1px solid var(--line);
}
@media (max-width: 980px){
  .quiz-left{border-right:none; border-bottom:1px solid var(--line)}
}

.quiz-head{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:10px;
}
.quiz-no{color:var(--muted); font-size:13px}

.quiz-item-title{
  font-size:20px;
  font-weight:800;
  color:#f3c987;
  letter-spacing:.2px;
  white-space: pre-line;
}
.quiz-question{
  margin: 0 0 10px;
  color: var(--text);
}
.quiz-question-line{
  margin: 0 0 5px;
  line-height: 1.58;
  white-space: pre-wrap;
  word-break: break-word;
}
.quiz-question-line:last-child{
  margin-bottom: 0;
}
.quiz-question-line.is-code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #f3c987;
}
.single-title{
  font-size:18px;
  font-weight:800;
  color:#f3c987;
  letter-spacing:.2px;
  margin-bottom:8px;
  white-space: pre-line;
}
.quiz-title{
  font-size:20px;
  font-weight:800;
  color:#f3c987;
  letter-spacing:.2px;
  white-space: pre-line;
}

.answer-input{
  width:100%;
  min-height:140px;
  resize:vertical;
  background:#06080b;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  color:var(--text);
  font-size:18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  outline:none;
}
.answer-input:focus{
  border-color:rgba(85,170,255,.55);
  box-shadow:0 0 0 3px rgba(85,170,255,.18);
}

.left-actions{
  display:flex;
  justify-content:flex-end;
  margin:10px 0 6px;
}

.reveal{
  margin:0;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#0b1017;
  color:#bfe3ff;
  font-size:16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.reveal.is-hidden{display:none}

.answer-reveal .reveal-block + .reveal-block{margin-top:12px}
.answer-reveal .code{font-size:15px}
.answer-reveal .reveal-output:empty{display:none}
.answer-reveal .reveal-output-block.is-hidden{display:none}

.quiz-right{
  padding:14px;
}
.explain-wrap{
  min-height:180px;
  border:2px dashed rgba(255,255,255,.12);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(0,0,0,.06);
}
.explain-body{
  margin-top:12px;
}
.explain-body.is-hidden{display:none}

/* When explanation is open, pack blocks upward (no wasted "show" box space). */
.quiz-card.is-explain-open .explain-body{margin-top:0}
.quiz-card.is-explain-open .explain-block{margin-top:8px; padding:10px}
.quiz-card.is-explain-open .explain-block:first-child{margin-top:0}

.explain-block{
  margin-top:10px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(0,0,0,.10);
}
.label{font-size:12px; color:var(--muted); margin-bottom:6px}
.text{white-space:pre-wrap; line-height:1.6}

.code{
  margin:0;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:#0b0f14;
  color:#e6edf7;
  font-size:14px;
  overflow:auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.memo-input{
  width:100%;
  min-height:80px;
  resize:vertical;
  background:#06080b;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  padding:10px 12px;
  color:var(--text);
  font-size:15px;
  outline:none;
}
.memo-input:focus{
  border-color:rgba(85,170,255,.55);
  box-shadow:0 0 0 3px rgba(85,170,255,.18);
}

.hint{margin-top:6px; font-size:12px; color:var(--muted)}

.quiz-nav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-top:14px;
}
.progress{color:var(--muted); font-size:13px}

.list-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:10px 0 12px;
}
.list-title{font-weight:800; font-size:16px; color:#e8eef7}

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.list-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  cursor:pointer;
}
.list-item:hover{background:rgba(255,255,255,.05)}
.list-item .left{
  display:flex;
  gap:10px;
  align-items:baseline;
}
.badge{color:var(--muted); font-size:12px}
.title{font-size:15px}
.state{font-size:12px; color:var(--muted)}

.single-list{display:flex; flex-direction:column; gap:10px}
.single-row{
  scroll-margin-top: calc(var(--chrome-h) + 10px);
  border-radius:14px;
  border:1px solid var(--line);
  overflow:hidden;
}
.single-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  background:rgba(255,255,255,.03);
  cursor:pointer;
}
.single-top:hover{background:rgba(255,255,255,.05)}
.single-answer{
  display:none;
  padding:12px 14px 14px;
  background:rgba(0,0,0,.12);
  border-top:1px solid rgba(255,255,255,.06);
}
.single-row.is-open .single-answer{display:block}

.memo-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:12px;
}
@media (max-width: 900px){
  .memo-grid{grid-template-columns:1fr}
}
.memo-card{
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  padding:14px;
  cursor:pointer;
}
.memo-card:hover{background:rgba(255,255,255,.05)}
.memo-card .memo-title{font-weight:800; color:#f3c987}
.memo-card .memo-text{margin-top:8px; color:var(--text); white-space:pre-wrap; line-height:1.5}
.memo-card .memo-meta{margin-top:8px; font-size:12px; color:var(--muted)}

.footnote{margin-top:16px}
.auth-info{font-size:12px; color:var(--muted)}


/* Scroll pages: more comfortable spacing */
.list .card{ margin-bottom:12px; }

/* Typing overlay: 1文字判定（白=一致 / 赤=不一致） */
.typing-wrap{ position: relative; }
.typing-overlay{
  position: absolute;
  inset: 0;
  margin: 0;
  pointer-events: none;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  font-size: 18px;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #ffffff;
  scrollbar-width: none;
}
.typing-overlay::-webkit-scrollbar{ width: 0; height: 0; }
.typing-overlay .bad{ color:#ff4d4d; }

/* textareaの文字は透明、カーソルだけ見せる */
.answer-input.typing-textarea{
  color: transparent !important;
  caret-color: rgba(255,255,255,.95);
}
.answer-input.typing-textarea::placeholder{ color: transparent; }

/* 正解トースト */
.typing-correct{
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(85,170,255,.18);
  border: 1px solid rgba(85,170,255,.35);
  font-weight: 800;
  letter-spacing: .2px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.typing-correct.is-show{ opacity: 1; transform: translateY(0); }

.btn-ok{background:rgba(139,194,107,.20); border-color:rgba(139,194,107,.35)}



/* ===== v5 overrides ===== */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

body{
  margin-top: 0 !important;
  padding-top: var(--header-h, 108px);
}

/* actionbar under tabs */
.actionbar{
  border-top: 1px solid rgba(255,255,255,.04);
  border-bottom: 1px solid var(--line);
  background: rgba(18,24,33,.92);
  backdrop-filter: blur(10px);
}
.actionbar-inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px;
  display:flex;
  gap:10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* tabs: higher visibility + equal width */
.topbar-inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px;
  width: 100%;
}
.tabs{
  flex: 1 1 auto;
}
.tab{
  flex: 1 1 0;
  min-width: 92px;
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.08);
}
.tab:hover{
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.14);
}
.tab.is-active{
  background: rgba(85,170,255,.12);
  border-color: rgba(85,170,255,.60);
  box-shadow: 0 0 0 2px rgba(85,170,255,.20) inset, 0 10px 18px rgba(0,0,0,.25);
}
.tab-label{ font-size: 14px; font-weight: 800; }
.tab-count{ font-size: 13px; font-weight: 800; color: rgba(226,236,247,.78); }

/* search: narrower */
.search{ width: 180px; }
.search input{ width: 100%; }

/* correct toast: centered + bigger */
.typing-correct{
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%,-50%) scale(.98);
  padding: 14px 18px;
  font-size: 26px;
  letter-spacing: .6px;
  background: rgba(61,220,132,.18);
  border: 1px solid rgba(61,220,132,.45);
  color: rgba(226,255,241,.95);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.typing-correct.is-show{
  opacity: 1;
  transform: translate(-50%,-50%) scale(1);
}

/* ===== v6 fixes: keep nav + action buttons always visible and place actionbar under nav ===== */
:root{
  --topbar-h: 72px;
  --actionbar-h: 56px;
  --chrome-h: 128px;
}

.topbar{
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 3000 !important;
}

.actionbar{
  position: fixed !important;
  top: var(--topbar-h) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 2500 !important;
}

body{
  padding-top: var(--chrome-h) !important;
}


/* ===== TOC (table/list) ===== */
.toc-table{ display:block; }
.toc-wrap{
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}
.toc-head-row{
  display:grid;
  grid-template-columns: 90px 1fr 280px 90px;
  gap: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.toc-row{
  display:grid;
  grid-template-columns: 90px 1fr 280px 90px;
  gap: 10px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}
.toc-row:hover{ background: rgba(255,255,255,0.03); }
.toc-row:last-child{ border-bottom: none; }
.toc-col-no{ display:flex; align-items:center; }
.toc-col-title{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.toc-col-answer{ min-width:0; overflow:hidden; }
.toc-code{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.toc-col-status{ display:flex; align-items:center; justify-content:flex-end; }

@media (max-width: 720px){
  .toc-head-row, .toc-row{
    grid-template-columns: 90px 1fr 90px;
  }
  .toc-col-answer{ display:none; }
}

/* ===== v7: Mobile/Tablet topbar horizontal scroll so login is reachable ===== */
@media (max-width: 1024px){
  /* Make the whole topbar content horizontally scrollable */
  .topbar-inner{
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .topbar-inner::-webkit-scrollbar{ display:none; }

  /* Prevent flex items from compressing weirdly; keep natural widths */
  .tabs{ flex: 0 0 auto; }
  .tab{ flex: 0 0 auto; }
  .search{ flex: 0 0 auto; }
  .auth-controls{ flex: 0 0 auto; }

  /* Optional: reduce minimum tab width a bit to require less scrolling */
  .tab{ min-width: 84px; }

  /* Avoid accidental page-level horizontal scrolling */
  body{ overflow-x: hidden; }
}


/* Auth / Sync labels */
.user-label, .sync-label{font-size:12px; opacity:.85; margin-right:10px; white-space:nowrap;}
@media (max-width: 820px){.user-label, .sync-label{font-size:11px; margin-right:8px;}}



/* ===== Patch: overlay typing diff (red per wrong char) + correct badge ===== */
.is-hidden{display:none !important;}

.type-wrap{
  position:relative;
  background:#06080b;
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
}

.typing-layer{
  position:absolute;
  inset:12px;
  margin:0;
  pointer-events:none;
  white-space:pre-wrap;
  word-break:break-word;
  font-size:18px;
  line-height:1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.typing-layer .ok{color:var(--text);}
.typing-layer .bad{color:#ff4d4d;}

.answer-input.is-overlay{
  position:relative;
  background:transparent;
  border:none;
  color:transparent; /* show typed text via .typing-layer */
  caret-color:var(--text);
  line-height:1.55;
}
.answer-input.is-overlay::placeholder{
  color:rgba(226,236,247,.35);
}

/* move focus ring to wrapper */
.type-wrap.is-focus{
  border-color:rgba(85,170,255,.55);
  box-shadow:0 0 0 3px rgba(85,170,255,.18);
}

/* Correct badge: hidden by default, centered, large */
.correct-badge{
  display:none;
  position:absolute;
  inset:0;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size:28px;
  letter-spacing:.5px;
  color:var(--ok);
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
  background: radial-gradient(circle at center, rgba(0,0,0,.28), rgba(0,0,0,0));
  pointer-events:none;
}
.type-wrap.is-correct .correct-badge{display:flex;}

/* ===== Patch: single (need-only) page answer reveal ===== */
.single-card{
  display:grid;
  grid-template-columns: 1.05fr .95fr;
}
@media (max-width: 980px){
  .single-card{grid-template-columns: 1fr}
}

.single-left{
  padding:14px;
  border-right:1px solid var(--line);
}
@media (max-width: 980px){
  .single-left{border-right:none; border-bottom:1px solid var(--line)}
}

.single-meta{color:var(--muted); font-size:13px; margin-bottom:6px;}
.single-question{
  font-size:15px;
  font-weight:600;
  color:var(--text);
  letter-spacing:.1px;
  line-height:1.55;
}

.single-right{padding:14px;}
.answer-panel{
  min-height:140px;
  border:2px dashed rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(0,0,0,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.answer-panel:hover{background:rgba(0,0,0,.09);}
.answer-panel .single-answer{
  display:none;
  width:100%;
  margin:0;
  padding:14px;
  border-radius:14px;
  background:rgba(0,0,0,.10);
  color:#bfe3ff;
  font-size:18px;
  line-height:1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space:pre-wrap;
  word-break:break-word;
}
.answer-panel.is-revealed{
  border-style:solid;
  border-color:rgba(102,179,255,.35);
}
.answer-panel.is-revealed .single-answer{display:block;}

.single-answer-wrap{
  display:none;
  width:100%;
}
.answer-panel.is-revealed .single-answer-wrap{display:block;}
.single-block + .single-block{margin-top:12px;}
.single-output:empty{display:none;}
.single-output-block:has(.single-output:empty){display:none;}

/* ===== Patch: compact topbar height a bit ===== */
.topbar-inner{padding:8px 14px;}
.tab{padding:7px 10px;}



/* ===== TOC problem list ===== */
.toc-problem-list{display:flex; flex-direction:column; gap:8px;}
.toc-problem-row{
  display:flex;
  gap:10px;
  align-items:baseline;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  cursor:pointer;
}
.toc-problem-row:hover{background:rgba(255,255,255,.05)}
.toc-problem-no{width:72px; color:var(--muted); font-size:12px;}
.toc-problem-title{font-size:14px; font-weight:700; white-space: pre-line;}


.toc-page .container{padding-top:6px;}

.answer-panel-hint{display:none;}


/* ===== Patch v26: TOC spacing + prevent logout/button vertical wrapping ===== */
body.toc-page{
  padding-top: var(--topbar-h) !important; /* toc has no actionbar */
}

.auth-controls, .auth-controls *{
  white-space: nowrap;
  word-break: keep-all;
}

.tab{
  text-decoration: none;
}
/* ===== v35_clean: overlay scroll sync + last-line visibility + focus ring off ===== */
.type-wrap .answer-input.is-overlay{
  padding-bottom: 56px; /* 最下行が半分隠れるのを防ぐ */
}
.type-wrap .typing-layer{
  padding-bottom: 56px;
  will-change: transform;
  transform: translate3d(0,0,0);
}
/* フォーカス時の“オレンジ枠”を出さない（UA outline対策） */
.explain-wrap:focus,
.explain-wrap:focus-visible,
.answer-panel:focus,
.answer-panel:focus-visible{
  outline: none;
  box-shadow: none;
}


.single-question .quiz-question-line{
  margin-bottom: 5px;
  line-height: 1.55;
}
.single-question .quiz-question-line.is-code{
  color:#f3c987;
}


/* ===== line-by-line checks ===== */
.type-wrap{
  position: relative;
}

.type-wrap .answer-input.is-overlay{
  padding-right: 54px;
}

.type-wrap .typing-layer{
  right: 42px;
}

.line-checks{
  position:absolute;
  top:12px;
  right:10px;
  width:28px;
  pointer-events:none;
  will-change: transform;
}

.line-check{
  height: 27.9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-svg{
  width: 20px;
  height: 20px;
  opacity: 0;
  transition: opacity .1s ease;
}

/* 正解行の文字スライドイン */
@keyframes line-slide-in{
  0%  { opacity:.4; transform:translateX(-5px); }
  100%{ opacity:1;  transform:translateX(0); }
}

.diff-line{
  display: block;
  white-space: inherit;
}

.diff-line.is-line-done{
  color: var(--ok);
  animation: line-slide-in .28s ease-out forwards;
}

.check-bg{
  fill: var(--ok);
  opacity: .15;
}

.check-mark{
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
}

@keyframes check-draw{
  to{ stroke-dashoffset: 0; }
}

.line-check.is-done .check-svg{
  opacity: 1;
}

.line-check.is-done .check-mark{
  animation: check-draw .25s ease-out forwards;
}


/* ===== syntax block: compact spacing ===== */
.answer-reveal .reveal-syntax-code,
.answer-panel .single-syntax{
  white-space: pre-wrap;
  line-height: 1.38;
}

.answer-reveal .reveal-syntax-block,
.answer-panel .single-syntax-block{
  margin-bottom: 8px;
}


/* ===== v30: 5-stage learning chapters ===== */
:root{
  --actionbar-h: 118px;
  --chrome-h: calc(var(--topbar-h) + var(--actionbar-h));
}

.actionbar{
  display:flex;
  flex-direction:column;
}

.stagebar-inner{
  max-width:1280px;
  width:100%;
  margin:0 auto;
  padding:8px 16px 4px;
  display:flex;
  gap:8px;
  align-items:center;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.stagebar-inner::-webkit-scrollbar{display:none;}

.chapter-tab{
  flex:0 0 auto;
  appearance:none;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.045);
  color:var(--text);
  padding:8px 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.chapter-tab:hover{
  background:rgba(255,255,255,.075);
  border-color:rgba(255,255,255,.18);
}
.chapter-tab.is-active{
  background:rgba(102,179,255,.18);
  border-color:rgba(102,179,255,.55);
  box-shadow:0 0 0 2px rgba(102,179,255,.16) inset;
}

.chapter-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin: 0 0 14px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:rgba(255,255,255,.035);
}
.chapter-title{
  font-size:18px;
  font-weight:900;
  color:#f3c987;
}
.chapter-subtitle,
.sub-title{
  margin-top:4px;
  font-size:13px;
  line-height:1.55;
  color:var(--muted);
}
.chapter-toc-link{
  flex:0 0 auto;
  text-decoration:none;
}

.chip-stage{
  color:#bfe3ff;
  border:1px solid rgba(102,179,255,.28);
  background:rgba(102,179,255,.11);
}

.toc-overview-card{
  margin-top:14px;
  padding:14px;
}
.toc-overview-title{
  font-weight:900;
  font-size:18px;
  color:#f3c987;
}
.toc-overview-text{
  margin-top:4px;
  color:var(--muted);
  font-size:13px;
  line-height:1.55;
}
.toc-stage-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:12px;
}
.toc-all-card,
.toc-stage-card{
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(255,255,255,.03);
  overflow:hidden;
}
.toc-all-card{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px;
}
.toc-stage-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:14px;
  border-bottom:1px solid rgba(255,255,255,.07);
}
.toc-stage-title{
  font-size:16px;
  font-weight:900;
  color:#f3c987;
}
.toc-stage-summary{
  margin-top:4px;
  font-size:12px;
  line-height:1.55;
  color:var(--muted);
}
.toc-stage-problems{
  display:flex;
  flex-direction:column;
  gap:0;
  padding:8px;
}
.toc-stage-problems .toc-problem-row{
  border-color:transparent;
  background:transparent;
}
.toc-stage-problems .toc-problem-row:hover{
  background:rgba(255,255,255,.05);
}
.toc-stage-mini{
  display:inline-block;
  margin-right:8px;
  padding:2px 7px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  color:#bfe3ff;
  border:1px solid rgba(102,179,255,.25);
  background:rgba(102,179,255,.10);
}

@media (max-width: 720px){
  :root{
    --actionbar-h: 128px;
  }
  .stagebar-inner{
    padding-left:12px;
    padding-right:12px;
  }
  .chapter-head,
  .toc-stage-head,
  .toc-all-card{
    flex-direction:column;
    align-items:stretch;
  }
  .chapter-toc-link,
  .toc-stage-head .btn,
  .toc-all-card .btn{
    text-align:center;
  }
}


/* ===== v37/v38: question line color =====
   白: 入力対象の指示文、または answer に含まれるコード行
   オレンジ: 入力しない前提コード
*/
.quiz-question-line.is-input-line{
  color: var(--text);
}
.quiz-question-line.is-input-line.is-code-like{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.quiz-question-line.is-premise-line{
  color: #f3c987;
}
.quiz-question-line.is-premise-line.is-code-like{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}


/* ===== v40_sheet_format: spreadsheet-like question layout ===== */
.quiz-card.sheet-card{
  display:block;
  overflow:hidden;
  padding:0;
  scroll-margin-top: calc(var(--chrome-h) + 12px);
}
.quiz-card.sheet-card.is-active{
  border-color: rgba(102,179,255,.65);
  box-shadow: 0 0 0 2px rgba(102,179,255,.20) inset, var(--shadow);
}
.sheet-table-scroll{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.sheet-table{
  width:100%;
  min-width: 1200px;
  border-collapse: collapse;
  table-layout: fixed;
  background: rgba(255,255,255,.015);
}
.sheet-table th,
.sheet-table td{
  border:1px solid rgba(255,255,255,.16);
  vertical-align:top;
}
.sheet-table th{
  padding:8px 10px;
  background: rgba(255,255,255,.075);
  color: rgba(226,236,247,.78);
  font-size:12px;
  font-weight:900;
  text-align:left;
  letter-spacing:.02em;
}
.sheet-head-no{width:110px;}
.sheet-no-cell{width:92px; min-width:92px;}
.sheet-problem-cell{width:auto;}
.sheet-input-cell{width:560px;}
.sheet-no-cell{
  padding:10px;
  background: rgba(255,255,255,.035);
}
.sheet-no{
  color:#f3c987;
  font-weight:900;
  font-size:14px;
  margin-bottom:6px;
}
.sheet-title{
  color:#e8eef7;
  font-weight:900;
  font-size:13px;
  line-height:1.28;
  margin-bottom:10px;
  word-break:break-word;
}
.sheet-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.sheet-problem-cell{
  padding:10px 12px;
  line-height:1.55;
  font-size:15px;
  white-space:normal;
  word-break:break-word;
  background: rgba(0,0,0,.045);
}
.sheet-problem-item + .sheet-problem-item{
  margin-top:5px;
  padding-top:5px;
  border-top:1px dashed rgba(255,255,255,.10);
}
.sheet-problem-item.is-premise + .sheet-problem-item{
  margin-top:10px;
}
.sheet-problem-target{
  color:#f3c987;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space:pre-wrap;
}
.sheet-problem-line{
  color: var(--text);
  white-space:normal;
}
.sheet-problem-prompt{
  color: var(--text);
  margin-top:2px;
  white-space:normal;
}
.sheet-input-cell{
  padding:10px;
  background: rgba(0,0,0,.13);
}
.sheet-input-label{display:none;}
.sheet-type-wrap{
  min-height: 180px;
}
.sheet-type-wrap .answer-input{
  min-height: 180px;
  resize: vertical;
}
.sheet-actions{
  justify-content:stretch;
  gap:8px;
  margin:10px 0 0;
}
.sheet-actions .btn{
  flex:1 1 0;
}
.sheet-result{
  margin:0;
  padding:12px;
  border-radius:0;
  border:none;
  border-top:1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.10);
  color: var(--text);
}
.sheet-result-note{
  display:inline-block;
  margin-bottom:8px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(139,194,107,.35);
  background:rgba(139,194,107,.12);
  color:rgba(226,255,241,.95);
  font-size:12px;
  font-weight:900;
}
.sheet-result-grid{
  display:grid;
  grid-template-columns: 128px minmax(0,1fr);
  border-top:1px solid rgba(255,255,255,.16);
  border-left:1px solid rgba(255,255,255,.16);
}
.sheet-result-grid + .sheet-result-grid{
  margin-top:10px;
}
.sheet-result-label,
.sheet-result-grid > .code,
.sheet-result-grid > .text,
.sheet-result-grid > div:not(.sheet-result-label){
  border-right:1px solid rgba(255,255,255,.16);
  border-bottom:1px solid rgba(255,255,255,.16);
}
.sheet-result-label{
  padding:10px;
  background: rgba(255,255,255,.055);
  color:rgba(226,236,247,.82);
  font-size:13px;
  font-weight:900;
}
.sheet-result-grid > .code,
.sheet-result-grid > .text,
.sheet-result-grid > div:not(.sheet-result-label){
  margin:0;
  border-radius:0;
  min-height: 42px;
}
.sheet-result-grid > .text{
  padding:10px 12px;
  background:#0b0f14;
  line-height:1.6;
  white-space:pre-wrap;
}
.sheet-result-grid .memo-input{
  min-height:72px;
  border:none;
  border-radius:0;
  background:#06080b;
}
.sheet-explain-body{
  margin-top:10px;
}
.sheet-card .reveal-output-block.is-hidden,
.sheet-card .reveal-syntax-block.is-hidden{
  display:none !important;
}

@media (max-width: 720px){
  .sheet-table{min-width:900px;}
  .sheet-head-no{width:92px;}
  .sheet-input-cell{width:380px;}
  .sheet-result-grid{grid-template-columns: 96px minmax(0,1fr);}
  .sheet-problem-cell{font-size:14px;}
}

/* Single-question sheet answer cell */
.sheet-single-card .answer-panel{
  min-height: 180px;
  width:100%;
  padding:10px;
  border:1px dashed rgba(255,255,255,.20);
  border-radius:14px;
  background:rgba(0,0,0,.08);
  align-items:flex-start;
  justify-content:flex-start;
}
.sheet-single-card .answer-panel:not(.is-revealed)::before{
  content:"ここをクリックすると解答を表示";
  color:rgba(226,236,247,.62);
  font-size:13px;
  font-weight:800;
  margin:auto;
}
.sheet-single-card .answer-panel.is-revealed::before{display:none;}
.sheet-single-card .answer-panel .single-answer-wrap{width:100%;}
.sheet-single-card .answer-panel .single-answer{
  padding:10px 12px;
}
.sheet-single-card .single-answer-label + .single-answer{
  display:none;
}
.sheet-single-card .answer-panel.is-revealed .single-answer-label + .single-answer{
  display:block;
}


/* ===== v42 compact 3-column problem cell fix ===== */
.sheet-table-3col .sheet-problem-cell{
  white-space: normal !important;
}
.sheet-table-3col .sheet-problem-target,
.sheet-table-3col .sheet-problem-prompt{
  white-space: pre-wrap;
}
.sheet-table-3col .sheet-problem-item + .sheet-problem-item{
  margin-top:5px;
  padding-top:5px;
}

/* ===== v43 no-wrap typing area + narrower title column ===== */
.type-wrap .answer-input.is-overlay,
.sheet-type-wrap .answer-input{
  white-space: pre !important;
  overflow-x: auto !important;
  overflow-y: auto;
  word-break: normal !important;
  overflow-wrap: normal !important;
}
.type-wrap .typing-layer{
  white-space: pre !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}
.sheet-no-cell{
  width:120px !important;
  min-width:120px !important;
}
.sheet-input-cell{
  width:560px !important;
}
.sheet-table{
  min-width:1180px !important;
}
@media (max-width: 720px){
  .sheet-no-cell{width:96px !important; min-width:96px !important;}
  .sheet-input-cell{width:460px !important;}
  .sheet-table{min-width:1040px !important;}
}


/* ===== v47: balanced answer column width =====
   v46 の 700px は広すぎて出題欄を圧迫しやすいため、
   長い with open(..., encoding="utf-8") as fh: 行を見やすく残しつつ、
   入力欄を少し短めに調整する。 */
@media (min-width: 721px){
  .sheet-table{
    min-width: 1190px !important;
  }
  .sheet-no-cell{
    width: 112px !important;
    min-width: 112px !important;
  }
  .sheet-input-cell{
    width: 650px !important;
  }
  .type-wrap .answer-input.is-overlay,
  .sheet-type-wrap .answer-input{
    padding-right: 38px !important;
  }
  .type-wrap .typing-layer{
    right: 32px !important;
  }
  .line-checks{
    right: 6px !important;
    width: 22px !important;
  }
}


/* ===== v51: mobile/tablet stacked sheet layout =====
   スマホ・タブレットでは表を横スクロールさせず、
   No/出題/入力を縦に積む。これにより「やり直す」「解答と解説を表示」も
   左右スライドなしで常に入力欄の直下に出る。 */
@media (max-width: 1240px){
  .sheet-table-scroll{
    overflow-x: visible !important;
  }

  .sheet-table,
  .sheet-table tbody,
  .sheet-table tr,
  .sheet-table td{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
  }

  .sheet-table{
    min-width:0 !important;
    table-layout:auto !important;
    border-collapse:separate !important;
    border-spacing:0 !important;
  }

  .sheet-table td{
    border-left:none !important;
    border-right:none !important;
  }

  .sheet-table tr > td:first-child{
    border-top:none !important;
  }

  .sheet-no-cell{
    padding:10px 12px !important;
    border-bottom:1px solid rgba(255,255,255,.12) !important;
  }

  .sheet-problem-cell{
    padding:10px 12px !important;
    border-top:none !important;
    border-bottom:1px solid rgba(255,255,255,.12) !important;
    font-size:15px !important;
  }

  .sheet-input-cell{
    padding:10px 12px 12px !important;
    border-top:none !important;
  }

  .sheet-type-wrap{
    min-height:170px !important;
  }

  .sheet-type-wrap .answer-input{
    min-height:170px !important;
    font-size:16px !important;
  }

  .type-wrap .answer-input.is-overlay,
  .sheet-type-wrap .answer-input{
    padding-right:38px !important;
  }

  .type-wrap .typing-layer{
    right:32px !important;
    font-size:16px !important;
  }

  .line-checks{
    right:6px !important;
    width:22px !important;
  }

  .sheet-actions{
    display:flex !important;
    width:100% !important;
    gap:8px !important;
    margin-top:10px !important;
  }

  .sheet-actions .btn{
    flex:1 1 0 !important;
    min-height:42px !important;
  }

  .sheet-single-card .answer-panel{
    min-height:150px !important;
  }
}

@media (max-width: 560px){
  .sheet-actions{
    flex-direction:column !important;
  }
  .sheet-actions .btn{
    width:100% !important;
  }
  .sheet-type-wrap,
  .sheet-type-wrap .answer-input{
    min-height:150px !important;
  }
}


/* ===== v54_toc_readability: TOC readability =====
   目次の問題リンクがブラウザ標準の青リンク色になるのを防ぎ、
   ダーク背景でも読みやすい白系に統一する。
*/
.toc-page .toc-stage-list a,
.toc-page .toc-problem-row,
.toc-page .toc-problem-row:visited,
.toc-page .toc-problem-row:link{
  color: var(--text);
  text-decoration: none;
}

.toc-page .toc-problem-row .title{
  color: #e8eef7;
  font-weight: 800;
}

.toc-page .toc-problem-row:hover .title{
  color: #ffffff;
}

.toc-page .toc-problem-row .badge,
.toc-page .toc-problem-row .state{
  color: var(--muted);
}

.toc-page .toc-stage-mini{
  color: rgba(226,236,247,.86);
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.045);
}

.toc-page .toc-stage-head .btn,
.toc-page .toc-all-card .btn{
  color: var(--text);
  text-decoration: none;
}

/* ===== v58_line_done_static_color: 1行正解時はアニメーションなし・青緑色で固定 =====
   行が正解になったとき、スライドやチェック描画アニメーションを出さず、
   正解済みの入力文字だけを落ち着いた青緑にする。
*/
:root{
  --line-ok-static:#6ee7c8;
}

.diff-line.is-line-done,
.diff-line.is-line-done .ok{
  color:var(--line-ok-static) !important;
  animation:none !important;
  transform:none !important;
  opacity:1 !important;
}

.diff-line.is-line-done *{
  animation:none !important;
  transition:none !important;
}

.check-svg{
  transition:none !important;
}

.line-check.is-done .check-svg{
  opacity:1 !important;
}

.line-check.is-done .check-mark{
  animation:none !important;
  stroke-dashoffset:0 !important;
}

/* ===== v59: caret / overlay alignment =====
   textarea の本物のカーソル位置と、下に敷いている判定表示レイヤーの
   padding・行高・タブ幅を揃える。カーソルずれ対策。 */
.type-wrap{
  position:relative !important;
}

.type-wrap .answer-input.is-overlay,
.type-wrap .typing-layer{
  box-sizing:border-box !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  line-height:1.55 !important;
  letter-spacing:0 !important;
  tab-size:4 !important;
  -moz-tab-size:4 !important;
  white-space:pre !important;
  word-break:normal !important;
  overflow-wrap:normal !important;
}

.type-wrap .answer-input.is-overlay{
  position:relative !important;
  z-index:2 !important;
  margin:0 !important;
  padding:12px 38px 56px 12px !important;
  overflow:auto !important;
  background:transparent !important;
  border:none !important;
  color:transparent !important;
  -webkit-text-fill-color:transparent !important;
  caret-color:rgba(226,236,247,.96) !important;
}

.type-wrap .typing-layer{
  position:absolute !important;
  z-index:1 !important;
  inset:0 !important;
  margin:0 !important;
  padding:12px 38px 56px 12px !important;
  overflow:hidden !important;
  pointer-events:none !important;
}

.line-checks{
  z-index:3 !important;
}

@media (min-width:721px){
  .type-wrap .answer-input.is-overlay,
  .type-wrap .typing-layer{
    padding-right:38px !important;
  }
}

@media (max-width:720px){
  .type-wrap .answer-input.is-overlay,
  .type-wrap .typing-layer{
    padding-right:38px !important;
  }
}

/* ===== v60: empty answer-line caret alignment =====
   空行の <span class="diff-line"> が高さ0に潰れると、
   判定表示レイヤーだけ1行上に詰まり、textarea の本物のカーソルとズレる。
   空行にも1行分の高さを持たせて、カーソル位置と表示位置を揃える。 */
.type-wrap .typing-layer .diff-line{
  min-height:1.55em !important;
  line-height:1.55 !important;
}

.type-wrap .typing-layer .diff-line:empty::before{
  content:"\00a0";
  opacity:0;
}

/* ===== v61: overlay re-render + blank-line visibility fix =====
   入力行の表示レイヤーを毎回再描画しても、空行・現在行の高さが必ず揃うようにする。
   透明 textarea のカーソルと、色付き表示レイヤーの行位置ずれを抑える。 */
.type-wrap .typing-layer{
  color: var(--text) !important;
  background: transparent !important;
}

.type-wrap .typing-layer .diff-line{
  display:block !important;
  height:1.55em !important;
  min-height:1.55em !important;
  line-height:1.55 !important;
  white-space:pre !important;
}

.type-wrap .typing-layer .empty-line-spacer{
  opacity:0 !important;
}

.type-wrap .typing-layer .diff-line:empty::before{
  content:"\00a0";
  opacity:0;
}

/* ===== v62: overlay scroll clipping fix =====
   The typing overlay is translated upward/downward to match the textarea scroll.
   If the overlay itself has overflow:hidden, lines below the first visible box
   are clipped before the transform, so lower lines such as print(fn1()) cannot
   appear even though the textarea value is correct. Keep the parent as the
   viewport, but let the overlay content overflow inside it. */
.type-wrap{
  overflow:hidden !important;
}
.type-wrap .typing-layer{
  overflow:visible !important;
  contain:none !important;
}

/* ===== v63: rich memo editor ===== */
.memo-input{
  min-height: 96px;
}
.memo-input::after{content:""}
.memo-hint::before{
  content:"ダブルクリックでメモエディタ";
  color:var(--muted);
}
.memo-hint:not(:empty)::before{content:""}
.memo-editor-modal.is-hidden{display:none}
.memo-editor-modal{
  position:fixed;
  inset:0;
  z-index:99998;
}
.memo-editor-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(4px);
}
.memo-editor-dialog{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(960px,94vw);
  height:min(760px,88vh);
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg,rgba(27,34,44,.98),rgba(21,27,35,.98));
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
  overflow:hidden;
}
.memo-editor-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border-bottom:1px solid var(--line);
}
.memo-editor-title{font-size:16px;font-weight:900;color:#f3c987}
.memo-editor-sub{margin-top:4px;font-size:12px;color:var(--muted);line-height:1.45}
.memo-editor-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:10px 14px;
  border-bottom:1px solid var(--line);
  background:rgba(0,0,0,.08);
}
.memo-editor-search{
  flex:1 1 180px;
  min-width:160px;
  border:1px solid var(--line);
  background:#0b0f14;
  color:var(--text);
  border-radius:12px;
  padding:8px 10px;
  outline:none;
}
.memo-editor-lines{
  flex:1;
  overflow:auto;
  padding:12px 14px 18px;
  counter-reset:memo-line;
}
.memo-editor-line{
  counter-increment:memo-line;
  display:grid;
  grid-template-columns:52px 1fr;
  gap:10px;
  align-items:start;
  border:1px solid transparent;
  border-radius:12px;
  margin:3px 0;
}
.memo-editor-line:hover,
.memo-editor-line.is-selected{
  background:rgba(255,255,255,.045);
  border-color:rgba(255,255,255,.08);
}
.memo-editor-line.is-search-hit{
  border-color:rgba(212,176,106,.55);
  box-shadow:0 0 0 2px rgba(212,176,106,.14) inset;
}
.memo-editor-line.is-dragging{opacity:.55}
.memo-editor-line-no{
  user-select:none;
  cursor:grab;
  color:var(--muted);
  text-align:right;
  padding:9px 0;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.memo-editor-line-no::before{content:counter(memo-line)}

.memo-editor-line-main{
  min-width:0;
  border-left:1px solid rgba(255,255,255,.08);
}

.memo-editor-line-text{
  min-height:38px;
  padding:8px 10px;
  outline:none;
  white-space:pre-wrap;
  word-break:break-word;
  line-height:1.55;
}
.memo-editor-line-text:focus{
  background:rgba(102,179,255,.07);
  border-radius:10px;
}

.memo-editor-line-preview{display:none;padding:8px 10px;line-height:1.55;word-break:break-word;}
.memo-editor-line.has-preview:not(.is-editing) .memo-editor-line-text{display:none;}
.memo-editor-line.has-preview:not(.is-editing) .memo-editor-line-preview{display:block;}
.memo-editor-line.has-preview.is-editing .memo-editor-line-preview{display:block;opacity:.72;border-top:1px dashed rgba(255,255,255,.10);margin:4px 10px 0;padding:8px 0 0;}
.memo-editor-line-preview .memo-rich-image{max-width:520px;margin:4px 0;}
.memo-editor-line-preview .memo-rich-image img{max-height:260px;object-fit:contain;}

.memo-editor-foot{
  display:flex;
  justify-content:flex-end;
  padding:8px 14px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
}
.memo-rich-view{line-height:1.65;word-break:break-word}
.memo-rich-line{white-space:pre-wrap;margin:2px 0}
.memo-rich-line.is-empty{height:.7em}
.memo-rich-heading{font-size:16px;font-weight:900;color:#f3c987;margin:8px 0 4px}
.memo-rich-bullet{padding-left:1.1em;position:relative}
.memo-rich-bullet::before{content:"•";position:absolute;left:.2em;color:var(--accent)}
.memo-rich-link{color:#bfe3ff;text-decoration:underline;text-underline-offset:2px}
.memo-rich-image{margin:8px 0 10px;padding:8px;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:rgba(0,0,0,.12)}
.memo-rich-image img{display:block;max-width:100%;height:auto;border-radius:10px}
.memo-rich-image figcaption{margin-top:6px;color:var(--muted);font-size:12px}
@media (max-width:700px){
  .memo-editor-dialog{width:96vw;height:90vh;border-radius:18px}
  .memo-editor-head{flex-direction:column}
  .memo-editor-line{grid-template-columns:42px 1fr}
  .memo-editor-toolbar .btn{padding:8px 10px}
}


/* Dense memo list + editor controls */
.memo-editor-head-actions{display:flex;gap:8px;align-items:center;flex-shrink:0}
.memo-card-empty{padding:12px;text-align:center;color:var(--muted)}
.memo-card{padding:8px 10px;margin-bottom:8px;cursor:pointer;border-radius:12px;}
.memo-card:hover{border-color:rgba(102,179,255,.45);background:rgba(255,255,255,.035)}
.memo-card.is-search-hit{box-shadow:0 0 0 2px rgba(102,179,255,.24) inset;border-color:rgba(102,179,255,.55)}
.memo-card-head{display:flex;align-items:center;gap:8px;min-width:0;margin-bottom:4px}
.memo-card-no{font-size:12px;font-weight:900;color:#f3c987;white-space:nowrap}
.memo-card-title{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.memo-card-body{font-size:12px;line-height:1.35;max-height:112px;overflow:hidden}
.memo-card .memo-rich-line{margin:0;line-height:1.35}
.memo-card .memo-rich-heading{font-size:13px;margin:2px 0;font-weight:900}
.memo-card .memo-rich-image{margin:4px 0;padding:4px;border-radius:10px;display:inline-block;max-width:180px;vertical-align:top}
.memo-card .memo-rich-image img{max-height:80px;object-fit:contain}
.memo-card .memo-rich-image figcaption{font-size:10px;margin-top:2px}
.memo-card .memo-rich-link{font-size:12px}

/* Memo page density up */
.memo-grid{
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:6px;
}
@media (max-width: 1180px){
  .memo-grid{grid-template-columns:repeat(3, minmax(0, 1fr));}
}
@media (max-width: 820px){
  .memo-grid{grid-template-columns:repeat(2, minmax(0, 1fr));}
}
@media (max-width: 520px){
  .memo-grid{grid-template-columns:1fr;}
}
.memo-card{
  padding:5px 7px;
  margin-bottom:0;
  border-radius:10px;
  min-height:0;
}
.memo-card-head{
  gap:5px;
  margin-bottom:2px;
}
.memo-card-no{
  font-size:11px;
  line-height:1.15;
}
.memo-card-title{
  font-size:10.5px;
  line-height:1.15;
}
.memo-card-body{
  font-size:10.5px;
  line-height:1.22;
  max-height:56px;
  overflow:hidden;
}
.memo-card .memo-rich-line{
  line-height:1.22;
  margin:0;
}
.memo-card .memo-rich-heading{
  font-size:11px;
  margin:1px 0;
}
.memo-card .memo-rich-bullet{
  padding-left:.85em;
}
.memo-card .memo-rich-bullet::before{
  left:.08em;
}
.memo-card .memo-rich-link{
  font-size:10.5px;
}
.memo-card .memo-rich-image{
  margin:2px 3px 2px 0;
  padding:2px;
  border-radius:8px;
  max-width:86px;
}
.memo-card .memo-rich-image img{
  max-height:42px;
  border-radius:6px;
}
.memo-card .memo-rich-image figcaption{
  font-size:9px;
  line-height:1.15;
  margin-top:1px;
  max-width:78px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.memo-card-empty{
  padding:8px;
  font-size:12px;
}


/* ============================================================
   Integrated module: memo cards / image resize
   Merged into styles.css
   Integrated build: v90_unified_flow_memo
   ============================================================ */
/* ===== Memo cards vertical balanced + image resize ===== */

/* メモ一覧：細めの縦型カード。横に詰めすぎず、読みやすい長方形にする。 */
.memo-grid{
  grid-template-columns:repeat(auto-fill, minmax(150px, 170px)) !important;
  gap:8px !important;
  align-items:start !important;
  justify-content:start !important;
}

@media (max-width: 900px){
  .memo-grid{
    grid-template-columns:repeat(auto-fill, minmax(145px, 1fr)) !important;
  }
}

@media (max-width: 520px){
  .memo-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    gap:7px !important;
  }
}

@media (max-width: 340px){
  .memo-grid{
    grid-template-columns:1fr !important;
  }
}

.memo-card{
  aspect-ratio:4 / 5 !important;
  padding:7px 8px !important;
  border-radius:12px !important;
  overflow:hidden !important;
  min-height:0 !important;
  margin-bottom:0 !important;
}

.memo-card-head{
  gap:5px !important;
  margin-bottom:4px !important;
}

.memo-card-no{
  font-size:12px !important;
  line-height:1.15 !important;
}

.memo-card-title{
  font-size:11.5px !important;
  line-height:1.15 !important;
}

.memo-card-body{
  font-size:11.5px !important;
  line-height:1.28 !important;
  max-height:none !important;
  overflow:hidden !important;
}

.memo-card .memo-rich-line{
  font-size:11.5px !important;
  line-height:1.28 !important;
  margin:0 !important;
}

.memo-card .memo-rich-heading{
  font-size:12.5px !important;
  line-height:1.25 !important;
  margin:2px 0 !important;
}

.memo-card .memo-rich-link{
  font-size:11.5px !important;
}

/* メモ一覧内の画像はカードを圧迫しないサムネイル扱い */
.memo-card .memo-rich-image{
  margin:3px 3px 3px 0 !important;
  padding:2px !important;
  border-radius:8px !important;
  width:auto !important;
  max-width:96px !important;
  display:inline-block !important;
  vertical-align:top !important;
}

.memo-card .memo-rich-image img{
  max-height:54px !important;
  width:auto !important;
  max-width:100% !important;
  object-fit:contain !important;
  border-radius:6px !important;
}

.memo-card .memo-rich-image figcaption{
  font-size:9.5px !important;
  line-height:1.1 !important;
  margin-top:1px !important;
  max-width:88px !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

/* 通常表示・メモエディタ内プレビューでは、Markdown内の |80% 指定を反映 */
.memo-rich-image{
  width:min(100%, var(--memo-img-width, 100%));
}

.memo-rich-image img{
  width:100%;
  height:auto;
}

.memo-editor-line-preview .memo-rich-image{
  max-width:520px;
}

.memo-editor-line-preview .memo-rich-image img{
  max-height:420px;
  object-fit:contain;
}

.memo-editor-toolbar .memo-img-size-btn{
  border-color:rgba(102,179,255,.30);
  background:rgba(102,179,255,.10);
  color:#dff1ff;
}


/* ============================================================
   Integrated module: app-wide block memos
   Merged into styles.css
   Integrated build: v90_unified_flow_memo
   ============================================================ */
/* ===== App-wide block memos ===== */
.memo-global-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.memo-global-help{
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
  margin:4px 0 10px;
}
.memo-global-card{
  aspect-ratio:4 / 5;
  padding:8px 9px;
  border-radius:13px;
  overflow:hidden;
}
.memo-global-card .memo-card-head{
  display:block;
  margin-bottom:5px;
}
.memo-global-title{
  font-size:14px;
  line-height:1.22;
  font-weight:950;
  color:#f3c987;
  word-break:break-word;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.memo-global-meta{
  margin-top:2px;
  font-size:10px;
  line-height:1.2;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.memo-global-card .memo-card-body{
  font-size:11.8px;
  line-height:1.32;
  max-height:none;
  overflow:hidden;
}
.memo-global-card .memo-rich-line{
  font-size:11.8px;
  line-height:1.32;
}
.memo-global-card .memo-rich-heading{
  font-size:12.5px;
  line-height:1.25;
  margin:2px 0;
}
.memo-global-empty{
  grid-column:1 / -1;
  padding:18px;
  color:var(--muted);
  line-height:1.65;
}

/* hide old per-question memo buttons */
.btn-open-memo,
.sheet-actions .btn-open-memo,
.left-actions .btn-open-memo{
  display:none !important;
}
.actionbar-inner .btn-global-memo-action{
  background:rgba(102,179,255,.18);
  border-color:rgba(102,179,255,.38);
  color:#dff1ff;
}
.actionbar-inner .btn-global-memo-action:hover{
  background:rgba(102,179,255,.26);
}
@media (max-width: 720px){
  .actionbar-inner{ gap:7px; }
  .actionbar-inner .btn{ padding-left:9px; padding-right:9px; }
  .actionbar-inner .btn-global-memo-action{ min-width:58px; }
}

/* modal */
.memo-global-editor.is-hidden{display:none!important;}
.memo-global-editor{
  position:fixed;
  inset:0;
  z-index:100000;
}
.memo-global-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.56);
  backdrop-filter:blur(4px);
}
.memo-global-dialog{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(1040px,94vw);
  height:min(820px,88vh);
  display:flex;
  flex-direction:column;
  background:linear-gradient(180deg,rgba(27,34,44,.98),rgba(21,27,35,.98));
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
  overflow:hidden;
}
.memo-global-editor-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px;
  border-bottom:1px solid var(--line);
}
.memo-global-editor-title{
  font-size:17px;
  line-height:1.25;
  font-weight:950;
  color:#f3c987;
}
.memo-global-editor-sub{
  margin-top:4px;
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
}
.memo-global-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:10px 14px;
  border-bottom:1px solid var(--line);
  background:rgba(0,0,0,.08);
}
.memo-global-toolbar .btn[data-action="link"],
.memo-global-toolbar .btn[data-action="video"]{
  color:#dff1ff;
  border-color:rgba(102,179,255,.30);
  background:rgba(102,179,255,.10);
}
.memo-global-status{
  min-width:120px;
  color:var(--muted);
  font-size:12px;
  line-height:32px;
}
.memo-block-editor-body{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:rgba(0,0,0,.08);
  overflow:hidden;
}
.memo-global-title-input{
  width:100%;
  border:0;
  border-bottom:1px solid var(--line);
  background:#090d12;
  color:#f3c987;
  outline:none;
  padding:14px 16px;
  font:950 22px/1.35 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.memo-global-title-input::placeholder{ color:rgba(243,201,135,.45); }
.memo-block-list{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.memo-block{
  display:grid;
  grid-template-columns:34px 1fr auto;
  gap:8px;
  align-items:stretch;
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  background:rgba(255,255,255,.035);
  overflow:hidden;
}
.memo-block.is-dragging{
  opacity:.55;
  outline:2px solid rgba(102,179,255,.55);
}
.memo-block-side{
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:grab;
  color:var(--muted);
  border-right:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.025);
  user-select:none;
  font-weight:900;
}
.memo-block-side:active{ cursor:grabbing; }
.memo-block-main{
  min-width:0;
  padding:10px 0;
}
.memo-block-actions{
  display:flex;
  flex-direction:column;
  gap:5px;
  padding:8px;
  border-left:1px solid rgba(255,255,255,.08);
  background:rgba(0,0,0,.06);
}
.memo-block-btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:var(--text);
  border-radius:10px;
  padding:5px 8px;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
.memo-block-btn:hover{ background:rgba(255,255,255,.09); }
.memo-block-btn.danger{
  color:#ffd5d5;
  border-color:rgba(255,110,110,.28);
  background:rgba(255,110,110,.10);
}
.memo-block-text{
  min-height:42px;
  padding:8px 10px;
  color:var(--text);
  outline:none;
  white-space:pre-wrap;
  word-break:break-word;
  font:15px/1.62 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.memo-block-text:empty::before{
  content:attr(data-placeholder);
  color:var(--muted);
}
.memo-block-fields{
  display:grid;
  grid-template-columns: minmax(120px,.45fr) minmax(180px,1fr);
  gap:8px;
  margin-top:8px;
}
.memo-block-caption,
.memo-block-url{
  width:100%;
  border:1px solid rgba(255,255,255,.12);
  border-radius:11px;
  background:#090d12;
  color:var(--text);
  outline:none;
  padding:8px 9px;
  font:13px/1.3 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.memo-link-card{
  padding:8px 10px;
}
.memo-link-card-title{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  color:#bfe3ff;
  font-weight:950;
  font-size:15px;
  text-decoration:none;
  border:1px solid rgba(102,179,255,.28);
  background:rgba(102,179,255,.10);
  padding:8px 10px;
  border-radius:12px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.memo-link-card-title:hover{
  background:rgba(102,179,255,.18);
  text-decoration:underline;
}
.memo-link-card-url{
  margin-top:6px;
  color:var(--muted);
  font-size:11px;
  line-height:1.35;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.memo-block-media{
  width:min(100%, var(--memo-img-width, 100%));
  max-width:780px;
  padding:8px 10px 10px;
}
.memo-block-media-img,
.memo-block-media-video{
  display:block;
  width:100%;
  max-height:520px;
  object-fit:contain;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:#05080c;
}
.memo-block-media-iframe{
  display:block;
  width:100%;
  aspect-ratio:16 / 9;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:#05080c;
}
.memo-block-media-missing{
  color:var(--muted);
  border:1px dashed var(--line);
  border-radius:12px;
  padding:18px;
}
.memo-block-media-controls{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin:8px 0;
}

/* normal memo rendering */
.memo-rich-image,
.memo-rich-video{
  width:min(100%, var(--memo-img-width, 100%));
  max-width:760px;
  margin:8px 0;
}
.memo-rich-image img,
.memo-rich-video video{
  width:100%;
  height:auto;
  max-height:520px;
  object-fit:contain;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:#05080c;
}
.memo-rich-video iframe{
  width:100%;
  aspect-ratio:16 / 9;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  background:#05080c;
}
.memo-rich-image figcaption,
.memo-rich-video figcaption{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}
.memo-rich-image-missing{
  color:var(--muted);
  border:1px dashed var(--line);
  border-radius:10px;
  padding:8px;
}
.memo-global-card .memo-rich-image,
.memo-global-card .memo-rich-video{
  width:auto!important;
  max-width:96px;
  margin:3px 3px 3px 0;
  padding:2px;
  border-radius:8px;
}
.memo-global-card .memo-rich-image img,
.memo-global-card .memo-rich-video video,
.memo-global-card .memo-rich-video iframe{
  width:96px;
  max-width:100%;
  height:54px;
  object-fit:cover;
  border-radius:6px;
}
.memo-global-card .memo-rich-image figcaption,
.memo-global-card .memo-rich-video figcaption{
  font-size:9.5px;
  line-height:1.1;
  margin-top:1px;
  max-width:88px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

@media (max-width: 760px){
  .memo-global-dialog{
    width:96vw;
    height:88vh;
  }
  .memo-global-title-input{
    font-size:19px;
    padding:12px;
  }
  .memo-block-list{
    padding:10px;
    gap:8px;
  }
  .memo-block{
    grid-template-columns:28px 1fr;
  }
  .memo-block-actions{
    grid-column:1 / -1;
    flex-direction:row;
    border-left:0;
    border-top:1px solid rgba(255,255,255,.08);
  }
  .memo-block-fields{
    grid-template-columns:1fr;
  }
  .memo-block-media{
    width:100%!important;
  }
}

/* ===== Editor scroll/media cleanup ===== */
.memo-global-dialog{
  height:min(900px,92vh) !important;
  max-height:92vh !important;
  overflow:hidden !important;
}
.memo-global-editor-head,
.memo-global-toolbar,
.memo-global-title-input{
  flex:0 0 auto !important;
}
.memo-block-editor-body{
  flex:1 1 auto !important;
  min-height:0 !important;
  overflow:hidden !important;
}
.memo-block-list{
  flex:1 1 auto !important;
  min-height:0 !important;
  overflow-y:scroll !important;
  overflow-x:hidden !important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-bottom:80px !important;
}
.memo-block{
  flex:0 0 auto !important;
  min-height:64px;
  align-items:start !important;
}
.memo-block-main{
  min-height:52px;
  padding:10px 0 !important;
}
.memo-block-text{
  min-height:52px;
  max-height:none !important;
  overflow:visible !important;
}
.memo-block-media{
  max-width:820px;
  padding:10px 10px 12px !important;
}
.memo-block-media-img,
.memo-block-media-video{
  max-height:560px !important;
  object-fit:contain !important;
}
.memo-block-video-thumb,
.memo-rich-video-thumb{
  position:relative;
}
.memo-video-thumb-link{
  position:relative;
  display:block;
  color:inherit;
  text-decoration:none;
}
.memo-video-thumb-link img{
  display:block;
  width:100%;
  max-height:420px;
  object-fit:cover;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:#05080c;
}
.memo-video-play{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  display:grid;
  place-items:center;
  width:56px;
  height:56px;
  border-radius:999px;
  background:rgba(0,0,0,.62);
  color:#fff;
  font-size:24px;
  line-height:1;
  border:1px solid rgba(255,255,255,.20);
  pointer-events:none;
}
.memo-rich-image figcaption,
.memo-rich-video figcaption{
  display:none !important;
}
.memo-block-image .memo-block-caption,
.memo-block-video .memo-block-caption{
  display:none !important;
}
.memo-block-media-controls{
  margin:8px 0 0 !important;
}
.memo-link-card-title{
  cursor:pointer;
}
.memo-link-card-title::after{
  content:"↗";
  margin-left:8px;
  opacity:.75;
  font-size:12px;
}
.memo-rich-video video{
  pointer-events:none;
}
.memo-global-card .memo-rich-video video{
  pointer-events:none;
}
.memo-global-card .memo-video-play{
  width:28px;
  height:28px;
  font-size:13px;
}
@media (max-width:760px){
  .memo-global-dialog{
    height:94vh !important;
    max-height:94vh !important;
  }
  .memo-block{
    grid-template-columns:30px 1fr !important;
  }
  .memo-block-actions{
    position:static;
  }
  .memo-block-media-img,
  .memo-block-media-video{
    max-height:360px !important;
  }
}
.memo-global-card .memo-video-thumb-link img{
  width:96px;
  max-width:100%;
  height:54px;
  object-fit:cover;
  border-radius:6px;
}


/* ===== Memo editor full screen height ===== */
.memo-global-editor{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100dvh !important;
  overflow:hidden !important;
}
.memo-global-dialog{
  position:fixed !important;
  inset:0 !important;
  left:0 !important;
  top:0 !important;
  transform:none !important;
  width:100vw !important;
  height:100dvh !important;
  max-width:none !important;
  max-height:none !important;
  border-radius:0 !important;
  border:0 !important;
  box-shadow:none !important;
}
@supports not (height:100dvh){
  .memo-global-editor,
  .memo-global-dialog{
    height:100vh !important;
  }
}
.memo-global-backdrop{
  display:none !important;
}
.memo-global-editor-head,
.memo-global-toolbar,
.memo-global-title-input{
  flex:0 0 auto !important;
}
.memo-block-editor-body{
  flex:1 1 auto !important;
  min-height:0 !important;
  height:auto !important;
  overflow:hidden !important;
}
.memo-block-list{
  flex:1 1 auto !important;
  min-height:0 !important;
  height:auto !important;
  max-height:none !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  padding-bottom:96px !important;
}
.memo-block{
  flex:0 0 auto !important;
}


/* ===== Compact text blocks + URL view ===== */
.memo-block-text{
  min-height:1.55em !important;
  padding:5px 8px !important;
  font-size:15px !important;
  line-height:1.35 !important;
}
.memo-block{
  min-height:0 !important;
  align-items:start !important;
}
.memo-block-main{
  min-height:0 !important;
  padding:5px 0 !important;
}
.memo-block-side{
  min-height:34px !important;
}
.memo-block-actions{
  padding:5px !important;
  gap:4px !important;
}
.memo-block-btn{
  padding:4px 7px !important;
  font-size:11px !important;
}
/* URL/動画ブロックは編集画面ではサムネイル・カードだけを見せる。長いURLや入力欄は隠す。 */
.memo-link-card{
  padding:5px 8px !important;
}
.memo-link-card-title{
  display:inline-flex !important;
  min-height:32px !important;
  padding:6px 10px !important;
  font-size:14px !important;
  max-width:100% !important;
}
.memo-link-card-url,
.memo-block-fields,
.memo-block-caption,
.memo-block-url{
  display:none !important;
}
.memo-block-media{
  padding:6px 8px 8px !important;
  width:min(100%, var(--memo-img-width, 100%)) !important;
}
.memo-block-media-img,
.memo-block-media-video{
  max-height:360px !important;
}
.memo-video-thumb-link img{
  max-height:260px !important;
  object-fit:cover !important;
}
@media (max-width:720px){
  .memo-block{
    grid-template-columns:28px 1fr auto !important;
    gap:5px !important;
  }
  .memo-block-actions{
    min-width:34px !important;
  }
  .memo-block-media-img,
  .memo-block-media-video{
    max-height:280px !important;
  }
  .memo-video-thumb-link img{
    max-height:220px !important;
  }
}

/* ===== Text input on image / video / URL blocks ===== */
.memo-block-note-input{
  display:block !important;
  width:100%;
  min-height:32px;
  margin-top:7px;
  border:1px solid rgba(255,255,255,.13);
  border-radius:11px;
  background:#090d12;
  color:var(--text);
  outline:none;
  padding:6px 9px;
  font:14px/1.35 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.memo-block-note-input:focus{
  border-color:rgba(102,179,255,.55);
  box-shadow:0 0 0 3px rgba(102,179,255,.16);
}
.memo-link-card .memo-block-note-input{
  max-width:min(640px,100%);
}
.memo-link-open-button{
  width:auto;
  min-width:64px;
  justify-content:center;
}
.memo-block-media .memo-block-note-input{
  width:min(100%, 640px);
}
.memo-media-note{
  margin-top:4px;
  color:var(--text);
  font-size:13px;
  line-height:1.35;
  word-break:break-word;
}
.memo-global-card .memo-media-note{
  font-size:10px;
  line-height:1.2;
  max-width:96px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
@media (max-width:720px){
  .memo-block-note-input{
    font-size:13px;
    min-height:30px;
    padding:5px 8px;
  }
}

/* ===== Multiline media notes / auto-growing text ===== */
.memo-block-textarea,
.memo-block-note-input{
  box-sizing:border-box;
  resize:none !important;
  overflow:hidden !important;
}
textarea.memo-block-text{
  display:block;
  width:100%;
  min-height:34px !important;
  height:34px;
  padding:6px 10px !important;
  border:1px solid rgba(255,255,255,.13);
  border-radius:11px;
  background:#090d12;
  color:var(--text);
  outline:none;
  white-space:pre-wrap;
  word-break:break-word;
  font:15px/1.45 system-ui,-apple-system,Segoe UI,Roboto,sans-serif !important;
}
textarea.memo-block-text:focus,
.memo-block-caption-input:focus,
.memo-block-note-input:focus{
  border-color:rgba(102,179,255,.55);
  box-shadow:0 0 0 3px rgba(102,179,255,.16);
}
.memo-block-caption-input{
  display:block;
  width:min(100%, 640px);
  min-height:32px;
  margin-top:7px;
  border:1px solid rgba(255,255,255,.13);
  border-radius:11px;
  background:#090d12;
  color:#bfe3ff;
  outline:none;
  padding:6px 9px;
  font:900 14px/1.35 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
.memo-block-note-input{
  min-height:34px !important;
  height:34px;
  line-height:1.45 !important;
  white-space:pre-wrap;
}
.memo-link-card .memo-block-note-input,
.memo-block-media .memo-block-note-input{
  width:min(100%, 640px);
}
.memo-media-note{
  white-space:pre-wrap;
  line-height:1.4;
}
.memo-rich-link-block .memo-media-note{
  margin-top:5px;
  max-width:760px;
}
.memo-global-card .memo-rich-link-block .memo-media-note,
.memo-global-card .memo-media-note{
  white-space:pre-wrap;
}
@media (max-width:720px){
  textarea.memo-block-text,
  .memo-block-note-input,
  .memo-block-caption-input{
    font-size:13px !important;
    min-height:32px !important;
    padding:5px 8px !important;
  }
}


/* ===== URL caption+memo only, one-line default auto-grow textareas ===== */
.memo-link-card .memo-video-thumb-link,
.memo-link-card .memo-block-media,
.memo-link-card img,
.memo-link-card .memo-video-play{
  display:none !important;
}
.memo-link-card-plain{
  padding:5px 8px !important;
}
.memo-link-caption-row{
  display:flex;
  align-items:center;
  gap:8px;
  width:min(100%, 760px);
}
.memo-link-caption-row .memo-block-caption-input{
  flex:1 1 auto;
  min-width:0;
  margin-top:0 !important;
}
.memo-link-caption-row .memo-link-open-button{
  flex:0 0 auto;
  display:inline-flex !important;
  min-height:26px !important;
  padding:4px 9px !important;
  font-size:12px !important;
  border-radius:10px !important;
}
.memo-link-caption-row .memo-link-open-button::after{
  content:"↗";
  margin-left:5px;
  opacity:.75;
  font-size:10px;
}
textarea.memo-block-text,
.memo-block-note-input{
  display:block !important;
  width:min(100%, 760px) !important;
  box-sizing:border-box !important;
  min-height:28px !important;
  height:28px;
  padding:3px 8px !important;
  line-height:20px !important;
  overflow:hidden !important;
  resize:none !important;
  white-space:pre-wrap !important;
}
textarea.memo-block-text{
  font-size:15px !important;
  background:#090d12;
  border:1px solid rgba(255,255,255,.13);
  border-radius:10px;
}
.memo-block-note-input{
  margin-top:5px !important;
  font-size:14px !important;
}
.memo-block-caption-input{
  min-height:28px !important;
  height:28px !important;
  padding:3px 8px !important;
  line-height:20px !important;
}
.memo-block-main{
  padding:4px 0 !important;
}
.memo-block-side{
  min-height:30px !important;
}
.memo-block-actions{
  padding:4px !important;
}
.memo-block-btn{
  padding:3px 7px !important;
  line-height:1.2 !important;
}
@media (max-width:720px){
  textarea.memo-block-text,
  .memo-block-note-input,
  .memo-block-caption-input{
    min-height:27px !important;
    height:27px;
    line-height:19px !important;
    padding:3px 7px !important;
  }
}


/* ===== Clean row controls + caption link ===== */
.memo-block{
  grid-template-columns:34px 1fr !important;
}
.memo-block-actions{
  display:none !important;
}
.memo-global-editor-sub::after{
  content:"";
}
.memo-link-caption-row{
  display:block !important;
}
.memo-link-open-button{
  display:none !important;
}
.memo-link-caption-click{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  min-height:30px;
  padding:5px 9px;
  border:1px solid rgba(102,179,255,.32);
  border-radius:10px;
  background:rgba(102,179,255,.12);
  color:#dff1ff;
  font-size:14px;
  font-weight:900;
  line-height:1.25;
  text-decoration:none;
  white-space:normal;
  word-break:break-word;
}
.memo-link-caption-click:hover{
  background:rgba(102,179,255,.20);
  border-color:rgba(102,179,255,.52);
}
.memo-block-side{
  cursor:grab;
}
.memo-block:has(textarea.memo-block-text:placeholder-shown){
  opacity:.88;
}
@media (max-width:720px){
  .memo-block{grid-template-columns:28px 1fr !important;}
}

/* ===== v90 unified flow memo editor cleanup ===== */
.memo-global-toolbar .btn[data-action="save"]{
  display:none !important;
}
.memo-global-editor-sub{
  line-height:1.5;
}
.memo-block-list{
  overflow-x:auto !important;
}
.memo-block-list.is-drop-ready{
  outline:2px dashed rgba(102,179,255,.55);
  outline-offset:-8px;
  background:rgba(102,179,255,.06);
}
.memo-block-media{
  width:var(--memo-img-width, 100%) !important;
  max-width:none !important;
  min-width:80px;
  overflow:visible;
}
.memo-block-media.is-resizing{
  outline:2px solid rgba(102,179,255,.65);
  outline-offset:3px;
}
.memo-block-media-row{
  display:grid;
  grid-template-columns:minmax(96px, .42fr) minmax(120px, 1fr) minmax(96px, .42fr);
  gap:8px;
  align-items:start;
}
.memo-block-media-frame{
  position:relative;
  min-width:80px;
}
.memo-block-media-frame .memo-block-media-img,
.memo-block-media-frame .memo-block-media-video,
.memo-block-media-frame .memo-video-thumb-link,
.memo-block-media-frame .memo-video-thumb-link img{
  width:100% !important;
}
.memo-media-resize-handle{
  position:absolute;
  right:-7px;
  bottom:-7px;
  width:18px;
  height:18px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,.65);
  background:rgba(102,179,255,.90);
  box-shadow:0 3px 12px rgba(0,0,0,.35);
  cursor:nwse-resize;
  touch-action:none;
}
.memo-media-resize-handle::before{
  content:"";
  position:absolute;
  inset:4px 3px 3px 4px;
  border-right:2px solid rgba(0,0,0,.55);
  border-bottom:2px solid rgba(0,0,0,.55);
}
.memo-block-note-top,
.memo-block-note-bottom{
  width:min(100%, 760px) !important;
}
.memo-block-note-left,
.memo-block-note-right{
  width:100% !important;
  min-height:72px !important;
}
.memo-rich-image,
.memo-rich-video{
  width:var(--memo-img-width, 100%) !important;
  max-width:none !important;
}
.memo-rich-media-row{
  display:grid;
  grid-template-columns:auto minmax(80px, 1fr) auto;
  gap:8px;
  align-items:start;
}
.memo-rich-media-core img,
.memo-rich-media-core video,
.memo-rich-media-core iframe,
.memo-rich-media-core .memo-video-thumb-link img{
  width:100%;
}
.memo-media-note-top,
.memo-media-note-bottom,
.memo-media-note-left,
.memo-media-note-right{
  white-space:pre-wrap;
  color:var(--text);
  font-size:13px;
  line-height:1.45;
  word-break:break-word;
}
.memo-media-note-top{margin-bottom:5px;}
.memo-media-note-bottom{margin-top:5px;}
.memo-media-note-left,
.memo-media-note-right{
  max-width:220px;
}
@media (max-width:720px){
  .memo-block-media-row,
  .memo-rich-media-row{
    grid-template-columns:1fr;
  }
  .memo-block-note-left,
  .memo-block-note-right{
    min-height:32px !important;
  }
  .memo-media-note-left,
  .memo-media-note-right{
    max-width:none;
  }
}

/* ===== v90 unified flow memo editor =====
   メモ本文を縦固定の「種類別行」ではなく、横並び・折り返し可能な編集面として扱う。
   追加ファイルは作らず、app.js/styles.css に統合。 */
.memo-global-editor-sub{max-width:820px}
.memo-block-list{
  display:flex !important;
  flex-direction:row !important;
  flex-wrap:wrap !important;
  align-content:flex-start !important;
  align-items:flex-start !important;
  gap:12px !important;
  padding:16px !important;
  overflow:auto !important;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    rgba(0,0,0,.10) !important;
  background-size:28px 28px, 28px 28px, auto !important;
}
.memo-block{
  position:relative !important;
  flex:0 0 var(--memo-block-width, 360px) !important;
  width:var(--memo-block-width, 360px) !important;
  max-width:none !important;
  min-width:180px !important;
  min-height:74px !important;
  display:grid !important;
  grid-template-columns:30px minmax(0,1fr) !important;
  grid-template-areas:"handle main" !important;
  overflow:visible !important;
  box-shadow:0 10px 28px rgba(0,0,0,.12);
}
.memo-block:hover{border-color:rgba(102,179,255,.28)}
.memo-block-side{grid-area:handle !important;border-radius:15px 0 0 15px;touch-action:none;}
.memo-block-main{grid-area:main !important;min-width:0 !important;padding:8px 10px 12px !important;overflow:visible !important;}
.memo-block-resize-handle{
  position:absolute;
  right:-8px;
  bottom:-8px;
  width:20px;
  height:20px;
  border-radius:7px;
  border:1px solid rgba(255,255,255,.72);
  background:rgba(102,179,255,.94);
  cursor:nwse-resize;
  touch-action:none;
  box-shadow:0 5px 14px rgba(0,0,0,.35);
  z-index:4;
}
.memo-block-resize-handle::before{
  content:"";
  position:absolute;
  right:4px;
  bottom:4px;
  width:8px;
  height:8px;
  border-right:2px solid rgba(0,0,0,.58);
  border-bottom:2px solid rgba(0,0,0,.58);
}
.memo-block.is-resizing,
.memo-block .memo-block-media.is-resizing{outline:2px solid rgba(102,179,255,.55);}
.memo-block-textarea,
.memo-block-note-input{
  width:100% !important;
}
.memo-block-text{
  min-height:56px !important;
  resize:none !important;
}
.memo-block-link{--memo-block-width:320px;}
.memo-block-image,
.memo-block-video{--memo-block-width:520px;}
.memo-block-media{
  width:100% !important;
  max-width:none !important;
  padding:6px 0 10px !important;
}
.memo-block-media-frame{max-width:none !important;}
.memo-block-media-controls{justify-content:flex-start !important;}
.memo-block-note-top,
.memo-block-note-bottom{
  width:100% !important;
}
.memo-block-note-left,
.memo-block-note-right{
  min-width:96px !important;
}
.memo-link-card{padding:4px 0 8px !important;}
.memo-rich-flow-text{
  display:inline-block;
  width:var(--memo-block-width, 360px);
  max-width:100%;
  vertical-align:top;
  margin:4px 8px 8px 0;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.035);
}
.memo-global-card .memo-rich-flow-text{
  width:auto;
  max-width:100%;
  display:block;
  margin:0;
  padding:0;
  background:transparent;
}
.memo-global-help::after{
  content:" 画像やURLを貼ると同じ編集面にブロックとして入り、右下で幅を変えられます。";
}
@media (max-width:760px){
  .memo-block-list{display:flex !important;flex-direction:column !important;flex-wrap:nowrap !important;padding:10px !important;}
  .memo-block{flex:0 0 auto !important;width:100% !important;max-width:100% !important;}
  .memo-block-resize-handle{display:none;}
}

/* ============================================================
   v91/v92 free canvas memo editor
   - One editable page: text / image / video / captioned URL can coexist freely.
   - No extra patch files.
   ============================================================ */
.memo-free-editor .memo-global-dialog{
  width:min(1180px,96vw)!important;
  height:min(92vh,980px)!important;
  max-height:92vh!important;
  display:flex!important;
  flex-direction:column!important;
}
.memo-free-editor .memo-global-editor-sub{
  max-width:900px;
}
.memo-free-editor .memo-global-toolbar{
  gap:8px!important;
  flex-wrap:wrap!important;
}
.memo-free-body{
  flex:1 1 auto!important;
  min-height:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  padding:12px!important;
  background:var(--bg,#f6f7fb)!important;
}
.memo-free-body .memo-global-title-input{
  flex:0 0 auto!important;
  width:100%!important;
  height:44px!important;
  border:1px solid rgba(20,30,50,.16)!important;
  border-radius:12px!important;
  padding:0 14px!important;
  font-size:18px!important;
  font-weight:800!important;
  background:#fff!important;
  color:#111827!important;
  outline:none!important;
}
.memo-free-body .memo-global-title-input:focus{
  border-color:#2563eb!important;
  box-shadow:0 0 0 3px rgba(37,99,235,.14)!important;
}
.memo-free-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  background:#d9dde7;
  border:1px solid rgba(15,23,42,.16);
  border-radius:16px;
  padding:24px;
  box-shadow:inset 0 1px 2px rgba(15,23,42,.08);
}
.memo-free-page-host{
  width:max-content;
  min-width:100%;
}
.memo-free-page{
  position:relative;
  width:900px;
  min-height:680px;
  margin:0 auto;
  background:#fff;
  color:#111827;
  border:1px solid rgba(15,23,42,.14);
  border-radius:10px;
  box-shadow:0 14px 42px rgba(15,23,42,.18);
  overflow:visible;
  background-image:linear-gradient(rgba(37,99,235,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(37,99,235,.055) 1px,transparent 1px);
  background-size:24px 24px;
}
.memo-free-page.is-view{
  width:100%;
  min-width:660px;
  max-width:900px;
  transform-origin:top left;
  margin:0;
  box-shadow:none;
  border-radius:10px;
  overflow:hidden;
  background-size:18px 18px;
}
.memo-card-body .memo-free-page.is-view{
  height:360px!important;
  min-height:360px!important;
  max-height:360px!important;
}
.memo-free-item{
  position:absolute;
  box-sizing:border-box;
  z-index:1;
  border:1px solid transparent;
  border-radius:10px;
  overflow:visible;
}
.memo-free-page.is-editor .memo-free-item{
  cursor:move;
}
.memo-free-page.is-editor .memo-free-item:hover,
.memo-free-page.is-editor .memo-free-item.is-selected{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,.14);
  background:rgba(255,255,255,.72);
}
.memo-free-item-grip{
  position:absolute;
  left:-12px;
  top:-12px;
  width:24px;
  height:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:#111827;
  color:#fff;
  font-size:12px;
  font-weight:900;
  z-index:5;
  opacity:0;
  user-select:none;
}
.memo-free-page.is-editor .memo-free-item:hover .memo-free-item-grip,
.memo-free-page.is-editor .memo-free-item.is-selected .memo-free-item-grip{
  opacity:1;
}
.memo-free-textarea{
  width:100%;
  height:100%;
  display:block;
  resize:none;
  border:none;
  outline:none;
  background:transparent;
  color:#111827;
  font:500 16px/1.65 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  padding:14px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.memo-free-view-text{
  padding:14px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
  font:500 16px/1.65 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:rgba(255,255,255,.68);
}
.memo-free-media-frame,
.memo-free-link-box{
  position:absolute;
  inset:0;
  overflow:hidden;
  border-radius:10px;
  background:#f8fafc;
  border:1px solid rgba(15,23,42,.12);
}
.memo-free-media-frame img,
.memo-free-media-frame video,
.memo-free-video-link,
.memo-free-video-link img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  background:#fff;
}
.memo-free-video-link{position:relative;text-decoration:none;color:inherit;}
.memo-free-caption{
  position:absolute;
  left:8px;
  right:8px;
  bottom:8px;
  min-height:22px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(15,23,42,.72);
  color:#fff;
  font-size:12px;
  line-height:1.25;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  pointer-events:none;
}
.memo-free-link-box{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  gap:4px;
  padding:14px 16px;
  background:#eff6ff;
  border-color:#93c5fd;
}
.memo-free-link{
  color:#1d4ed8;
  text-decoration:underline;
  text-underline-offset:3px;
  font-weight:800;
  font-size:17px;
  line-height:1.25;
  overflow:hidden;
  max-width:100%;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.memo-free-link-host{
  color:#64748b;
  font-size:12px;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.memo-free-missing{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:100%;
  color:#64748b;
  background:#f1f5f9;
  font-weight:700;
}
.memo-free-resize{
  position:absolute;
  right:-8px;
  bottom:-8px;
  width:18px;
  height:18px;
  border-radius:999px;
  border:2px solid #fff;
  background:#2563eb;
  cursor:nwse-resize;
  z-index:7;
  display:none;
  box-shadow:0 2px 8px rgba(15,23,42,.3);
}
.memo-free-item-delete{
  position:absolute;
  right:-10px;
  top:-10px;
  width:22px;
  height:22px;
  border-radius:999px;
  border:2px solid #fff;
  background:#dc2626;
  color:#fff;
  font-size:14px;
  font-weight:900;
  line-height:18px;
  cursor:pointer;
  z-index:8;
  display:none;
  box-shadow:0 2px 8px rgba(15,23,42,.3);
}
.memo-free-page.is-editor .memo-free-item:hover .memo-free-resize,
.memo-free-page.is-editor .memo-free-item.is-selected .memo-free-resize,
.memo-free-page.is-editor .memo-free-item:hover .memo-free-item-delete,
.memo-free-page.is-editor .memo-free-item.is-selected .memo-free-item-delete{
  display:block;
}
.memo-free-page-host.is-drop-ready .memo-free-page{
  outline:3px dashed #2563eb;
  outline-offset:8px;
}
.memo-free-page.is-view .memo-free-item{
  transform:scale(.72);
  transform-origin:top left;
}
.memo-free-page.is-view .memo-free-caption{
  font-size:11px;
}
.memo-free-page.is-view .memo-free-link{
  font-size:15px;
}
@media(max-width:760px){
  .memo-free-editor .memo-global-dialog{
    width:100vw!important;
    height:100vh!important;
    max-height:100vh!important;
    border-radius:0!important;
  }
  .memo-free-scroll{padding:14px;}
  .memo-free-page{width:760px;}
  .memo-free-body .memo-global-title-input{height:42px;font-size:16px!important;}
}

/* ============================================================
   v92 A4 memo editor refinements
   - Fixed A4 portrait page, no overflow outside paper
   - Rich text item: selected text can change font size/color
   - Right-click context menu and compact thumbnail preview
   ============================================================ */
.memo-free-editor .memo-global-dialog{
  width:min(1040px,96vw)!important;
  height:min(96vh,1160px)!important;
  max-height:96vh!important;
}
.memo-free-editor .memo-global-editor-sub{max-width:760px!important;}
.memo-free-editor .memo-global-toolbar{align-items:center!important;gap:7px!important;}
.memo-style-size,
.memo-style-color{
  height:30px;border:1px solid rgba(20,30,50,.18);border-radius:8px;background:#fff;color:#111827;
}
.memo-style-size{width:64px;padding:0 6px;font-weight:700;}
.memo-style-color{width:38px;padding:2px;}
.memo-free-scroll{
  background:#cfd5df!important;
  padding:28px!important;
  display:flex!important;
  justify-content:center!important;
  align-items:flex-start!important;
}
.memo-free-page-host{
  width:794px!important;
  min-width:794px!important;
  max-width:794px!important;
  margin:0 auto!important;
}
.memo-free-page{
  width:794px!important;
  height:1123px!important;
  min-height:1123px!important;
  max-height:1123px!important;
  overflow:hidden!important;
  margin:0 auto!important;
  border-radius:4px!important;
  background-size:0 0!important;
}
.memo-free-page.is-editor{
  outline:1px solid rgba(15,23,42,.16);
}
.memo-free-text{
  min-width:80px!important;
  min-height:34px!important;
  background:rgba(255,255,255,.35);
}
.memo-free-editable{
  width:100%;height:100%;box-sizing:border-box;
  outline:none;border:none;background:transparent;color:inherit;
  font:inherit;line-height:1.55;padding:6px 8px;
  white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;
  overflow:hidden;cursor:text;
}
.memo-free-editable:empty::before{
  content:attr(data-placeholder);color:#94a3b8;pointer-events:none;
}
.memo-free-view-text{
  padding:6px 8px!important;
  background:transparent!important;
  line-height:1.55!important;
  overflow:hidden!important;
}
.memo-free-media-frame,
.memo-free-link-box{border-radius:4px!important;}
.memo-free-media-frame{background:#fff!important;}
.memo-free-caption{display:none!important;}
.memo-free-context-menu{
  position:absolute;z-index:100010;min-width:178px;padding:6px;border-radius:10px;
  background:#111827;color:#fff;box-shadow:0 14px 34px rgba(15,23,42,.35);
  border:1px solid rgba(255,255,255,.12);
}
.memo-free-context-menu[hidden]{display:none!important;}
.memo-free-context-menu button{
  display:block;width:100%;padding:8px 10px;border:0;border-radius:7px;background:transparent;color:#fff;
  text-align:left;font-size:13px;cursor:pointer;
}
.memo-free-context-menu button:hover{background:rgba(255,255,255,.12);}
.memo-free-context-menu hr{border:0;border-top:1px solid rgba(255,255,255,.16);margin:5px 2px;}
.memo-page-thumb{
  height:236px!important;max-height:236px!important;overflow:hidden!important;background:#e5e7eb!important;
  display:flex!important;justify-content:center!important;align-items:flex-start!important;padding:8px!important;
}
.memo-page-thumb .memo-free-page.is-view{
  width:794px!important;min-width:794px!important;max-width:794px!important;
  height:1123px!important;min-height:1123px!important;max-height:1123px!important;
  transform:scale(.195)!important;transform-origin:top center!important;
  margin:0 auto!important;border-radius:3px!important;box-shadow:0 8px 22px rgba(15,23,42,.16)!important;
  overflow:hidden!important;background-size:0 0!important;
}
.memo-page-thumb .memo-free-page.is-view .memo-free-item{transform:none!important;}
.memo-card.memo-global-card{min-height:auto!important;}
.memo-card .memo-global-title{font-size:15px!important;line-height:1.3!important;}
@media(max-width:760px){
  .memo-free-scroll{padding:16px!important;justify-content:flex-start!important;}
  .memo-free-page-host,.memo-free-page{width:794px!important;min-width:794px!important;}
  .memo-free-editor .memo-global-toolbar{overflow-x:auto;flex-wrap:nowrap!important;}
}

/* ============================================================
   v93 A4 memo editor: click-to-type / centered full-page / sync-safe UX
   ============================================================ */
.memo-free-editor .memo-global-dialog{
  width:100vw!important;
  height:100vh!important;
  max-height:100vh!important;
  border-radius:0!important;
  left:0!important;top:0!important;transform:none!important;
}
.memo-free-editor .memo-global-editor-head{
  padding:6px 10px!important;
  min-height:34px!important;
  align-items:center!important;
}
.memo-free-editor .memo-global-editor-title{
  font-size:14px!important;
  line-height:1.15!important;
}
.memo-free-editor .memo-global-editor-sub{
  margin-top:1px!important;
  font-size:10px!important;
  line-height:1.25!important;
  max-width:none!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.memo-free-editor .memo-global-toolbar{
  padding:5px 10px!important;
  gap:6px!important;
  min-height:38px!important;
  align-items:center!important;
}
/* 挿入種類を選ばせる運用をやめる。貼り付け/ドラッグ/右クリック中心。 */
.memo-free-editor .memo-global-toolbar .btn[data-action="text"],
.memo-free-editor .memo-global-toolbar .btn[data-action="image"],
.memo-free-editor .memo-global-toolbar .btn[data-action="link"],
.memo-free-editor .memo-global-toolbar .btn[data-action="video"]{
  display:none!important;
}
.memo-free-editor .memo-global-status{
  min-width:76px!important;
  font-size:10px!important;
  line-height:26px!important;
}
.memo-free-body{
  padding:6px 8px 8px!important;
  gap:6px!important;
}
.memo-free-body .memo-global-title-input{
  height:30px!important;
  min-height:30px!important;
  border-radius:8px!important;
  padding:0 10px!important;
  font-size:14px!important;
  line-height:30px!important;
}
.memo-free-scroll{
  padding:10px!important;
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  overflow:auto!important;
  border-radius:10px!important;
}
.memo-free-page-host{
  width:794px;
  height:1123px;
  min-width:0!important;
  max-width:none!important;
  margin:auto!important;
  flex:0 0 auto!important;
  display:block!important;
}
.memo-free-page{
  width:794px!important;
  height:1123px!important;
  min-height:1123px!important;
  max-height:1123px!important;
  margin:0 auto!important;
  overflow:hidden!important;
  background:#fff!important;
  border-radius:4px!important;
  box-shadow:0 12px 34px rgba(15,23,42,.24)!important;
  background-image:none!important;
}
.memo-free-page.is-editor{
  cursor:text;
}
.memo-free-page.is-editor .memo-free-item{
  cursor:move;
}
.memo-free-page.is-editor .memo-free-text{
  cursor:text;
}
.memo-free-editable{
  padding:4px 7px!important;
  line-height:1.45!important;
}
.memo-free-text{
  min-width:70px!important;
  min-height:30px!important;
  background:rgba(255,255,255,.22)!important;
}
.memo-free-item-grip{
  width:18px!important;height:18px!important;left:-8px!important;top:-8px!important;font-size:10px!important;
}
.memo-free-resize{width:15px!important;height:15px!important;right:-7px!important;bottom:-7px!important;}
.memo-free-item-delete{width:19px!important;height:19px!important;right:-8px!important;top:-8px!important;font-size:12px!important;line-height:15px!important;}
.memo-free-media-frame img,
.memo-free-media-frame video,
.memo-free-video-link,
.memo-free-video-link img{
  -webkit-user-drag:none!important;
  user-select:none!important;
}
.memo-free-caption{display:none!important;}
.global-search-memo-results{
  padding:12px!important;
  margin:12px 0!important;
  border:1px solid rgba(96,165,250,.26)!important;
  background:rgba(96,165,250,.08)!important;
}
.global-search-title{
  color:#f3c987;
  font-weight:900;
  margin-bottom:8px;
  font-size:14px;
}
.global-search-memo-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:8px;
}
.global-search-memo-hit{
  display:flex;
  flex-direction:column;
  gap:4px;
  text-align:left;
  padding:10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:var(--text,#e5e7eb);
  cursor:pointer;
}
.global-search-memo-hit:hover{border-color:rgba(96,165,250,.6);background:rgba(96,165,250,.12);}
.global-search-memo-hit-title{font-weight:900;color:#f3c987;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.global-search-memo-hit-snippet{font-size:12px;color:var(--muted,#9ca3af);line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
@media(max-width:760px){
  .memo-free-editor .memo-global-editor-sub{display:none!important;}
  .memo-free-editor .memo-global-toolbar{overflow-x:auto!important;flex-wrap:nowrap!important;}
  .memo-free-scroll{align-items:center!important;justify-content:center!important;}
}

/* ============================================================
   v94 memo editor polish
   - calmer selected item chrome
   - subtle handles
   - text box auto-size friendly default
   - right-click command menu polish
   ============================================================ */
.memo-free-page.is-editor .memo-free-item{
  border-radius:6px!important;
  border:1px solid transparent!important;
  background:transparent!important;
  transition:border-color .12s ease, box-shadow .12s ease, background .12s ease!important;
}
.memo-free-page.is-editor .memo-free-item:hover{
  border-color:rgba(100,116,139,.48)!important;
  box-shadow:0 0 0 1px rgba(100,116,139,.12)!important;
  background:rgba(255,255,255,.18)!important;
}
.memo-free-page.is-editor .memo-free-item.is-selected{
  border-color:#64748b!important;
  box-shadow:0 0 0 2px rgba(100,116,139,.18)!important;
  background:rgba(255,255,255,.26)!important;
}
.memo-free-item-grip{
  left:-9px!important;
  top:-9px!important;
  width:18px!important;
  height:18px!important;
  border-radius:7px!important;
  border:1px solid rgba(255,255,255,.75)!important;
  background:rgba(51,65,85,.72)!important;
  color:rgba(255,255,255,.92)!important;
  font-size:9px!important;
  line-height:1!important;
  font-weight:700!important;
  letter-spacing:-2px!important;
  box-shadow:0 4px 12px rgba(15,23,42,.18)!important;
}
.memo-free-resize{
  right:-6px!important;
  bottom:-6px!important;
  width:13px!important;
  height:13px!important;
  border-radius:4px!important;
  border:2px solid #fff!important;
  background:#64748b!important;
  box-shadow:0 3px 10px rgba(15,23,42,.22)!important;
}
.memo-free-resize::after{
  content:"";
  position:absolute;
  right:2px;
  bottom:2px;
  width:4px;
  height:4px;
  border-right:1px solid rgba(255,255,255,.9);
  border-bottom:1px solid rgba(255,255,255,.9);
}
.memo-free-item-delete{
  right:-8px!important;
  top:-8px!important;
  width:18px!important;
  height:18px!important;
  border-radius:7px!important;
  border:1px solid rgba(255,255,255,.8)!important;
  background:rgba(51,65,85,.84)!important;
  color:#fff!important;
  font-size:12px!important;
  line-height:16px!important;
  font-weight:700!important;
  box-shadow:0 4px 12px rgba(15,23,42,.2)!important;
}
.memo-free-item-delete:hover{background:rgba(185,28,28,.9)!important;}
.memo-free-text{
  min-width:54px!important;
  min-height:28px!important;
  background:transparent!important;
}
.memo-free-page.is-editor .memo-free-text:hover,
.memo-free-page.is-editor .memo-free-text.is-selected{
  background:rgba(248,250,252,.42)!important;
}
.memo-free-editable{
  padding:3px 6px!important;
  line-height:1.45!important;
  min-width:0!important;
  min-height:0!important;
  overflow:hidden!important;
  border-radius:4px!important;
}
.memo-free-editable:focus{
  background:rgba(255,255,255,.62)!important;
  box-shadow:inset 0 0 0 1px rgba(100,116,139,.18)!important;
}
.memo-free-editable:empty::before{
  color:#94a3b8!important;
  font-weight:400!important;
}
.memo-free-context-menu{
  min-width:168px!important;
  padding:5px!important;
  border-radius:9px!important;
  background:rgba(30,41,59,.96)!important;
  color:#f8fafc!important;
  border:1px solid rgba(148,163,184,.22)!important;
  box-shadow:0 18px 42px rgba(15,23,42,.34)!important;
  backdrop-filter:blur(10px)!important;
}
.memo-free-context-menu button{
  height:30px!important;
  padding:0 9px!important;
  border-radius:6px!important;
  color:#f8fafc!important;
  font-size:12.5px!important;
  font-weight:600!important;
}
.memo-free-context-menu button:hover{
  background:rgba(148,163,184,.18)!important;
}
.memo-free-context-menu hr{
  border-top:1px solid rgba(148,163,184,.22)!important;
  margin:5px 4px!important;
}
.memo-free-media-frame,
.memo-free-link-box{
  border-color:rgba(100,116,139,.22)!important;
}
.memo-free-page.is-editor .memo-free-media:hover .memo-free-media-frame,
.memo-free-page.is-editor .memo-free-link-item:hover .memo-free-link-box{
  border-color:rgba(100,116,139,.38)!important;
}

/* ============================================================
   v95: small-video play badge refinement
   - The play mark now scales with the video thumbnail instead of staying huge.
   - The triangle is drawn with CSS so it remains readable at very small sizes.
   ============================================================ */
.memo-free-media .memo-video-play,
.memo-free-video-link .memo-video-play{
  width:clamp(10px,18%,42px)!important;
  height:auto!important;
  aspect-ratio:1/1!important;
  border-radius:999px!important;
  background:rgba(15,23,42,.52)!important;
  border:1px solid rgba(255,255,255,.24)!important;
  box-shadow:0 2px 8px rgba(15,23,42,.20)!important;
  font-size:0!important;
  line-height:1!important;
}
.memo-free-media .memo-video-play::before,
.memo-free-video-link .memo-video-play::before{
  content:"";
  display:block;
  width:34%;
  height:38%;
  margin-left:7%;
  background:#fff;
  clip-path:polygon(0 0,100% 50%,0 100%);
}
.memo-page-thumb .memo-free-media .memo-video-play,
.memo-page-thumb .memo-free-video-link .memo-video-play{
  width:clamp(8px,16%,28px)!important;
  box-shadow:none!important;
}

/* ============================================================
   v96: text input sync / autofit stability
   - Text items grow with typed characters and line breaks
   - Right-click paste uses restored caret range
   ============================================================ */
.memo-free-text{
  min-width:54px!important;
  min-height:28px!important;
}
.memo-free-editable{
  display:block!important;
  width:100%!important;
  height:100%!important;
  box-sizing:border-box!important;
  white-space:pre-wrap!important;
  overflow:visible!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
  line-break:auto!important;
}
.memo-free-editable:focus{
  outline:none!important;
}
.memo-free-editable br{
  display:block!important;
  content:""!important;
}
.memo-free-page.is-editor .memo-free-text.is-selected,
.memo-free-page.is-editor .memo-free-text:focus-within{
  background:rgba(248,250,252,.56)!important;
}

/* ============================================================
   v97: memo editor stability
   - Text boxes commit content immediately and keep natural size.
   - Media fills its item frame without the old inner padding feel.
   - Video controls remain clickable.
   ============================================================ */
.memo-free-page.is-editor .memo-free-text{
  min-width:54px!important;
  min-height:28px!important;
}
.memo-free-editable{
  display:block!important;
  width:100%!important;
  height:100%!important;
  box-sizing:border-box!important;
  padding:3px 6px!important;
  white-space:pre-wrap!important;
  overflow:visible!important;
  overflow-wrap:break-word!important;
  word-break:normal!important;
  user-select:text!important;
  -webkit-user-select:text!important;
  caret-color:currentColor!important;
}
.memo-free-editable:focus{
  outline:none!important;
  background:rgba(255,255,255,.72)!important;
}
.memo-free-media-frame{
  padding:0!important;
  background:transparent!important;
}
.memo-free-media-frame img,
.memo-free-media-frame video,
.memo-free-video-link,
.memo-free-video-link img{
  width:100%!important;
  height:100%!important;
  display:block!important;
  margin:0!important;
  object-fit:contain!important;
  background:transparent!important;
}
.memo-free-media-frame video{
  pointer-events:auto!important;
}
.memo-free-video-link{
  pointer-events:auto!important;
}
.memo-free-page.is-editor .memo-free-media video,
.memo-free-page.is-editor .memo-free-video-link{
  cursor:pointer!important;
}


/* ============================================================
   v99: native textarea text input final stabilization
   - textarea keeps its own input state, no full page redraw while typing
   - line length grows the item horizontally; line breaks grow vertically
   - textarea uses native text editing behavior for speed
   ============================================================ */
.memo-free-textarea,
.memo-free-editable.memo-free-textarea{
  display:block!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  box-sizing:border-box!important;
  resize:none!important;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  color:inherit!important;
  font:inherit!important;
  line-height:1.45!important;
  padding:3px 6px!important;
  overflow:hidden!important;
  white-space:pre!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
  user-select:text!important;
  -webkit-user-select:text!important;
  caret-color:currentColor!important;
  appearance:none!important;
  -webkit-appearance:none!important;
}
.memo-free-textarea:focus{
  background:rgba(255,255,255,.72)!important;
  box-shadow:inset 0 0 0 1px rgba(100,116,139,.18)!important;
}
.memo-free-textarea::placeholder{
  color:#94a3b8!important;
  opacity:1!important;
}
.memo-free-page.is-editor .memo-free-text{
  min-width:54px!important;
  min-height:28px!important;
  overflow:visible!important;
}
.memo-free-page.is-editor .memo-free-text.is-selected,
.memo-free-page.is-editor .memo-free-text:focus-within{
  background:rgba(248,250,252,.56)!important;
}

/* ============================================================
   v100: memo text input hard reset
   Native textarea is the source of truth. The box grows from the
   textarea content, and no full editor re-render runs while typing.
   ============================================================ */
.memo-free-page.is-editor .memo-free-text{
  padding:0!important;
  overflow:visible!important;
  min-width:54px!important;
  min-height:28px!important;
  background:transparent!important;
}
.memo-free-page.is-editor .memo-free-textarea,
.memo-free-page.is-editor textarea.memo-free-editable,
.memo-free-page.is-editor .memo-free-editable.memo-free-textarea{
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  border:0!important;
  outline:0!important;
  resize:none!important;
  background:transparent!important;
  color:inherit!important;
  font:500 16px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  padding:3px 6px!important;
  margin:0!important;
  overflow:hidden!important;
  white-space:pre!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
  overflow-x:hidden!important;
  overflow-y:hidden!important;
  appearance:none!important;
  -webkit-appearance:none!important;
  caret-color:#111827!important;
  user-select:text!important;
  -webkit-user-select:text!important;
}
.memo-free-page.is-editor .memo-free-textarea:focus,
.memo-free-page.is-editor textarea.memo-free-editable:focus{
  background:rgba(255,255,255,.80)!important;
  box-shadow:inset 0 0 0 1px rgba(100,116,139,.16)!important;
}
.memo-free-page.is-editor .memo-free-textarea::placeholder{
  color:#94a3b8!important;
  opacity:1!important;
}


/* ============================================================
   v101: memo native textarea stability
   ============================================================ */
.memo-free-page.is-editor .memo-free-textarea{
  pointer-events:auto!important;
  cursor:text!important;
  display:block!important;
  line-height:1.45!important;
  white-space:pre!important;
  overflow:hidden!important;
}
.memo-free-page.is-editor .memo-free-text:focus-within{
  box-shadow:0 0 0 2px rgba(100,116,139,.16)!important;
  background:rgba(255,255,255,.72)!important;
}


/* ============================================================
   v102: font size inheritance + lighter text input repaint
   ============================================================ */
.memo-free-page.is-editor .memo-free-text{
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  line-height:1.45!important;
}
.memo-free-page.is-editor .memo-free-textarea,
.memo-free-page.is-editor textarea.memo-free-editable,
.memo-free-page.is-editor .memo-free-editable.memo-free-textarea{
  font-size:inherit!important;
  font-family:inherit!important;
  font-weight:500!important;
  line-height:1.45!important;
  color:inherit!important;
  will-change:width,height!important;
}
.memo-free-page.is-editor .memo-free-text.is-selected,
.memo-free-page.is-editor .memo-free-text:focus-within{
  transition:none!important;
}


/* ============================================================
   v103: quiet empty text boxes + lower typing repaint cost
   ============================================================ */
.memo-free-page.is-editor .memo-free-textarea::placeholder,
.memo-free-page.is-editor textarea.memo-free-editable::placeholder{
  color:transparent!important;
  opacity:0!important;
}
.memo-free-page.is-editor .memo-free-text:not(.is-selected):not(:focus-within){
  box-shadow:none!important;
}
.memo-free-page.is-editor .memo-free-textarea,
.memo-free-page.is-editor textarea.memo-free-editable{
  will-change:auto!important;
  transition:none!important;
}
.memo-free-page.is-editor .memo-free-text:focus-within{
  background:rgba(255,255,255,.58)!important;
}

/* ============================================================
   v104: link/video polish + multi-selection
   ============================================================ */
.memo-free-page.is-editor .memo-free-item.is-selected{
  border-color:#64748b!important;
  box-shadow:0 0 0 2px rgba(100,116,139,.20)!important;
}
.memo-free-marquee{
  position:absolute;
  z-index:9999;
  border:1px solid rgba(59,130,246,.72);
  background:rgba(59,130,246,.10);
  pointer-events:none;
  border-radius:2px;
}
.memo-free-media-frame img,
.memo-free-media-frame video,
.memo-free-video-link,
.memo-free-video-link img{
  object-fit:cover!important;
}
.memo-free-video-link{
  overflow:hidden!important;
  background:#000!important;
}
.memo-free-link-box{
  padding:7px 10px!important;
  background:#f8fafc!important;
  border:1px solid rgba(100,116,139,.22)!important;
  box-shadow:none!important;
}
.memo-free-link{
  display:block!important;
  color:#1d4ed8!important;
  font-weight:800!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  text-decoration:none!important;
}
.memo-free-link:hover{text-decoration:underline!important;}
.memo-free-link-host{
  margin-top:3px!important;
  font-size:11px!important;
  color:#64748b!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.memo-page-thumb .memo-free-link-host{display:none!important;}

/* ===== v106 flow document memo editor ===== */
body.memo-doc-open{overflow:hidden!important;}
.memo-doc-modal{position:fixed;inset:0;z-index:200000;background:#d2d8e2;color:#111827;display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;}
.memo-doc-modal.is-hidden{display:none!important;}
.memo-doc-topbar{height:auto;min-height:50px;background:rgba(17,24,39,.96);color:#eef2f7;border-bottom:1px solid rgba(255,255,255,.08);display:grid;grid-template-columns:minmax(220px,1fr) auto auto;gap:10px;align-items:center;padding:7px 12px;box-shadow:0 2px 16px rgba(0,0,0,.25);}
.memo-doc-top-main{display:grid;grid-template-columns:auto minmax(120px,420px);gap:9px;align-items:center;min-width:0;}
.memo-doc-heading{font-size:13px;font-weight:800;color:#facc15;white-space:nowrap;}
.memo-doc-title-input{height:32px;border:1px solid rgba(255,255,255,.16);border-radius:8px;background:#fff;color:#111827;padding:5px 10px;font-size:15px;font-weight:700;outline:none;min-width:0;}
.memo-doc-title-input:focus{border-color:#93c5fd;box-shadow:0 0 0 3px rgba(147,197,253,.18);}
.memo-doc-toolbar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end;}
.memo-doc-control{height:30px;border:1px solid rgba(255,255,255,.16);border-radius:7px;background:#fff;color:#111827;padding:3px 7px;font-size:13px;}
.memo-doc-color{width:34px;height:30px;border:1px solid rgba(255,255,255,.16);border-radius:7px;background:#fff;padding:2px;}
.memo-doc-btn{height:30px;border:1px solid rgba(255,255,255,.16);border-radius:8px;background:#253142;color:#eef2f7;padding:0 10px;font-size:12px;font-weight:700;cursor:pointer;}
.memo-doc-btn:hover{background:#334155;}
.memo-doc-status{font-size:11px;color:#cbd5e1;white-space:nowrap;min-width:56px;text-align:right;}
.memo-doc-scroll{flex:1;overflow:auto;padding:28px 0 80px;background:#cfd6e0;}
.memo-doc-page-shell{width:794px;min-height:1123px;margin:0 auto;background:#fff;border:1px solid #c7ccd4;box-shadow:0 6px 24px rgba(15,23,42,.18);}
.memo-doc-editor{min-height:1123px;padding:54px 62px 90px;outline:none;font-size:16px;line-height:1.62;color:#111827;word-break:break-word;overflow-wrap:anywhere;}
.memo-doc-editor:focus{box-shadow:inset 0 0 0 2px rgba(59,130,246,.18);}
.memo-doc-editor p{margin:0 0 .8em;}
.memo-doc-editor h1,.memo-doc-editor h2,.memo-doc-editor h3{line-height:1.35;margin:1em 0 .45em;}
.memo-doc-editor a{color:#1267d8;text-decoration:underline;text-underline-offset:2px;}
.memo-doc-img{display:block;max-width:100%;height:auto;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.08);}
.memo-doc-img.align-left,.memo-doc-video-card.align-left{float:left;margin:0 18px 12px 0;}
.memo-doc-img.align-right,.memo-doc-video-card.align-right{float:right;margin:0 0 12px 18px;}
.memo-doc-img.align-inline,.memo-doc-video-card.align-inline{float:none;margin:8px 0 12px 0;}
.memo-doc-editor img.memo-doc-selected,.memo-doc-editor video.memo-doc-selected,.memo-doc-editor iframe.memo-doc-selected{outline:2px solid #2563eb;outline-offset:2px;}
.memo-doc-video-card{width:360px;max-width:100%;margin:8px 0 14px;display:block;}
.memo-doc-video-card iframe,.memo-doc-video-card video{display:block;width:100%;aspect-ratio:16/9;border:0;background:#111;border-radius:2px;object-fit:cover;}
.memo-doc-video-card figcaption{font-size:12px;color:#64748b;margin-top:4px;line-height:1.4;}
.memo-doc-context-menu{position:fixed;z-index:200010;min-width:168px;background:#fff;border:1px solid #d6dbe4;border-radius:10px;box-shadow:0 14px 38px rgba(15,23,42,.22);padding:6px;}
.memo-doc-context-menu.is-hidden{display:none!important;}
.memo-doc-context-menu button{display:block;width:100%;border:0;background:transparent;color:#111827;text-align:left;border-radius:7px;padding:8px 10px;font-size:13px;cursor:pointer;}
.memo-doc-context-menu button:hover{background:#eff6ff;}
.memo-doc-grid{display:block;width:100%;}
.memo-doc-list-head{display:flex;align-items:center;gap:10px;justify-content:center;margin:10px 0 16px;}
.memo-doc-list-hint{font-size:12px;color:var(--text2,#94a3b8);}
.memo-doc-card-grid{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start;justify-content:center;max-width:1280px;margin:0 auto;padding:0 12px 24px;}
.memo-doc-card,.memo-doc-empty-card{width:178px;border:1px solid rgba(148,163,184,.45);border-radius:10px;background:#111923;color:#e5e7eb;text-align:left;padding:8px;cursor:pointer;box-shadow:0 6px 16px rgba(0,0,0,.18);}
.memo-doc-card:hover,.memo-doc-empty-card:hover{border-color:#60a5fa;box-shadow:0 8px 22px rgba(37,99,235,.22);}
.memo-doc-card-title{font-size:13px;font-weight:800;color:#facc15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px;}
.memo-doc-card-date{font-size:10px;color:#9ca3af;margin-bottom:5px;}
.memo-doc-thumb-page{width:160px;height:152px;background:#fff;border:1px solid #cfd6df;overflow:hidden;margin:0 auto;border-radius:2px;position:relative;}
.memo-doc-thumb-inner{width:794px;min-height:1123px;transform:scale(.2015);transform-origin:top left;padding:54px 62px 90px;background:#fff;color:#111827;font-size:16px;line-height:1.62;word-break:break-word;overflow-wrap:anywhere;}
.memo-doc-thumb-inner img{max-width:100%;height:auto;}
.memo-doc-thumb-inner .memo-doc-img.align-left,.memo-doc-thumb-inner .memo-doc-video-card.align-left{float:left;margin:0 18px 12px 0;}
.memo-doc-thumb-inner .memo-doc-img.align-right,.memo-doc-thumb-inner .memo-doc-video-card.align-right{float:right;margin:0 0 12px 18px;}
.memo-doc-thumb-inner iframe,.memo-doc-thumb-inner video{width:100%;aspect-ratio:16/9;background:#111;}
.memo-doc-empty-card{height:206px;display:flex;align-items:center;justify-content:center;text-align:center;color:#cbd5e1;font-weight:800;}
@media(max-width:900px){
  .memo-doc-topbar{grid-template-columns:1fr;gap:6px;}
  .memo-doc-toolbar{justify-content:flex-start;}
  .memo-doc-scroll{padding:14px 0 60px;}
  .memo-doc-page-shell{width:min(794px,calc(100vw - 20px));}
  .memo-doc-editor{padding:34px 28px 70px;min-height:calc((100vw - 20px) * 1.414);}
}

/* ===== doc memo selection / resize refinements v107 ===== */
.memo-doc-page-shell{
  position:relative!important;
  width:720px!important;
  min-height:1123px!important;
}
.memo-doc-editor{
  min-height:1123px!important;
  padding:42px 54px 90px!important;
  font-size:16px;
  line-height:1.62;
}
.memo-doc-editor p,
.memo-doc-editor div,
.memo-doc-editor h1,
.memo-doc-editor h2,
.memo-doc-editor h3,
.memo-doc-editor li,
.memo-doc-editor blockquote,
.memo-doc-editor pre{
  position:relative;
}
.memo-doc-media-box{
  position:relative;
  display:inline-block;
  max-width:100%;
  vertical-align:top;
  line-height:0;
  user-select:none;
  -webkit-user-select:none;
}
.memo-doc-media-box.align-left{float:left;margin:0 14px 10px 0;}
.memo-doc-media-box.align-right{float:right;margin:0 0 10px 14px;}
.memo-doc-media-box.align-inline{float:none;margin:8px 0 12px 0;display:block;}
.memo-doc-media-box img.memo-doc-img,
.memo-doc-media-box video,
.memo-doc-media-box iframe{
  width:100%!important;
  max-width:100%!important;
  height:auto;
  display:block;
  object-fit:cover;
  box-sizing:border-box;
}
.memo-doc-media-box .memo-doc-video-card{
  width:100%!important;
  margin:0!important;
  display:block;
  line-height:1.4;
}
.memo-doc-media-box .memo-doc-video-card iframe,
.memo-doc-media-box .memo-doc-video-card video{
  width:100%!important;
  aspect-ratio:16/9;
  border:0;
  border-radius:2px;
  background:#111;
  object-fit:cover;
}
.memo-doc-media-box .memo-doc-video-card figcaption{
  font-size:12px;
  color:#64748b;
  margin-top:4px;
  line-height:1.35;
}
.memo-doc-media-box::after{
  content:"";
  position:absolute;
  right:-5px;
  bottom:-5px;
  width:11px;
  height:11px;
  border-radius:3px;
  background:#64748b;
  border:2px solid #fff;
  box-shadow:0 1px 4px rgba(15,23,42,.25);
  opacity:0;
  cursor:nwse-resize;
}
.memo-doc-media-box:hover::after,
.memo-doc-media-box.memo-doc-selected::after,
.memo-doc-media-box.memo-doc-multi-selected::after{opacity:1;}
.memo-doc-editor .memo-doc-selected,
.memo-doc-editor .memo-doc-multi-selected{
  outline:2px solid #2563eb!important;
  outline-offset:2px;
  background:rgba(37,99,235,.08);
}
.memo-doc-editor .memo-doc-media-box.memo-doc-selected,
.memo-doc-editor .memo-doc-media-box.memo-doc-multi-selected{
  background:transparent;
}
.memo-doc-block-layer{
  position:absolute;
  left:15px;
  top:42px;
  bottom:0;
  width:28px;
  pointer-events:none;
  z-index:4;
}
.memo-doc-block-handle{
  position:absolute;
  left:0;
  width:24px;
  height:22px;
  border:1px solid transparent;
  border-radius:6px;
  background:transparent;
  color:#94a3b8;
  font-size:11px;
  line-height:1;
  cursor:grab;
  pointer-events:auto;
  opacity:.65;
}
.memo-doc-block-handle:hover,
.memo-doc-block-handle.is-selected{
  background:#e0ecff;
  color:#1d4ed8;
  border-color:#bfdbfe;
  opacity:1;
}
.memo-doc-block-handle:active{cursor:grabbing;}
.memo-doc-marquee{
  position:absolute;
  z-index:8;
  display:none;
  border:1px solid #2563eb;
  background:rgba(37,99,235,.10);
  pointer-events:none;
}
.memo-doc-context-menu button[data-disabled="true"]{opacity:.45;pointer-events:none;}
.memo-doc-thumb-page{width:160px!important;height:152px!important;}
.memo-doc-thumb-inner{width:720px!important;transform:scale(.2222)!important;padding:42px 54px 90px!important;}
@media(max-width:780px){
  .memo-doc-page-shell{width:min(720px,calc(100vw - 20px))!important;}
  .memo-doc-editor{padding:34px 34px 70px!important;min-height:calc((100vw - 20px) * 1.56)!important;}
  .memo-doc-block-layer{display:none;}
}

/* ===== doc memo line / drag / infinite refinements v108 ===== */
.memo-doc-page-shell{
  width:794px!important;
  min-height:calc(100vh - 150px)!important;
  height:auto!important;
  position:relative!important;
}
.memo-doc-editor{
  min-height:calc(100vh - 150px)!important;
  padding:34px 58px 80px 54px!important;
  font-size:16px!important;
  line-height:1.24!important;
  word-break:break-word!important;
  overflow-wrap:anywhere!important;
}
.memo-doc-editor p,
.memo-doc-editor div,
.memo-doc-editor li,
.memo-doc-editor blockquote,
.memo-doc-editor pre{
  margin-top:0!important;
  margin-bottom:0!important;
  line-height:1.24!important;
}
.memo-doc-editor h1,.memo-doc-editor h2,.memo-doc-editor h3{
  line-height:1.2!important;
  margin:.5em 0 .12em!important;
}
.memo-doc-editor:empty::before{
  content:"";
}
.memo-doc-block-layer{
  left:10px!important;
  top:34px!important;
  width:34px!important;
  bottom:0!important;
  pointer-events:none!important;
  z-index:8!important;
}
.memo-doc-block-handle{
  width:28px!important;
  min-height:18px!important;
  border-radius:4px!important;
  color:#111827!important;
  background:rgba(255,255,255,.72)!important;
  border:1px solid rgba(148,163,184,.35)!important;
  opacity:.85!important;
  font-size:12px!important;
  font-weight:700!important;
  line-height:1!important;
  cursor:grab!important;
  box-shadow:0 1px 2px rgba(15,23,42,.10)!important;
}
.memo-doc-block-handle:hover,
.memo-doc-block-handle.is-selected{
  background:#dbeafe!important;
  color:#1d4ed8!important;
  border-color:#60a5fa!important;
  opacity:1!important;
}
.memo-doc-block-dragging .memo-doc-block-handle{cursor:grabbing!important;}
.memo-doc-drop-marker{
  height:3px!important;
  margin:2px 0!important;
  padding:0!important;
  background:#2563eb!important;
  border-radius:999px!important;
  box-shadow:0 0 0 2px rgba(37,99,235,.18)!important;
  display:none;
  line-height:0!important;
  pointer-events:none!important;
}
.memo-doc-media-box{
  position:relative!important;
  display:inline-block!important;
  max-width:100%!important;
}
.memo-doc-media-box::after{display:none!important;}
.memo-doc-resize-handle{
  position:absolute!important;
  right:-6px!important;
  bottom:-6px!important;
  width:13px!important;
  height:13px!important;
  border-radius:3px!important;
  background:#64748b!important;
  border:2px solid #fff!important;
  box-shadow:0 1px 5px rgba(15,23,42,.28)!important;
  cursor:nwse-resize!important;
  z-index:6!important;
  opacity:0!important;
}
.memo-doc-media-box:hover > .memo-doc-resize-handle,
.memo-doc-media-box.memo-doc-selected > .memo-doc-resize-handle,
.memo-doc-media-box.memo-doc-multi-selected > .memo-doc-resize-handle{opacity:1!important;}
.memo-doc-editor .memo-doc-selected,
.memo-doc-editor .memo-doc-multi-selected{
  outline:2px solid #2563eb!important;
  outline-offset:1px!important;
  background:rgba(37,99,235,.10)!important;
}
.memo-doc-marquee{
  position:absolute!important;
  z-index:20!important;
  border:1px solid #2563eb!important;
  background:rgba(37,99,235,.10)!important;
  display:none;
  pointer-events:none!important;
}
.memo-doc-thumb-page{width:160px!important;height:152px!important;}
.memo-doc-thumb-inner{
  width:794px!important;
  min-height:0!important;
  transform:scale(.2015)!important;
  transform-origin:top left!important;
  padding:34px 58px 80px 54px!important;
  line-height:1.24!important;
}
.memo-doc-thumb-inner p,.memo-doc-thumb-inner div,.memo-doc-thumb-inner li{margin:0!important;line-height:1.24!important;}
@media(max-width:860px){
  .memo-doc-page-shell{width:min(794px,calc(100vw - 20px))!important;}
  .memo-doc-editor{padding:30px 36px 70px 44px!important;}
  .memo-doc-block-layer{display:none!important;}
}
.memo-doc-media-box{line-height:0!important;}
.memo-doc-media-box .memo-doc-video-card{line-height:1.25!important;}


/* ===== doc memo media/list fixes v109 ===== */
.memo-doc-page-shell{width:794px!important;min-height:calc(100vh - 150px)!important;height:auto!important;}
.memo-doc-editor{line-height:1.22!important;}
.memo-doc-editor p,
.memo-doc-editor div,
.memo-doc-editor li,
.memo-doc-editor blockquote,
.memo-doc-editor pre{line-height:1.22!important;margin-top:0!important;margin-bottom:0!important;}
.memo-doc-editor ul,
.memo-doc-editor ol{list-style:none!important;margin:0!important;padding:0!important;}
.memo-doc-editor li{display:block!important;}
.memo-doc-block-handle{height:auto!important;min-height:12px!important;font-size:11px!important;padding:0!important;display:flex!important;align-items:center!important;justify-content:center!important;}
.memo-doc-media-box{position:relative!important;display:inline-block!important;line-height:0!important;cursor:default!important;}
.memo-doc-media-box img.memo-doc-img{display:block!important;width:100%!important;height:auto!important;object-fit:contain!important;}
.memo-doc-media-box iframe,
.memo-doc-media-box video{display:block!important;width:100%!important;aspect-ratio:16/9!important;object-fit:cover!important;pointer-events:none!important;}
.memo-doc-media-box .memo-doc-video-card{position:relative!important;width:100%!important;margin:0!important;line-height:1.2!important;}
.memo-doc-media-box .memo-doc-video-card::after{
  content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:clamp(18px,18%,46px);height:clamp(18px,18%,46px);border-radius:999px;
  background:rgba(0,0,0,.48);box-shadow:0 2px 8px rgba(0,0,0,.25);pointer-events:none;
}
.memo-doc-media-box .memo-doc-video-card::before{
  content:"";position:absolute;left:50%;top:50%;transform:translate(-38%,-50%);z-index:1;
  border-left:clamp(7px,6%,15px) solid rgba(255,255,255,.95);
  border-top:clamp(5px,4.5%,11px) solid transparent;
  border-bottom:clamp(5px,4.5%,11px) solid transparent;pointer-events:none;
}
.memo-doc-media-box .memo-doc-video-card figcaption{line-height:1.25!important;margin-top:3px!important;}
.memo-doc-resize-handle{display:block!important;pointer-events:auto!important;z-index:20!important;opacity:.35!important;}
.memo-doc-media-box:hover > .memo-doc-resize-handle,
.memo-doc-media-box.memo-doc-selected > .memo-doc-resize-handle,
.memo-doc-media-box.memo-doc-multi-selected > .memo-doc-resize-handle{opacity:1!important;}
.memo-doc-editor .memo-doc-selected,
.memo-doc-editor .memo-doc-multi-selected{outline:2px solid #2563eb!important;outline-offset:1px!important;background:rgba(37,99,235,.10)!important;}
.memo-doc-editor .memo-doc-media-box.memo-doc-selected,
.memo-doc-editor .memo-doc-media-box.memo-doc-multi-selected{background:transparent!important;}

/* ===== doc memo media drag/sync fixes v110 ===== */
.memo-doc-media-box{
  position:relative!important;
  display:inline-block!important;
  max-width:100%!important;
  line-height:0!important;
  user-select:none!important;
  -webkit-user-select:none!important;
  touch-action:none!important;
}
.memo-doc-media-box.align-left{float:left!important;margin:0 14px 10px 0!important;}
.memo-doc-media-box.align-right{float:right!important;margin:0 0 10px 14px!important;}
.memo-doc-media-box.align-inline{float:none!important;display:block!important;margin:8px 0 12px!important;}
.memo-doc-media-box img.memo-doc-img,
.memo-doc-media-box iframe,
.memo-doc-media-box video{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
.memo-doc-media-box img.memo-doc-img{height:auto!important;object-fit:contain!important;}
.memo-doc-media-box iframe,
.memo-doc-media-box video{aspect-ratio:16/9!important;object-fit:cover!important;pointer-events:none!important;}
.memo-doc-media-box .memo-doc-video-card{position:relative!important;width:100%!important;margin:0!important;line-height:1.2!important;}
.memo-doc-media-hit{
  position:absolute!important;
  inset:0!important;
  z-index:14!important;
  display:block!important;
  background:transparent!important;
  cursor:grab!important;
  pointer-events:auto!important;
}
.memo-doc-media-hit:active{cursor:grabbing!important;}
.memo-doc-resize-handle{
  position:absolute!important;
  right:-6px!important;
  bottom:-6px!important;
  width:13px!important;
  height:13px!important;
  border-radius:3px!important;
  background:#64748b!important;
  border:2px solid #fff!important;
  box-shadow:0 1px 5px rgba(15,23,42,.28)!important;
  cursor:nwse-resize!important;
  z-index:30!important;
  opacity:0!important;
  pointer-events:none!important;
}
.memo-doc-media-box.memo-doc-selected > .memo-doc-resize-handle,
.memo-doc-media-box.memo-doc-multi-selected > .memo-doc-resize-handle{
  opacity:1!important;
  pointer-events:auto!important;
}
.memo-doc-media-box:hover > .memo-doc-resize-handle{opacity:0!important;pointer-events:none!important;}
.memo-doc-editor .memo-doc-media-box.memo-doc-selected,
.memo-doc-editor .memo-doc-media-box.memo-doc-multi-selected{
  outline:2px solid #2563eb!important;
  outline-offset:2px!important;
  background:transparent!important;
}
.memo-doc-editor .memo-doc-selected:not(.memo-doc-media-box),
.memo-doc-editor .memo-doc-multi-selected:not(.memo-doc-media-box){
  outline:2px solid #2563eb!important;
  outline-offset:1px!important;
  background:rgba(37,99,235,.10)!important;
}
.memo-doc-block-handle{
  min-height:16px!important;
  height:16px!important;
  line-height:1!important;
  z-index:40!important;
}
.memo-doc-block-layer{z-index:40!important;}
.memo-doc-drop-marker{display:none;}
.memo-doc-marquee{z-index:60!important;}

/* ===== v111 row-based split memo editor ===== */
.row-memo-modal{position:fixed;inset:0;z-index:5000;background:#111827;color:#111827;display:flex;flex-direction:column}
.row-memo-modal.is-hidden{display:none!important}
.row-memo-head{flex:0 0 auto;background:#17202c;color:#dbeafe;border-bottom:1px solid #263244;padding:8px 10px;display:flex;gap:10px;align-items:center;min-height:48px}
.row-memo-title-wrap{display:grid;grid-template-columns:auto minmax(220px,520px);align-items:center;gap:8px;min-width:0}
.row-memo-label{font-weight:800;color:#facc15;font-size:14px;white-space:nowrap}
.row-memo-title{height:32px;border-radius:8px;border:1px solid #334155;background:#fff;color:#111827;padding:4px 10px;font-weight:700;font-size:15px;min-width:180px;width:100%}
.row-memo-tools{display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin-left:auto}
.row-memo-tools button,.row-memo-context button{border:1px solid #334155;background:#263244;color:#f8fafc;border-radius:8px;padding:7px 10px;font-weight:700;font-size:12px;cursor:pointer}
.row-memo-tools button.primary{background:#2563eb;border-color:#3b82f6}.row-memo-tools .sep{width:1px;height:24px;background:#334155;margin:0 4px}
.row-memo-body{flex:1;overflow:auto;background:#cbd5e1;padding:24px 12px 64px;display:flex;justify-content:center;align-items:flex-start}
.row-memo-page{width:min(100%,980px);min-height:calc(100vh - 150px);background:#fff;border:1px solid #1f2937;box-shadow:0 10px 28px rgba(0,0,0,.22);padding:10px 10px 80px;box-sizing:border-box}
.row-memo-rows{display:flex;flex-direction:column;gap:6px}
.row-memo-row{position:relative;display:grid;grid-template-columns:34px minmax(0,1fr);gap:4px;border:1px solid #111827;background:#fff;min-height:38px}
.row-memo-row.is-selected{outline:2px solid #2563eb;outline-offset:1px;background:#eff6ff}.row-memo-row.is-drop-target{box-shadow:0 0 0 3px rgba(245,158,11,.75)}
.row-memo-row-handle{appearance:none;border:0;border-right:1px solid #cbd5e1;background:#f8fafc;color:#111827;font-weight:800;font-size:14px;cursor:grab;user-select:none;min-height:38px}
.row-memo-row-handle:active{cursor:grabbing}.row-memo-cell-grid{display:grid;gap:0;min-width:0}.row-memo-cell-grid.cols-1{grid-template-columns:1fr}.row-memo-cell-grid.cols-2{grid-template-columns:1fr 1fr}.row-memo-cell-grid.cols-3{grid-template-columns:1fr 1fr 1fr}
.row-memo-cell{min-height:38px;padding:8px 10px;outline:none;font-size:16px;line-height:1.42;overflow-wrap:anywhere;word-break:break-word;white-space:normal}.row-memo-cell+.row-memo-cell{border-left:1px solid #111827}.row-memo-cell:focus{box-shadow:inset 0 0 0 2px rgba(37,99,235,.35)}
.row-memo-cell p{margin:0 0 .25em}.row-memo-cell p:last-child{margin-bottom:0}.row-memo-cell div{margin:0}.row-memo-cell ul,.row-memo-cell ol{margin:.2em 0 .2em 1.5em}.row-memo-cell a{color:#1267d8;text-decoration:underline;text-underline-offset:2px;font-weight:600}
.row-memo-media{position:relative;display:inline-block;vertical-align:top;margin:2px 10px 6px 0;max-width:100%;min-width:80px;line-height:0;border:1px solid transparent;background:#fff;box-sizing:border-box}.row-memo-media img,.row-memo-media video,.row-memo-media iframe{display:block;width:100%;height:auto;border:0;box-sizing:border-box}.row-memo-video-frame{display:block;position:relative;width:100%;aspect-ratio:16/9;background:#111;overflow:hidden}.row-memo-video-frame iframe,.row-memo-video-frame video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.row-memo-media.align-left{float:left}.row-memo-media.align-right{float:right;margin-left:10px;margin-right:0}.row-memo-media.align-inline{float:none;margin:2px 6px 4px 0}
.row-memo-media.is-selected{outline:2px solid #2563eb;outline-offset:2px}.row-memo-resize{display:none;position:absolute;right:-7px;bottom:-7px;width:13px;height:13px;border-radius:4px;background:#2563eb;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);cursor:nwse-resize;z-index:5}.row-memo-media.is-selected>.row-memo-resize{display:block}.row-memo-media.is-drag-source{opacity:.35}
.row-memo-context{position:fixed;z-index:5100;min-width:150px;background:#111827;color:#fff;border:1px solid #334155;border-radius:10px;padding:6px;box-shadow:0 16px 40px rgba(0,0,0,.35);display:flex;flex-direction:column;gap:4px}.row-memo-context.is-hidden{display:none!important}.row-memo-context button{text-align:left;background:transparent;border:0;color:#fff;padding:8px 10px;border-radius:7px}.row-memo-context button:hover{background:#334155}
.row-memo-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:12px;margin-top:12px}.row-memo-card{display:block;text-align:left;border:1px solid var(--border,#334155);border-radius:10px;background:var(--bg2,#fff);color:var(--text,#111);padding:8px;cursor:pointer}.row-memo-card-title{font-weight:800;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.row-memo-card-date{font-size:11px;color:var(--text2,#667);margin:2px 0 6px}.row-memo-thumb{height:180px;background:#fff;border:1px solid #cbd5e1;overflow:hidden;transform-origin:top left;font-size:8px;color:#111}.row-memo-thumb-row{display:grid;border-bottom:1px solid #222;min-height:18px}.row-memo-thumb-row.cols-1{grid-template-columns:1fr}.row-memo-thumb-row.cols-2{grid-template-columns:1fr 1fr}.row-memo-thumb-row.cols-3{grid-template-columns:1fr 1fr 1fr}.row-memo-thumb-row>div{padding:2px;border-right:1px solid #222;overflow:hidden}.row-memo-thumb img,.row-memo-thumb video,.row-memo-thumb iframe{max-width:100%;height:auto}
@media(max-width:720px){.row-memo-head{align-items:flex-start;flex-direction:column}.row-memo-title-wrap{grid-template-columns:1fr;width:100%}.row-memo-tools{margin-left:0}.row-memo-body{padding:10px 6px}.row-memo-page{width:100%;padding:8px 6px 70px}.row-memo-cell-grid.cols-2,.row-memo-cell-grid.cols-3{grid-template-columns:1fr}.row-memo-cell+.row-memo-cell{border-left:0;border-top:1px solid #111827}.row-memo-row{grid-template-columns:30px minmax(0,1fr)}}


/* ===== row memo v114 stabilization ===== */
#memoContainer.row-memo-only > .memo-card,
#memoContainer.row-memo-only > .memo-card-empty,
#memoContainer.row-memo-only > .memo-doc-card,
#memoContainer.row-memo-only > .memo-doc-empty-card,
#memoContainer.row-memo-only > .memo-global-card{display:none!important}
.row-memo-list-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.row-memo-list-hint{font-size:12px;color:var(--text2,#667)}
.row-memo-card-grid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr))!important;align-items:start}
.row-memo-card{position:relative;min-height:252px;overflow:hidden}
.row-memo-card-delete{position:absolute;right:7px;top:7px;border:1px solid #d0d7de;background:#fff;color:#475569;border-radius:7px;padding:3px 8px;font-size:11px;cursor:pointer;opacity:.75}
.row-memo-card-delete:hover{opacity:1;background:#fee2e2;color:#991b1b;border-color:#fecaca}
.row-memo-card-meta{padding-right:48px}
.row-memo-empty-card{padding:18px;border:1px dashed var(--border,#ccd);border-radius:10px;color:var(--text2,#667);background:var(--bg2,#fff)}
.row-memo-media{user-select:none;min-height:30px}
.row-memo-media-hit{position:absolute;inset:0;z-index:3;background:transparent;cursor:pointer;display:block}
.row-memo-media iframe,.row-memo-media video{pointer-events:none}
.row-memo-media.is-selected iframe,.row-memo-media.is-selected video{pointer-events:none}
.row-memo-media.is-selected{outline:2px solid #2563eb;outline-offset:2px;background:rgba(37,99,235,.035)}
.row-memo-resize{z-index:6!important;display:none!important}
.row-memo-media.is-selected>.row-memo-resize{display:block!important}
.row-memo-media.align-left{float:left!important;margin:2px 10px 6px 0!important}
.row-memo-media.align-right{float:right!important;margin:2px 0 6px 10px!important}
.row-memo-media.align-inline{float:none!important;display:inline-block!important;margin:2px 6px 4px 0!important}
.row-memo-cell:after{content:"";display:block;clear:both}
.row-memo-context button{white-space:nowrap}
.row-memo-row-handle{touch-action:none}
.row-memo-cell{line-height:1.35!important;padding:6px 9px!important}
.row-memo-cell p{margin:0 0 .12em!important}
.row-memo-cell-grid.cols-2 .row-memo-cell,.row-memo-cell-grid.cols-3 .row-memo-cell{min-height:58px}
.row-memo-thumb{height:180px!important}
.row-memo-thumb .row-memo-media-hit,.row-memo-thumb .row-memo-resize{display:none!important}
@media(max-width:720px){.row-memo-card-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))!important}.row-memo-thumb{height:150px!important}}


/* ===== row memo v115: stable grid, visible title, media ops ===== */
#memoContainer.row-memo-only{
  display:block!important;
  width:100%!important;
  max-width:none!important;
}
#memoContainer.row-memo-only .row-memo-list-head{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  width:100%!important;
  margin:0 0 12px!important;
}
#memoContainer.row-memo-only .row-memo-card-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr))!important;
  gap:12px!important;
  width:100%!important;
  max-width:none!important;
  align-items:start!important;
}
#memoContainer.row-memo-only .row-memo-card{
  min-width:0!important;
  min-height:286px!important;
}
#memoContainer.row-memo-only .row-memo-thumb{
  height:210px!important;
}
.row-memo-title{
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  opacity:1!important;
  background:#ffffff!important;
  border-color:#64748b!important;
}
.row-memo-title::placeholder{
  color:#64748b!important;
  opacity:1!important;
}
.row-memo-media{
  position:relative!important;
  user-select:none!important;
  cursor:pointer!important;
}
.row-memo-media img,
.row-memo-media iframe,
.row-memo-media video{
  pointer-events:none!important;
}
.row-memo-media.is-selected{
  outline:2px solid #2563eb!important;
  outline-offset:2px!important;
  background:rgba(37,99,235,.04)!important;
}
.row-memo-media .row-memo-media-hit{
  position:absolute!important;
  inset:0!important;
  z-index:4!important;
  display:block!important;
  background:transparent!important;
  cursor:pointer!important;
}
.row-memo-media .row-memo-resize{
  display:none!important;
  position:absolute!important;
  right:-7px!important;
  bottom:-7px!important;
  width:14px!important;
  height:14px!important;
  border-radius:4px!important;
  background:#2563eb!important;
  border:2px solid #fff!important;
  box-shadow:0 2px 6px rgba(15,23,42,.28)!important;
  cursor:nwse-resize!important;
  z-index:8!important;
}
.row-memo-media.is-selected > .row-memo-resize{
  display:block!important;
}
.row-memo-media.row-memo-dragging{
  opacity:.45!important;
}
.row-memo-context{
  min-width:188px!important;
}
.row-memo-context .row-memo-context-sep{
  height:1px!important;
  background:#334155!important;
  margin:4px 2px!important;
}
@media(max-width:720px){
  #memoContainer.row-memo-only .row-memo-card-grid{
    grid-template-columns:repeat(auto-fill,minmax(160px,1fr))!important;
  }
  #memoContainer.row-memo-only .row-memo-thumb{height:170px!important;}
}

/* ===== row memo v116: realtime/video/title polish ===== */
.row-memo-title,
#rowMemoTitle{
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  opacity:1!important;
  background:#ffffff!important;
  border:1px solid #64748b!important;
  box-shadow:inset 0 0 0 1px rgba(15,23,42,.06)!important;
}
.row-memo-title:focus,
#rowMemoTitle:focus{
  color:#111827!important;
  -webkit-text-fill-color:#111827!important;
  background:#ffffff!important;
  outline:2px solid rgba(37,99,235,.35)!important;
}
.row-memo-media .row-memo-media-hit{display:block!important;pointer-events:auto!important;}
.row-memo-media.is-selected .row-memo-media-hit{display:none!important;pointer-events:none!important;}
.row-memo-media iframe,
.row-memo-media video{pointer-events:none!important;}
.row-memo-media.is-selected iframe,
.row-memo-media.is-selected video{pointer-events:auto!important;}
.row-memo-video-frame{position:relative!important;background:#111!important;overflow:hidden!important;}
.row-memo-video-thumb{display:block!important;width:100%!important;height:100%!important;object-fit:cover!important;}
.row-memo-video-play{
  position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;
  width:clamp(22px,18%,48px)!important;height:clamp(16px,13%,34px)!important;
  border:0!important;border-radius:8px!important;background:#ef1d1d!important;box-shadow:0 2px 8px rgba(0,0,0,.24)!important;
  cursor:pointer!important;z-index:5!important;padding:0!important;
}
.row-memo-video-play:before{
  content:"";position:absolute;left:50%;top:50%;transform:translate(-38%,-50%);
  border-left:clamp(7px,4.5vw,14px) solid #fff;
  border-top:clamp(5px,3.2vw,9px) solid transparent;
  border-bottom:clamp(5px,3.2vw,9px) solid transparent;
}
.row-memo-media.is-selected > .row-memo-resize{display:block!important;}
.row-memo-media:not(.is-selected) > .row-memo-resize{display:none!important;}
.row-memo-cell .row-memo-media.align-left{float:left!important;margin:2px 10px 6px 0!important;}
.row-memo-cell .row-memo-media.align-right{float:right!important;margin:2px 0 6px 10px!important;}
.row-memo-cell .row-memo-media.align-inline{float:none!important;display:inline-block!important;margin:2px 6px 4px 0!important;}

.row-memo-video-play:before{
  content:""!important;position:absolute!important;left:50%!important;top:50%!important;transform:translate(-38%,-50%)!important;
  width:34%!important;height:44%!important;background:#fff!important;clip-path:polygon(0 0,100% 50%,0 100%)!important;
  border:0!important;
}

/* ===== row memo v117 title/link/split visibility fixes ===== */
.row-memo-card-title,
.row-memo-card-meta,
.row-memo-title,
#rowMemoTitle{
  color:#111827 !important;
  -webkit-text-fill-color:#111827 !important;
  opacity:1 !important;
  visibility:visible !important;
  text-shadow:none !important;
  filter:none !important;
}
.row-memo-card-title{
  background:transparent !important;
  font-weight:800 !important;
}
#rowMemoTitle,
.row-memo-title{
  background:#fff !important;
  border:1px solid #334155 !important;
  caret-color:#111827 !important;
}
.row-memo-context{
  z-index:99999 !important;
  min-width:210px !important;
}
.row-memo-context button{
  display:block !important;
  width:100% !important;
  white-space:nowrap !important;
  color:#fff !important;
  opacity:1 !important;
}

/* v119 memo header count fix: no visual change */


/* Row memo close/shortcut guard v120 */
#rowMemoModal{pointer-events:auto!important;z-index:99999!important;}
#rowMemoModal.is-hidden{display:none!important;}
#rowMemoModal .row-memo-body{pointer-events:auto!important;}
#rowMemoModal .row-memo-page,#rowMemoModal .row-memo-head{pointer-events:auto!important;}

/* ===== row memo modal shield / render guard v122 ===== */
body.row-memo-open > *:not(#rowMemoModal) {
  pointer-events: none !important;
  user-select: none !important;
}
#rowMemoModal:not(.is-hidden) {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483640 !important;
  pointer-events: auto !important;
}
#rowMemoModal:not(.is-hidden) .row-memo-head,
#rowMemoModal:not(.is-hidden) .row-memo-body,
#rowMemoModal:not(.is-hidden) #rowMemoPage,
#rowMemoModal:not(.is-hidden) #rowMemoContext {
  pointer-events: auto !important;
}


/* v417_remove_single_page: UI cleanup requested by user */
#view_quiz > .chapter-head {
  display: none !important;
}
.sheet-result-note {
  display: none !important;
}
.toc-qa-collection-link {
  display: block;
  margin: 10px 12px 14px;
  padding: 20px 16px;
  border-radius: 18px;
  background: #172531;
  border: 1px solid rgba(102,179,255,.35);
  color: #dff1ff;
  font-weight: 950;
  font-size: 20px;
  text-align: center;
  text-decoration: none;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
}
.toc-qa-collection-link:hover {
  border-color: rgba(96,165,250,.72);
  background: #1a2d3d;
}
