:root {
  --body: #2b2a2e;
  --face: #38363c;
  --edge: #1c1b1e;
  --key-dark: #4a484e;
  --key-dark-hi: #5a575e;
  --key-num: #d9d4c8;
  --key-num-hi: #e9e4d8;
  --key-red: #b96055;
  --key-red-hi: #c9706a;
  --label: #cfc2ee;
  --lcd-bg: #aebda6;
  --lcd-fg: #1d2420;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 800px at 50% -100px, #4a4856, #232228 60%, #19181c);
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #ddd;
  display: flex;
  justify-content: center;
}
main { padding: 24px 12px 60px; width: 100%; max-width: 560px; }

.calc {
  background: linear-gradient(180deg, #3a383e, var(--body) 12%, #242327);
  border: 1px solid var(--edge);
  border-radius: 26px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 18px 18px 14px;
  max-width: 430px;
  margin: 0 auto;
}
.brand {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 2px 6px 10px;
  letter-spacing: .12em;
}
.brand .ti { font-size: 11px; color: #9b97a3; }
.brand .model { font-size: 15px; font-weight: 700; color: #e8e6ee; font-style: italic; }

.lcd-frame {
  background: #141317;
  border-radius: 10px;
  padding: 10px;
  box-shadow: inset 0 3px 10px rgba(0,0,0,.8);
  margin-bottom: 16px;
}
.lcd {
  background: linear-gradient(180deg, #b9c8b0, var(--lcd-bg) 30%, #a3b29b);
  border-radius: 4px;
  min-height: 74px;
  padding: 6px 12px 8px;
  color: var(--lcd-fg);
  position: relative;
  transition: filter .25s, opacity .25s;
}
.lcd.off { filter: saturate(.3) brightness(.75); }
.lcd.off .indicators, .lcd.off .mainline { visibility: hidden; }
.indicators {
  display: flex; gap: 10px; min-height: 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.mainline {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: 8px;
}
.lcd-label {
  font-size: 16px; font-weight: 700;
  font-family: Consolas, "Lucida Console", monospace;
  white-space: nowrap;
}
.lcd-value {
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 30px; font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  margin-left: auto;
}
.lcd-value .exp {
  font-size: 16px; vertical-align: super; margin-left: 6px;
}

.keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px 10px;
}
.kcell { display: flex; flex-direction: column; align-items: stretch; }
.cell-tall { grid-row: span 2; }
.cell-tall .key { flex: 1; }
.klabel {
  color: var(--label);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-align: center;
  min-height: 13px;
  white-space: nowrap;
  user-select: none;
}
.key {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 2px 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: #f3f1f6;
  background: linear-gradient(180deg, var(--key-dark-hi), var(--key-dark) 40%, #38363b);
  box-shadow: 0 3px 0 #1b1a1d, 0 4px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12);
  cursor: pointer;
  user-select: none;
  transition: transform .04s, box-shadow .04s, filter .1s;
}
.key:active, .key.pressed {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1b1a1d, 0 2px 3px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1);
  filter: brightness(1.12);
}
.key.k-num {
  background: linear-gradient(180deg, var(--key-num-hi), var(--key-num) 45%, #c4bfb2);
  color: #232225;
  box-shadow: 0 3px 0 #8d887c, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.55);
}
.key.k-red {
  background: linear-gradient(180deg, var(--key-red-hi), var(--key-red) 45%, #9d4f46);
  box-shadow: 0 3px 0 #6e352f, 0 4px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2);
}
.key.k-on { font-size: 11px; }
.key.key-2nd {
  background: linear-gradient(180deg, #f4f2f7, #ded9e6 45%, #c8c2d4);
  color: #4d3f75;
  box-shadow: 0 3px 0 #948da3, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.7);
}
.key.key-2nd.armed {
  outline: 2px solid #ffd76a;
  filter: brightness(1.1);
}
.foot {
  text-align: center;
  color: #8e8a98;
  font-size: 10px;
  letter-spacing: .35em;
  padding-top: 12px;
}

.help { max-width: 430px; margin: 18px auto 0; }
.help details {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px 16px;
}
.help summary { cursor: pointer; font-weight: 600; color: #cfcbe0; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.help h4 { margin: 12px 0 4px; color: #e3dff0; font-size: 13px; }
.help p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.45; color: #b9b5c6; }
.help .intro { margin: 6px 0 4px; font-size: 12.5px; line-height: 1.45; color: #cfcbe0; }
.help .fine { margin-top: 12px; font-size: 11px; color: #87839a; }
.legal {
  max-width: 430px;
  margin: 14px auto 0;
  padding: 11px 16px;
  font-size: 11px;
  line-height: 1.5;
  color: #8b8798;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.07);
}
.legal b { color: #a6a2b4; font-weight: 600; }
@media (max-width: 520px) {
  .help-grid { grid-template-columns: 1fr; }
  .lcd-value { font-size: 24px; }
}
