/* ========== 全屏编辑界面 (Scroll Fixed) ========== */
        .edit-overlay-screen {
          position: fixed; top: 0; left: 0; width: 100%; height: 100%;
          background: #FFFFFF; 
          z-index: 200;
          display: flex; flex-direction: column; /* 纵向布局 */
          transform: translateY(100%);
          padding-top: env(safe-area-inset-top);
          overflow: hidden; /* 防止整个屏幕滚动，只让内容区滚 */
        }
        .edit-overlay-screen.visible { transform: translateY(0); }

        .edit-header {
          padding: 10px 16px; display: flex; justify-content: space-between; align-items: center;
          flex-shrink: 0; /* 防止头部被挤压 */
          background: #FFFFFF; z-index: 202;
        }

        .edit-cancel { padding: 8px; color: #B0BEC5; cursor: pointer; font-size: 13px; font-weight: 300;}
        
         .edit-confirm { 
          padding: 8px; 
          background: transparent; 
          color: #B0BEC5; 
          border-radius: 50%; 
          cursor: pointer; 
          display: flex;
          align-items: center;
          justify-content: center;
          transition: color 0.1s;
          /* FIX: Ensure high z-index and pointer */
          z-index: 210;
        }
        .edit-confirm:active { color: #000000; }
        .edit-confirm svg { width: 24px; height: 24px; stroke-width: 1.5; stroke: currentColor; fill: none; }
        
        .edit-textarea-container {
          flex: 1; /* 自动占据剩余高度 */
          padding: 20px 24px;
          position: relative;
          overflow-y: auto; /* 核心：只在这里开启滚动 */
          -webkit-overflow-scrolling: touch; /* 丝滑滚动 */
          /* 底部留白，防止内容被工具栏遮挡，虽然工具栏现在在外面，但留白更安全 */
          padding-bottom: 80px; 
        }
        
        /* 确保输入框本身撑开高度但不限制滚动 */
        .edit-input-div {
          width: 100%; 
          min-height: 100%; /* 至少占满容器 */
          border: none; outline: none;
          font-family: var(--font-serif); 
          font-size: var(--edit-font-size-base);
          color: #263238; line-height: 1.8;
          font-weight: 300; background: transparent;
          white-space: pre-wrap;
          text-align: left;
          overflow: visible; /* 让父容器处理滚动 */
        }
         .edit-input-div:empty:before {
          content: attr(placeholder);
          color: #CFD8DC;
          font-style: italic;
        }

        /* 修复工具栏位置 */
        .edit-toolbar-container {
          position: relative; /* 改为相对布局，或者保持fixed但不再遮挡 */
          /* 如果希望键盘弹出时工具栏跟随，保持fixed更好，但上面的padding-bottom要够 */
          position: fixed; 
          bottom: 0; left: 0; width: 100%;
          border-top: 1px solid rgba(0,0,0,0.03);
          background: rgba(255,255,255,0.98);
          padding-bottom: env(safe-area-inset-bottom);
          z-index: 1000;
        }
        
        
        /* Style for Quoted Text in Editor */
        .quote-style {
          color: #B0BEC5;
          border-left: 1.5px solid #E0E0E0;
          padding-left: 10px;
          display: block;
 
          margin: 0 !important; /* 去除外边距，消除间隙 */
          padding-top: 4px;
          padding-bottom: 4px; /* 用内边距保持文字呼吸感 */
        }

        /* KEYBOARD FIX: Fixed position toolbar to sit above keyboard */
        .edit-toolbar-container {
          position: fixed;
          bottom: 0;
          left: 0;
          width: 100%;
          border-top: 1px solid rgba(0,0,0,0.03);
          background: rgba(255,255,255,0.95);
          padding-bottom: env(safe-area-inset-bottom);
          z-index: 1000;
        }

        .edit-toolbar-scroll {
          display: flex; 
          gap: var(--edit-toolbar-gap); 
          padding: 8px 16px;
          overflow-x: auto; -webkit-overflow-scrolling: touch;
          scrollbar-width: none;
        }
        .edit-toolbar-scroll::-webkit-scrollbar { display: none; }

        .toolbar-group {
          display: flex; 
          gap: var(--edit-toolbar-gap);
          padding-right: 0; border-right: none; margin-right: 0;
        }
        
        .toolbar-group-tight {
          display: flex;
          gap: var(--edit-group-gap);
        }

        .toolbar-btn {
          height: 28px; min-width: 28px; padding: 0 8px;
          display: flex; align-items: center; justify-content: center;
          border-radius: 6px;
          background: var(--edit-key-bg);
          color: var(--edit-key-color);
          font-size: 11px; font-family: var(--font-sans);
          cursor: pointer; transition: background 0.2s, color 0.2s;
          white-space: nowrap;
        }
        .toolbar-btn:active { background: rgba(0,0,0,0.03); color: #263238; }
        .toolbar-btn svg { width: 12.4px; height: 12.4px; stroke-width: 1.2; stroke: currentColor; fill: none; }
        .toolbar-text { font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 300; font-family: var(--font-sans); }
        .toolbar-btn.active-state { color: #000; background: rgba(0,0,0,0.05); }

        /* Optimised Status Input in Toolbar */
        .toolbar-status-input {
          border: none; background: transparent;
          font-family: var(--font-sans); font-size: 10px;
          color: #546E7A; 
          width: 60px;
          text-transform: uppercase; letter-spacing: 0.5px;
          text-align: center;
        }
        .toolbar-status-input:focus { outline: none; color: #B0BEC5; font-weight: 300; font-size: 10px; }
        .toolbar-status-input::placeholder { color: #B0BEC5; font-weight: 300; font-size: 8px; }

        /* Edit Partition Selector Menu */
        .edit-partition-popover {
          position: absolute;
          bottom: calc(100% + 5px);
          left: 50%;
          transform: translateX(-50%);
          background: #fff;
          box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
          border-radius: 12px;
          padding: 8px;
          min-width: 160px;
          display: none;
          flex-direction: column;
          z-index: 1002;
          max-height: 200px;
          overflow-y: auto;
        }
        .edit-partition-popover.visible { display: flex; }
        .edit-part-item {
          padding: 10px 12px;
          font-size: 11px;
          color: #546E7A;
          border-radius: 6px;
        }
        .edit-part-item:active { background: #f5f5f5; }
        .edit-part-item.selected { color: #000; font-weight: 500; background: #f0f0f0; }