:root {
  --bg: #e9edf1;
  --panel: #1f2427;
  --panel-light: #2d3337;
  --btn: #101418;
  --btn-text: #f6f7f8;
  --btn-shadow: rgba(0, 0, 0, 0.5);
  --focus: #7bc7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top, #f4f6f8 0%, var(--bg) 70%);
  color: #111;
  overflow: auto;
}

.page {
  width: 100vw;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px 0;
  overflow: visible;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0 0 8px;
  color: #46515b;
}

.remote-shell {
  position: relative;
  background: linear-gradient(180deg, #2f353a, #171c1f);
  border-radius: 28px;
  padding: 22px 14px 18px;
  width: 360px;
  transform-origin: center center;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.07);
}

.ir-led {
  position: absolute;
  top: 56px;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #4a1010;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transition: background-color 90ms ease, box-shadow 90ms ease, transform 90ms ease;
}

.ir-led.active {
  background: #ff2b2b;
  box-shadow:
    0 0 0 1px rgba(100, 0, 0, 0.7),
    0 0 12px rgba(255, 34, 34, 0.9),
    0 0 20px rgba(255, 34, 34, 0.55);
  transform: translateX(-50%) scale(1.06);
}

.remote-face {
  width: 100%;
  border-radius: 20px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0 1px,
      rgba(255, 255, 255, 0) 1px 8px
    ),
    linear-gradient(180deg, #2e3438 0%, #23292d 55%, #20262a 100%);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn {
  border: 0;
  border-radius: 9px;
  min-height: 32px;
  color: var(--btn-text);
  background: linear-gradient(180deg, #1a2024 0%, var(--btn) 100%);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 5px var(--btn-shadow);
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
  padding: 6px 4px;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn:active,
.btn.pressed {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.2);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.btn.round {
  border-radius: 999px;
  min-height: 44px;
}

.btn.force-circle {
  border-radius: 999px;
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  justify-self: center;
  align-self: center;
}

.btn.pill {
  border-radius: 16px;
}

.btn.big {
  min-height: 46px;
}

.btn.power-left {
  background: linear-gradient(180deg, #d4d6d8, #a4a9ae);
  color: #d60000;
}

.btn.power-icon {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.btn.power-right,
.btn.red {
  background: linear-gradient(180deg, #f05f5f, #b20f0f);
}

.btn.green {
  background: linear-gradient(180deg, #3fd88f, #149a57);
}

.btn.yellow {
  background: linear-gradient(180deg, #f3df57, #b49f1f);
  color: #1f1f1f;
}

.btn.blue {
  background: linear-gradient(180deg, #45b6f4, #1376b8);
}

.btn.large-icon {
  font-size: 1rem;
  line-height: 1;
}

.btn.stop-icon {
  font-size: 1.18rem;
}

.btn.mute-icon {
  font-size: 1.18rem;
}

.spacer {
  visibility: hidden;
}

.dpad {
  grid-column: 1 / -1;
  min-height: 170px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  align-items: center;
}

.dpad .btn {
  min-height: 48px;
  font-size: 1rem;
}

.dpad .ok {
  border-radius: 999px;
  min-height: 60px;
  font-size: 1.2rem;
}

.dpad .ok.ok-circle {
  width: 66px;
  height: 66px;
  min-height: 66px;
}

.lower-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
  gap: 10px;
  margin-top: 2px;
}

.lower-col {
  display: grid;
  gap: 8px;
}

.lower-col-left .btn {
  min-height: 56px;
}

.lower-col-middle .btn {
  border-radius: 999px;
  min-height: 52px;
}

.lower-col-right .page-btn {
  min-height: 56px;
}

.lower-col-left,
.lower-col-right {
  gap: 0;
  justify-self: center;
  width: 48px;
}

.btn.split-top {
  border-radius: 999px 999px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 48px;
  min-width: 48px;
  padding-left: 2px;
  padding-right: 2px;
}

.btn.split-bottom {
  border-radius: 0 0 999px 999px;
  border-top: 1px solid rgba(0, 0, 0, 0.6);
  width: 48px;
  min-width: 48px;
  padding-left: 2px;
  padding-right: 2px;
}

.page-column {
  position: relative;
}

.page-column::before {
  content: "PAGE";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #d9dce0;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.3px;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
}

.num-pad {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.num-pad .btn {
  min-height: 34px;
}

.num-pad .numeric-btn {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  gap: 0.03em;
}

.num-pad .numeric-btn .num-main {
  font-size: 1.22rem;
  line-height: 1;
  font-weight: 800;
}

.num-pad .numeric-btn .num-sub {
  font-size: 0.84rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.15px;
  opacity: 0.95;
}

.feedback {
  width: min(620px, 96vw);
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d8dee4;
  padding: 12px 14px;
}

.feedback h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

#lastPress {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  color: #22303b;
}

@media (max-width: 420px) {
  body {
    overflow: hidden;
  }

  .page {
    height: 100dvh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .remote-shell {
    border-radius: 28px;
    padding: 22px 14px 18px;
  }

  .remote-face {
    gap: 6px;
    padding: 8px;
  }

  .btn {
    font-size: 0.64rem;
    min-height: 30px;
  }

  .btn.large-icon {
    font-size: 0.95rem;
  }

  .btn.stop-icon {
    font-size: 1.05rem;
  }

  .btn.mute-icon {
    font-size: 1.02rem;
  }

  .lower-controls {
    gap: 8px;
  }

  .lower-col-left .btn,
  .lower-col-right .page-btn {
    min-height: 52px;
  }

  .lower-col-left,
  .lower-col-right,
  .btn.split-top,
  .btn.split-bottom {
    width: 44px;
    min-width: 44px;
  }

  .page-column::before {
    font-size: 0.64rem;
  }

  .num-pad .numeric-btn .num-main {
    font-size: 1.05rem;
  }

  .num-pad .numeric-btn .num-sub {
    font-size: 0.7rem;
  }

  .btn.force-circle {
    width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .dpad .ok.ok-circle {
    width: 60px;
    height: 60px;
    min-height: 60px;
  }
}
