Repository navigation
Expand file tree
/
Copy pathstyles.css
More file actions
332 lines (324 loc) · 11.6 KB
/
Copy pathstyles.css
File metadata and controls
332 lines (324 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body {
margin: 0;
font-family: system-ui, -apple-system, sans-serif;
background: #333;
color: #eee;
height: 100vh;
display: flex;
flex-direction: column;
}
#toolbar {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
background: #222;
border-bottom: 1px solid #000;
flex-wrap: wrap;
position: sticky; /* also the containing block for the mobile settings sheet */
top: 0;
z-index: 10;
}
/* controls travel in groups, with a rule between neighbouring groups */
.grp { display: flex; align-items: center; gap: 8px; }
#toolbar > .grp + .grp {
border-left: 1px solid #3a3a3a;
padding-left: 12px;
}
/* the settings panel: a sheet hung off the bottom-right of #toolbar, which is
the nearest positioned ancestor — so it needs no height measurement as the
bar grows with the safe-area inset. visibility (not display) to transition. */
#settings {
position: absolute;
top: 100%; right: 0;
width: min(360px, calc(100vw - 16px));
display: flex;
flex-direction: column;
align-items: stretch;
gap: 16px;
padding: 16px 14px;
background: #222;
border: 1px solid #000;
border-top: none;
border-bottom-left-radius: 10px;
box-shadow: 0 10px 24px rgba(0,0,0,0.5);
z-index: 1; /* over #status, which hangs off the same edge */
opacity: 0;
visibility: hidden;
transform: translateY(-6px);
transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
}
body.settings-open #settings {
opacity: 1;
visibility: visible;
transform: none;
transition-delay: 0s;
}
/* one labelled row per setting: name on the left, control hugging the right */
#settings > .grp { justify-content: space-between; gap: 10px; }
#settings #rateLabel, #settings #autoLabel, #settings #codeLabel {
flex: 1; justify-content: flex-end; gap: 8px;
}
/* margin-right:auto packs each row's controls right whether .ttl is a sibling
of the control (magnify, voice, speed) or the first child of its label */
.ttl {
display: inline; color: #ccc; font-size: 15px;
white-space: nowrap; margin-right: auto;
}
.short { display: none; } /* the spelled-out .ttl replaces it here */
#settings input[type="checkbox"] { width: 20px; height: 20px; }
#toolbar button, #toolbar label.filebtn {
background: #444;
color: #eee;
border: 1px solid #555;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
}
#toolbar button:hover, #toolbar label.filebtn:hover { background: #555; }
#toolbar button:disabled { opacity: 0.4; cursor: default; }
#pageInput {
width: 60px;
padding: 6px;
text-align: center;
border-radius: 4px;
border: 1px solid #555;
background: #444;
color: #eee;
font-size: 14px;
}
#fileInput { display: none; }
.sidenav {
position: fixed; top: 50%; transform: translateY(-50%);
z-index: 15; width: 44px; height: 68px;
background: rgba(40,40,40,0.55); color: #eee;
border: 1px solid #555; border-radius: 8px;
font-size: 24px; cursor: pointer;
display: flex; align-items: center; justify-content: center;
transition: background 0.15s;
touch-action: manipulation; /* no double-tap zoom on a missed press */
-webkit-user-select: none; user-select: none;
}
.sidenav:hover { background: rgba(70,70,70,0.9); }
.sidenav:disabled { opacity: 0; pointer-events: none; }
#navPrev { left: 16px; }
#navNext { right: 16px; }
#viewer {
flex: 1;
overflow: auto;
display: flex;
justify-content: center;
justify-content: safe center; /* keep left edge reachable when page wider than window */
align-items: flex-start;
padding: 20px;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* old Edge/IE */
}
#viewer::-webkit-scrollbar { display: none; } /* WebKit/Chrome */
#pageWrap {
position: relative;
box-shadow: 0 0 20px rgba(0,0,0,0.5);
line-height: 1;
}
#canvas {
background: #fff;
display: block;
max-width: 100%;
height: auto;
}
#textLayer {
position: absolute;
top: 0; left: 0;
overflow: hidden;
pointer-events: none;
}
#textLayer span {
position: absolute;
white-space: pre;
color: transparent;
transform-origin: 0 0;
pointer-events: auto;
cursor: pointer;
}
#textLayer span:hover { background: rgba(120, 170, 255, 0.30); }
/* code lines skipped by TTS — faint tint over the canvas so it's visible why */
#textLayer span.code { background: rgba(120, 120, 120, 0.12); cursor: default; }
/* the block the 10s hold is parked on */
#textLayer span.holding { background: rgba(255, 214, 0, 0.25); }
#textLayer span.reading {
background: rgba(255, 214, 0, 0.45);
border-radius: 2px;
color: transparent;
}
#txtView {
display: none;
background: #fff;
color: #111;
padding: 48px 56px;
width: 720px; /* JS scales this with zoom */
font-size: 18px;
line-height: 1.6;
white-space: pre-wrap;
word-wrap: break-word;
font-family: Georgia, 'Times New Roman', serif;
}
#txtView span { cursor: pointer; border-radius: 2px; }
#txtView .codeblock {
background: #1e1e1e; color: #d4d4d4;
font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
font-size: 0.82em; line-height: 1.45;
padding: 12px 16px; margin: 14px 0;
border-radius: 6px; border: 1px solid #333;
overflow-x: auto; white-space: pre;
}
#txtView .codeblock.holding { border-color: rgba(255, 214, 0, 0.9); box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.35); }
#txtView span:hover { background: rgba(120, 170, 255, 0.30); }
#txtView span.reading { background: rgba(255, 214, 0, 0.55); }
#empty {
margin: auto;
text-align: center;
color: #999;
}
/* hangs under the bar instead of taking a row in it: a second row would push
the vertically-centred page number off the control row */
#status {
color: #f88; font-size: 13px;
position: absolute; top: 100%; left: 0; right: 0;
background: #222; padding: 6px 8px; border-bottom: 1px solid #000;
}
#status.info { color: #9c9; } /* a resume note, not a failure */
#status:empty { display: none; }
/* the only control on the right of the bar: everything else is behind it */
#gear { margin-left: auto; font-size: 16px; line-height: 1; }
body.settings-open #gear { background: #555; }
/* the page number sits dead centre of the bar, not centre-of-what's-left: it's
taken out of the flex flow so neither Open's width nor the gear can shift it */
#toolbar > #pageGroup {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
/* #toolbar > .grp + .grp is more specific than a bare #pageGroup, so the
divider rule has to be beaten with the same ancestor in the selector */
border-left: none;
padding-left: 0;
}
#pageCount { color: #aaa; font-size: 14px; }
#zoomLabel { color: #aaa; font-size: 14px; min-width: 42px; text-align: center; }
#voice {
background: #444; color: #eee; border: 1px solid #555;
border-radius: 4px; padding: 5px; font-size: 13px; max-width: 160px;
}
#rateLabel, #autoLabel, #codeLabel { color: #aaa; font-size: 13px; display: flex; align-items: center; gap: 5px; }
#codeSecs {
width: 52px; padding: 4px; text-align: center;
border-radius: 4px; border: 1px solid #555;
background: #444; color: #eee; font-size: 13px;
}
#rateWrap { display: flex; flex-direction: column; align-items: center; }
#rate { width: 80px; }
#rateMult { font-size: 9px; color: #888; line-height: 1; margin-top: 1px; }
#toolbar button.ratebtn { padding: 3px 6px; font-size: 10px; line-height: 1; }
#speak {
position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
z-index: 20; width: 52px; height: 52px; border-radius: 50%;
background: #444; color: #eee; border: 1px solid #555;
font-size: 20px; cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 2px 8px rgba(0,0,0,0.4);
transition: background 0.15s;
}
#speak:hover { background: #555; }
#speak:disabled { opacity: 0; pointer-events: none; }
#speak.speaking { background: #2a6; border-color: #2a6; }
/* code-block hold countdown, parked under the play button */
#holdCount {
position: fixed; top: 110px; left: 50%; transform: translateX(-50%);
z-index: 20; display: none;
padding: 2px 8px; border-radius: 10px;
background: rgba(40,40,40,0.85); border: 1px solid #555;
color: #ffd600; font-size: 13px; font-variant-numeric: tabular-nums;
pointer-events: none;
}
/* ---------- compact: phones, and any narrow window ----------
Below this width the page is fitted to the viewer, the nav arrows weld to the
screen edges and the play button moves to the bottom. isCompact() in app.js
reads this exact query through matchMedia so the two can't drift apart. */
@media (max-width: 1023px) {
/* iOS Safari counts the URL bar into 100vh, so the last strip is unreachable */
body { height: 100dvh; }
/* one row, nothing wraps: Open | zoom | page | gear */
#toolbar {
gap: 8px;
padding: 6px 8px;
padding-top: max(6px, env(safe-area-inset-top));
flex-wrap: nowrap;
}
#toolbar button, #toolbar label.filebtn { padding: 8px 10px; } /* 44px-ish tap targets */
.grp { gap: 6px; }
/* no room for rules between groups on a 390px bar */
#toolbar > .grp + .grp { border-left: none; padding-left: 0; }
/* iOS zooms the whole page when a focused input is under 16px */
#pageInput { font-size: 16px; width: 56px; }
#codeSecs { font-size: 16px; width: 62px; }
#voice { font-size: 16px; max-width: min(55vw, 320px); }
/* the sheet goes full-bleed: a 360px card looks pasted on at 390px wide */
#settings {
left: 0; right: 0;
width: auto;
border-left: none; border-right: none;
border-bottom-left-radius: 0;
}
#rate { width: min(42vw, 320px); }
#settings input[type="checkbox"] { width: 22px; height: 22px; }
#viewer { padding: 8px; }
#txtView { max-width: 100%; padding: 24px 20px; }
/* play button moves to the bottom: toolbar height varies with wrapping, so a
fixed top offset collides with it, and the thumb is down there anyway */
#speak {
top: auto;
bottom: max(16px, env(safe-area-inset-bottom));
width: 60px; height: 60px; font-size: 24px;
}
#holdCount { top: auto; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 68px); }
/* full-height strips welded to the screen edges. positionNav() bails out at
this width, so nothing writes inline offsets over these. */
.sidenav {
width: 46px;
height: 42vh;
top: 50%;
font-size: 22px;
background: rgba(30,30,30,0.42);
}
/* rounded on the inward face only — the edge against the screen stays square
so the strip reads as part of the bezel, not a floating pill */
#navPrev {
left: 0; right: auto; border-left: none;
border-radius: 0 14px 14px 0;
}
#navNext {
right: 0; left: auto; border-right: none;
border-radius: 14px 0 0 14px;
}
/* first/last page: stay put, greyed. Vanishing moved the other arrow's
target under your thumb mid-read. */
.sidenav:disabled { opacity: 0.3; }
/* a missed press used to double-tap-zoom the page. pinch still works. */
#viewer, #pageWrap, #toolbar { touch-action: manipulation; }
}
/* a tap on touch leaves :hover latched until you tap elsewhere — neutralise it */
@media (hover: none) {
#toolbar button:hover, #toolbar label.filebtn:hover { background: #444; }
#speak:hover { background: #444; }
#speak.speaking:hover { background: #2a6; }
.sidenav:hover { background: rgba(30,30,30,0.42); }
#textLayer span:hover, #txtView span:hover { background: none; }
/* re-assert the state tints the rule above would otherwise clear on tap */
#textLayer span.code { background: rgba(120, 120, 120, 0.12); }
#textLayer span.holding { background: rgba(255, 214, 0, 0.25); }
#textLayer span.reading { background: rgba(255, 214, 0, 0.45); }
#txtView span.reading { background: rgba(255, 214, 0, 0.55); }
}