Tweaks to Binary UI

Signed-off-by: Alexander Lyall <alex@adcm.uk>
This commit is contained in:
2025-12-14 20:00:01 +00:00
parent d4765b3788
commit e6da9c8c98
18 changed files with 304 additions and 1150 deletions

284
public/styles/binary.css Normal file
View File

@@ -0,0 +1,284 @@
/* Font */
@font-face{
font-family: "DSEG7ClassicRegular";
src:
url("/fonts/DSEG7Classic-Regular.woff") format("woff"),
url("/fonts/DSEG7Classic-Regular.ttf") format("truetype");
font-weight: 400;
font-style: normal;
font-display: swap;
}
.binaryWrap{
padding-top: 8px;
}
.topGrid{
display:grid;
grid-template-columns: 1fr 340px;
gap: 28px;
align-items:start;
}
.readout{
text-align:center;
padding: 10px 10px 0;
}
.label{
letter-spacing: .18em;
font-weight: 800;
color: var(--muted);
text-transform: uppercase;
font-size: 13px;
margin-top: 10px;
}
.num{
font-family: "DSEG7ClassicRegular", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-weight: 400;
color: var(--accent);
text-shadow: 0 0 18px var(--accent-dim);
}
.denary{
font-size: 70px; /* smaller than before */
line-height: 1;
margin: 6px 0 10px;
}
.binary{
font-size: 54px; /* smaller than before */
letter-spacing: .12em;
line-height: 1;
margin: 6px 0 16px;
}
.controls{
margin-top: 10px;
display:flex;
gap: 12px;
justify-content:center;
flex-wrap:wrap;
}
.btn{
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
color: #fff;
padding: 12px 14px;
border-radius: 12px;
font-weight: 700;
cursor: pointer;
min-width: 160px;
}
.btn:active{ transform: translateY(1px); }
.divider{
margin-top: 26px;
border-top: 1px solid var(--line);
}
/* Right-side cards */
.panelCol{
display:flex;
flex-direction:column;
gap: 14px;
}
.card{
background: var(--panel2);
border: 1px solid rgba(255,255,255,.10);
border-radius: 14px;
padding: 14px;
}
.cardTitle{
letter-spacing: .18em;
font-weight: 900;
color: var(--muted);
text-transform: uppercase;
font-size: 12px;
margin: 0 0 10px;
}
.hint{
color: var(--muted);
font-size: 12px;
margin-top: 8px;
line-height: 1.35;
}
.toggleRow{
display:flex;
align-items:center;
justify-content:space-between;
gap: 10px;
}
.toggleLabel{
color: var(--text);
font-weight: 800;
font-size: 14px;
}
/* Switch (reused for mode + bits) */
.switch{
position: relative;
width: 56px;
height: 34px;
display:inline-block;
flex: 0 0 auto;
}
.switch input{
position:absolute;
opacity:0;
width:0;
height:0;
}
.slider{
position:absolute;
inset:0;
background: rgba(255,255,255,.10);
border: 1px solid rgba(255,255,255,.14);
border-radius: 999px;
transition: .18s ease;
}
.slider::before{
content:"";
position:absolute;
height: 28px;
width: 28px;
left: 3px;
top: 2px;
background: rgba(255,255,255,.92);
border-radius: 50%;
transition: .18s ease;
}
.switch input:checked + .slider{
background: rgba(51,255,122,.20);
border-color: rgba(51,255,122,.55);
}
.switch input:checked + .slider::before{
transform: translateX(22px);
background: var(--accent);
}
/* Bit-width control */
.bitWidthRow{
display:grid;
grid-template-columns: 44px 1fr 44px;
gap: 10px;
align-items:center;
}
.miniBtn{
height: 44px;
width: 44px;
border-radius: 12px;
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
color: #fff;
cursor: pointer;
font-weight: 900;
font-size: 18px;
}
.bitInputWrap{
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.14);
border-radius: 12px;
padding: 10px 12px;
display:flex;
align-items:center;
justify-content:space-between;
gap: 12px;
}
.bitInputLabel{
color: var(--muted);
font-size: 12px;
font-weight: 900;
letter-spacing: .18em;
text-transform: uppercase;
}
.bitInput{
width: 86px;
text-align:right;
background: transparent;
border:none;
outline:none;
color: var(--accent);
font-family: "DSEG7ClassicRegular", ui-monospace, monospace;
font-size: 28px;
}
.bitInput::-webkit-outer-spin-button,
.bitInput::-webkit-inner-spin-button{
-webkit-appearance:none;
margin:0;
}
/* Bits: wrap every 8 (rows built in JS) */
.bitsRows{
margin-top: 22px;
display:flex;
flex-direction:column;
gap: 18px;
}
/* A row of up to 8 bits */
.byteRow{
display:flex;
justify-content:center;
gap: 18px;
flex-wrap:nowrap;
}
/* A single bit */
.bit{
width: 110px;
display:flex;
flex-direction:column;
align-items:center;
gap: 10px;
padding: 6px 4px;
}
/* Bulb emoji: bigger */
.bulb{
font-size: 30px;
line-height: 1;
opacity: .20;
filter: grayscale(1);
transform: translateY(2px);
}
.bulb.on{
opacity: 1;
filter: grayscale(0);
text-shadow: 0 0 16px rgba(255,216,107,.65);
}
.bitVal{
font-family: "DSEG7ClassicRegular", ui-monospace, monospace;
font-size: 30px;
color: var(--text);
opacity: .92;
min-height: 34px;
}
/* Responsiveness */
@media (max-width: 980px){
.topGrid{ grid-template-columns: 1fr; }
.denary{ font-size: 62px; }
.binary{ font-size: 48px; }
.bit{ width: 96px; }
}
@media (max-width: 520px){
.denary{ font-size: 56px; }
.binary{ font-size: 42px; }
.btn{ min-width: 140px; }
.byteRow{ gap: 12px; }
.bit{ width: 86px; }
}