:root {
  color-scheme: dark;
  --amber: #ffcb82;
  --muted: #aaa7a2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 20%, #28221e, #121211 70%);
  color: #f5f0e9;
  font-family: system-ui, sans-serif;
}
main.container { width: min(100%, 66rem); padding: 3rem 1rem; text-align: center; }
h1 { font-family: Georgia, serif; font-size: clamp(2.6rem, 7vw, 5rem); margin: 0; }
.subtitle, .unit-label { color: var(--muted); text-transform: uppercase; letter-spacing: .16em; }
.subtitle { margin: .6rem 0 2.2rem; }
.readout {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(.5rem, 2vw, 1.4rem);
  padding: clamp(.8rem, 3vw, 2rem);
  background: #171615;
  border: 1px solid #443831;
  border-radius: 1.2rem;
  box-shadow: 0 22px 65px #0007;
}
.digits { display: flex; justify-content: center; gap: .09em; font-size: clamp(1.7rem, 4vw, 3.8rem); }
.digit {
  position: relative;
  width: .85em;
  height: 1.25em;
  background: linear-gradient(#34302c, #262320 49%, #161513 50%, #282420);
  border: 1px solid #4b3b31;
  border-radius: .13em;
  color: var(--amber);
  font: 700 1em / 1.22 monospace;
  perspective: 240px;
}
.digit::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid #120e0c;
}
.flap { position: absolute; inset: 0; border-radius: inherit; }
.flap-top {
  background: #34302c;
  clip-path: inset(0 0 50%);
  animation: fold .2s ease-in both;
}
.flap-bottom {
  background: #282420;
  clip-path: inset(50% 0 0);
  animation: unfold .2s .2s ease-out both;
}
@keyframes fold { to { transform: rotateX(-90deg); } }
@keyframes unfold { from { transform: rotateX(90deg); } }
@media (prefers-reduced-motion: reduce) { .flap { display: none; } }
.unit-label { margin-top: .75rem; font-size: .68rem; }
form { margin: 2rem auto 0; width: min(100%, 29rem); text-align: left; }
.controls { display: flex; gap: .65rem; margin: .4rem 0; }
input.form-control { min-width: 0; flex: 1; background: #211e1b; border-color: #594638; color: #f5f0e9; }
input.form-control:focus { background: #211e1b; color: #f5f0e9; }
button.btn { color: #20150d; background: var(--amber); border-color: var(--amber); font-weight: 650; }
small { color: var(--muted); }
#error { color: #ffae99; }
@media (max-width: 650px) {
  .readout { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 1.3rem; }
  .digits { font-size: clamp(1.45rem, 6vw, 2.5rem); }
}
