feat: add HP48-style RPN calculator sample
This commit is contained in:
@@ -0,0 +1,338 @@
|
||||
:root {
|
||||
--body-top: #1d2430;
|
||||
--body-bottom: #0c1017;
|
||||
--shell-top: #4b5567;
|
||||
--shell-bottom: #252d39;
|
||||
--shell-edge: #141922;
|
||||
--screen: #dce7b3;
|
||||
--screen-top: #e8f0c3;
|
||||
--screen-text: #1c2910;
|
||||
--screen-dim: #60714a;
|
||||
--key-text: #f4f7fb;
|
||||
--key-fn-top: #677287;
|
||||
--key-fn-bottom: #424b5d;
|
||||
--key-num-top: #5d6470;
|
||||
--key-num-bottom: #383f49;
|
||||
--key-op-top: #4f6b95;
|
||||
--key-op-bottom: #304661;
|
||||
--key-danger-top: #7a5050;
|
||||
--key-danger-bottom: #553636;
|
||||
--key-enter-top: #7d9079;
|
||||
--key-enter-bottom: #4d614b;
|
||||
--border: #11151c;
|
||||
--shadow: rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
font-family: Arial, sans-serif;
|
||||
background:
|
||||
radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 30%),
|
||||
linear-gradient(180deg, var(--body-top), var(--body-bottom));
|
||||
color: #f3f6fb;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
padding: 28px 18px 40px;
|
||||
}
|
||||
|
||||
.calc {
|
||||
background: linear-gradient(180deg, var(--shell-top), var(--shell-bottom));
|
||||
border: 1px solid var(--shell-edge);
|
||||
border-radius: 28px;
|
||||
padding: 18px;
|
||||
box-shadow:
|
||||
0 24px 60px var(--shadow),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||
inset 0 -2px 0 rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.brand {
|
||||
color: #f7f8fc;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 14px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.brand h1 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.brand small {
|
||||
color: #cfd6e2;
|
||||
}
|
||||
|
||||
.screen {
|
||||
background: linear-gradient(180deg, var(--screen-top), var(--screen));
|
||||
color: var(--screen-text);
|
||||
border: 3px solid #829366;
|
||||
border-radius: 14px;
|
||||
padding: 14px 16px;
|
||||
min-height: 196px;
|
||||
font-family: "Courier New", monospace;
|
||||
display: grid;
|
||||
grid-template-rows: auto auto 1fr;
|
||||
gap: 10px;
|
||||
box-shadow:
|
||||
inset 0 2px 8px rgba(60, 80, 28, 0.18),
|
||||
0 8px 16px rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
.screen-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
font-size: 12px;
|
||||
color: var(--screen-dim);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.stack {
|
||||
border-top: 1px solid rgba(28, 41, 16, 0.24);
|
||||
padding-top: 10px;
|
||||
line-height: 1.5;
|
||||
font-size: 18px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.stack-line {
|
||||
display: grid;
|
||||
grid-template-columns: 26px 1fr;
|
||||
gap: 8px;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.stack-line.selected {
|
||||
background: rgba(28, 41, 16, 0.12);
|
||||
outline: 1px dashed rgba(28, 41, 16, 0.4);
|
||||
}
|
||||
|
||||
.stack-line.moving {
|
||||
background: rgba(117, 160, 90, 0.2);
|
||||
outline: 1px solid rgba(28, 41, 16, 0.5);
|
||||
}
|
||||
|
||||
.stack-line .label {
|
||||
text-align: right;
|
||||
color: var(--screen-dim);
|
||||
}
|
||||
|
||||
.stack-line.selected .label,
|
||||
.stack-line.moving .label {
|
||||
color: var(--screen-text);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#display {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.hidden-input {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
color: #edf2fa;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pill {
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 999px;
|
||||
padding: 6px 10px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.mode-select {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
min-width: 148px;
|
||||
font-size: 12px;
|
||||
color: #d9e1ec;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
select,
|
||||
button {
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--border);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 10px 12px;
|
||||
background: #edf1f7;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.keyboard-layout {
|
||||
margin-top: 18px;
|
||||
display: grid;
|
||||
grid-template-columns: 4fr 3fr 2fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.key-group {
|
||||
background: rgba(6, 10, 16, 0.18);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
border-radius: 18px;
|
||||
padding: 12px;
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0 0 10px;
|
||||
color: #dce4f0;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
|
||||
.key-grid {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.functions-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
grid-template-rows: repeat(5, 56px);
|
||||
}
|
||||
|
||||
.numbers-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-rows: repeat(5, 56px);
|
||||
}
|
||||
|
||||
.operators-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
grid-template-rows: repeat(5, 56px);
|
||||
}
|
||||
|
||||
.key-spacer {
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px dashed rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 8px;
|
||||
color: var(--key-text);
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||
0 3px 0 rgba(0, 0, 0, 0.25);
|
||||
transition: filter 120ms ease, transform 120ms ease;
|
||||
}
|
||||
|
||||
button:hover { filter: brightness(1.08); }
|
||||
button:active {
|
||||
transform: translateY(2px);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.08),
|
||||
0 1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.key-function {
|
||||
background: linear-gradient(180deg, var(--key-fn-top), var(--key-fn-bottom));
|
||||
}
|
||||
|
||||
.key-number {
|
||||
background: linear-gradient(180deg, var(--key-num-top), var(--key-num-bottom));
|
||||
}
|
||||
|
||||
.key-operator {
|
||||
background: linear-gradient(180deg, var(--key-op-top), var(--key-op-bottom));
|
||||
}
|
||||
|
||||
.key-danger {
|
||||
background: linear-gradient(180deg, var(--key-danger-top), var(--key-danger-bottom));
|
||||
}
|
||||
|
||||
.key-enter {
|
||||
background: linear-gradient(180deg, var(--key-enter-top), var(--key-enter-bottom));
|
||||
grid-row: span 2;
|
||||
}
|
||||
|
||||
.error {
|
||||
margin-top: 12px;
|
||||
min-height: 20px;
|
||||
color: #ff9f9f;
|
||||
font-family: "Courier New", monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: #cfd7e3;
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.keyboard-layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.wrap {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.calc {
|
||||
padding: 14px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.brand {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mode-select {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.functions-grid,
|
||||
.numbers-grid,
|
||||
.operators-grid {
|
||||
grid-template-rows: repeat(5, 52px);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user