editor.css (7.3 KB)
1 :root { 2 --text-color: #f8f8f2; 3 --editor-bg: #16181b; 4 scrollbar-color: grey var(--editor-bg); 5 } 6 7 * { 8 margin: 0; 9 padding: 0; 10 box-sizing: border-box; 11 } 12 13 html, body { 14 overscroll-behavior: none; 15 background-color: var(--editor-bg); 16 } 17 18 html { 19 height: 100%; 20 } 21 22 body { 23 font-family: monospace; 24 background: var(--editor-bg); 25 color: var(--text-color); 26 height: 100%; 27 display: flex; 28 overflow: hidden; 29 } 30 31 .editor-pane { 32 width: 50%; 33 height: 100%; 34 position: relative; 35 transition: opacity 0.1s ease-out; 36 } 37 38 .preview-pane { 39 width: 50%; 40 height: 100%; 41 display: flex; 42 flex-direction: column; 43 --grid-width: 33px; 44 --grid-height: 33px; 45 --spread-left: 0px; 46 --spread-top: 0px; 47 background: 48 linear-gradient(to bottom, #1a4d3a, #184534); 49 } 50 51 .preview-pane.grid-ready { 52 background: 53 linear-gradient(to right, #4a7a6a 1px, transparent 1px), 54 linear-gradient(to bottom, #4a7a6a 1px, transparent 1px), 55 linear-gradient(to bottom, #1a4d3a, #184534); 56 background-size: var(--grid-width) var(--grid-height), var(--grid-width) var(--grid-height), 100% 100%; 57 background-position: 58 calc(var(--spread-left) + var(--grid-width) / 2) var(--spread-top), 59 calc(var(--spread-left) + var(--grid-width) / 2) var(--spread-top), 60 0 0; 61 } 62 63 .preview-pane.fullscreen { 64 position: fixed; 65 top: 0; 66 left: 0; 67 width: 100vw; 68 height: 100dvh; 69 z-index: 9999; 70 } 71 72 .preview-pane.fullscreen .spread-nav { 73 padding-bottom: calc(12px + env(safe-area-inset-bottom)); 74 } 75 76 .editor-pane.hidden { 77 display: none; 78 } 79 80 #editor { 81 width: 100%; 82 height: 100%; 83 font-family: monospace; 84 font-size: 21px; 85 outline: none; 86 } 87 88 .editor-pane:focus, 89 .editor-pane:focus-within { 90 outline: none; 91 } 92 93 /* CodeMirror styling */ 94 .cm-editor { 95 width: 100%; 96 height: 100%; 97 background: var(--editor-bg); 98 color: var(--text-color); 99 } 100 101 .cm-placeholder { 102 color: #666; 103 opacity: 0.6; 104 } 105 106 .cm-content { 107 padding: 15px; 108 font-size: 21px; 109 line-height: 1.6; 110 } 111 112 .cm-gutters { 113 font-size: 21px; 114 line-height: 1.6; 115 user-select: none; 116 } 117 118 .cm-lineNumbers .cm-gutterElement { 119 line-height: 1.6; 120 font-size: 21px; 121 } 122 123 .ΝΌ1 .cm-lineNumbers .cm-gutterElement { 124 padding-right: 0; 125 padding-left: 8px; 126 } 127 128 .cm-focused { 129 outline: none; 130 } 131 132 /* Remove any focus rings/borders from CodeMirror elements */ 133 .cm-editor, 134 .cm-editor *, 135 .cm-editor *:focus, 136 .cm-scroller, 137 .cm-scroller:focus, 138 .cm-content, 139 .cm-content:focus { 140 outline: none !important; 141 box-shadow: none !important; 142 } 143 144 /* Remove any focus indicators from CodeMirror gutters */ 145 .cm-gutters { 146 border-right: none !important; 147 } 148 149 /* Hide the selection layer border that can appear on the right edge */ 150 .cm-selectionLayer { 151 border: none !important; 152 } 153 154 /* Target the focus ring that appears next to scrollbar */ 155 .cm-scroller:focus-visible, 156 .cm-editor:focus-visible, 157 .cm-content:focus-visible { 158 outline: none !important; 159 } 160 161 /* Ensure no focus styling on any focusable element within editor */ 162 #editor *:focus { 163 outline: none !important; 164 box-shadow: none !important; 165 border-color: transparent !important; 166 } 167 168 /* Remove macOS focus ring */ 169 #editor { 170 -webkit-focus-ring-color: transparent; 171 } 172 173 #editor *:focus { 174 -webkit-focus-ring-color: transparent; 175 } 176 177 .cm-editor .cm-content, 178 .cm-editor .cm-line, 179 .cm-editor { 180 tab-size: 2 !important; 181 -moz-tab-size: 2 !important; 182 } 183 184 .cm-editor, .cm-content, .cm-scroller, .cm-scrollElement { 185 overscroll-behavior: none !important; 186 } 187 188 .cm-search button { 189 display: none !important; 190 } 191 192 .cm-search { 193 background-color: #16181b; 194 } 195 196 .cm-search label { 197 display: none !important; 198 } 199 200 .cm-search input[name="replace"] { 201 display: none !important; 202 } 203 204 .cm-search input[name="search"] { 205 font-size: 21px !important; 206 width: 100% !important; 207 border-radius: 50px !important; 208 padding-left: 0.8em !important; 209 padding-right: 0.8em !important; 210 padding-bottom: 7px !important; 211 } 212 213 .cm-panels-bottom { 214 border-radius: 0px !important; 215 border-top: none !important; 216 } 217 218 /* Font picker dropdown */ 219 .font-picker-dropdown { 220 position: absolute; 221 z-index: 100; 222 background: #1e2126; 223 border: 1px solid #3a3f47; 224 border-radius: 6px; 225 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); 226 width: max-content; 227 } 228 229 .font-picker-dropdown ul { 230 list-style: none; 231 margin: 0; 232 padding: 0; 233 max-height: 260px; 234 overflow-y: auto; 235 overflow-x: hidden; 236 scrollbar-width: thin; 237 scrollbar-color: #555 transparent; 238 } 239 240 .font-picker-dropdown li { 241 padding: 4px 10px; 242 color: #e0e0e0; 243 font-family: monospace; 244 font-size: 16px; 245 cursor: pointer; 246 white-space: nowrap; 247 } 248 249 .font-picker-dropdown li.selected { 250 background: #2a5a3a; 251 color: #fff; 252 } 253 254 /* Preview iframe */ 255 #preview { 256 flex: 1; 257 width: 100%; 258 border: none; 259 overflow: hidden; 260 } 261 262 /* Spread navigation controls */ 263 .spread-nav { 264 display: flex; 265 align-items: center; 266 justify-content: center; 267 gap: 8px; 268 padding: 12px 20px; 269 } 270 271 .spread-nav button { 272 background: 273 linear-gradient(to bottom, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.15)); 274 color: white; 275 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); 276 border: none; 277 border-radius: 50%; 278 width: 36px; 279 height: 36px; 280 padding: 0; 281 cursor: pointer; 282 font-size: 18px; 283 transition: opacity 0.2s, filter 0.2s; 284 -webkit-tap-highlight-color: transparent; 285 display: flex; 286 align-items: center; 287 justify-content: center; 288 backdrop-filter: blur(8px); 289 -webkit-backdrop-filter: blur(8px); 290 box-shadow: 291 0 1px 3px rgba(0, 0, 0, 0.3), 292 inset 0 1px 0 rgba(255, 255, 255, 0.15), 293 inset 0 -1px 1px rgba(0, 0, 0, 0.08); 294 } 295 296 @media (hover: hover) { 297 .spread-nav button:hover:not(:disabled) { 298 opacity: 1; 299 filter: brightness(1.15); 300 } 301 } 302 303 .spread-nav button:disabled { 304 opacity: 0.25; 305 cursor: default; 306 } 307 308 #spreadIndicator { 309 color: white; 310 font-size: 16px; 311 min-width: 110px; 312 text-align: center; 313 text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); 314 } 315 316 /* Vertical layout for narrow screens */ 317 @media (max-aspect-ratio: 1/1) { 318 body { 319 flex-direction: column; 320 } 321 322 .editor-pane { 323 width: 100%; 324 height: 50%; 325 order: 2; 326 } 327 328 .preview-pane { 329 width: 100%; 330 height: 50%; 331 order: 1; 332 padding-top: env(safe-area-inset-top); 333 } 334 } 335 336 337 /* Compact height: fullscreen editor */ 338 @media (max-height: 270px) { 339 .preview-pane { 340 display: none; 341 } 342 343 .editor-pane { 344 width: 100%; 345 } 346 } 347 348 /* Mobile: fullscreen editor when keyboard is open */ 349 @media (pointer: coarse), (pointer: none) { 350 body.mobile-keyboard-open .preview-pane { 351 display: none; 352 } 353 354 body.mobile-keyboard-open .editor-pane { 355 position: fixed; 356 top: calc(var(--visual-viewport-offset-top, 0px)); 357 left: 0; 358 width: 100%; 359 height: var(--visual-viewport-height, 100%); 360 max-height: var(--visual-viewport-height, 100%); 361 order: 1; 362 overscroll-behavior: none; 363 overflow: hidden; 364 } 365 366 body.mobile-keyboard-open .editor-pane #editor, 367 body.mobile-keyboard-open .editor-pane .cm-editor { 368 height: 100% !important; 369 max-height: 100% !important; 370 } 371 } 372 373 /* Print: hide editor UI and let iframe print its content */ 374 @media print { 375 .editor-pane, .spread-nav { 376 display: none !important; 377 } 378 379 .preview-pane { 380 width: 100% !important; 381 height: 100% !important; 382 position: absolute !important; 383 top: 0 !important; 384 left: 0 !important; 385 } 386 387 #preview { 388 width: 100% !important; 389 height: 100% !important; 390 } 391 }