/* Renderings of the real app UI. Sizes are container units so every piece
   scales from one reference width: the phone screen is 390 wide, the
   cluster and key grid are 334 wide, the direction pad is 100 wide.

   Every pressable part reads registered numbers (--press, --rp, --tx, --ty,
   --rock) so the cap, its skirt, its shadow and its shading move as one and
   can spring back through a transition. */

@property --press { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --rp { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --tx { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --ty { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --rock { syntax: "<number>"; inherits: true; initial-value: 0; }

.app,
.cluster,
.keys {
  --spring: cubic-bezier(0.34, 1.7, 0.5, 1);
  --release: 0.46s;
}

.key,
.dpad,
.dpad-ok,
.rocker,
.dock-tile,
.app-power {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cluster,
.keys {
  user-select: none;
  -webkit-user-select: none;
}

.device {
  width: min(400px, 80vw);
  margin: 0;
}

.device-bezel {
  padding: 3%;
  border-radius: 17% / 8%;
  background: linear-gradient(160deg, #3a3d45 0%, #1c1f27 30%, #15171d 70%, #2b2e36 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 0 0 4px #0c0d11,
    0 50px 90px -20px rgba(20, 23, 30, 0.45),
    0 24px 40px -24px rgba(20, 23, 30, 0.5);
}

.device-screen {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  aspect-ratio: 390 / 844;
  border-radius: 13.5% / 6.3%;
  background: #090a0d;
}

.device-screen > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The light site shows the Soft remote; the dark site shows Default. */
.device-screen > img.device-shot--dark { display: none; }

:root[data-theme="dark"] .device-screen > img.device-shot--dark { display: block; }
:root[data-theme="dark"] .device-screen > img.device-shot--light { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .device-screen > img.device-shot--dark { display: block; }
  :root:not([data-theme="light"]) .device-screen > img.device-shot--light { display: none; }
}

.device-island {
  position: absolute;
  z-index: 3;
  top: 2.8cqw;
  left: 50%;
  width: 31cqw;
  height: 9cqw;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #000;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4.1cqw;
  padding: 0 4.1cqw;
  color: #f6f1e7;
  background:
    radial-gradient(130% 55% at 50% -8%, #1a140c 0%, rgba(26, 20, 12, 0) 70%),
    #090a0d;
  font-size: 3.6cqw;
  line-height: 1.2;
  text-align: left;
  user-select: none;
}

.app p { margin: 0; }

.app-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 14cqw;
  padding: 1.4cqw 5.5cqw 0;
  font-size: 4.1cqw;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-battery {
  width: 6.6cqw;
  height: 3.2cqw;
  border: 0.3cqw solid rgba(246, 241, 231, 0.5);
  border-radius: 1cqw;
  padding: 0.35cqw;
}

.app-battery::before {
  content: "";
  display: block;
  width: 78%;
  height: 100%;
  border-radius: 0.4cqw;
  background: #f6f1e7;
}

.app-head {
  display: flex;
  align-items: center;
  gap: 2cqw;
}

.app-head-text { flex: 1; }

.app-title {
  font-size: 7.2cqw;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.app-sub {
  margin-top: 0.5cqw;
  color: #8fdba8;
  font-size: 3.35cqw;
  font-weight: 500;
}

.app-edit {
  padding: 2cqw;
  color: #a39c90;
  font-weight: 500;
}

.app-power {
  --press: 0;
  --sink: calc(var(--press) * 1.3cqw);
  position: relative;
  display: grid;
  place-items: center;
  width: 12.3cqw;
  height: 11.3cqw;
  border-radius: 99px;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #44464e, #35373f 55%, #2b2d33);
  transform: translateY(var(--sink));
  transition: --press var(--release) var(--spring);
  box-shadow:
    inset 0 0 0 100cqw rgba(0, 0, 0, calc(var(--press) * 0.16)),
    inset 0 0.4cqw 0 rgba(255, 255, 255, calc(0.2 - var(--press) * 0.08)),
    inset 0 -0.6cqw 1.2cqw rgba(0, 0, 0, 0.3),
    0 calc((1.54cqw - var(--sink)) * 0.5) 0 #1d1e22,
    0 calc(1.54cqw - var(--sink)) 0 #131417,
    0 calc(1.54cqw - var(--sink) + 0.3cqw) 0.5cqw rgba(0, 0, 0, 0.6),
    0 calc(2.6cqw - var(--sink) * 1.4) calc(3.2cqw - var(--press) * 2cqw) rgba(0, 0, 0, calc(0.55 - var(--press) * 0.2));
}

.app-power i {
  position: relative;
  width: 4.4cqw;
  height: 4.4cqw;
  border: 0.55cqw solid #ff5c5c;
  border-top-color: transparent;
  border-radius: 50%;
}

.app-power i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -1.4cqw;
  width: 0.55cqw;
  height: 2.6cqw;
  transform: translateX(-50%);
  border-radius: 1cqw;
  background: #ff5c5c;
}

.app-dock {
  display: flex;
  gap: 2.56cqw;
}

.dock-item {
  width: 19.5cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8cqw;
}

.dock-tile {
  --press: 0;
  --sink: calc(var(--press) * 1.3cqw);
  --glow: 0 0 0 transparent;
  position: relative;
  display: grid;
  place-items: center;
  width: 15.9cqw;
  height: 15.9cqw;
  margin-bottom: 1.54cqw;
  overflow: hidden;
  border-radius: 4.6cqw;
  background: linear-gradient(180deg, #3a3d45, #2b2d34 55%, #22242a);
  transform: translateY(var(--sink)) scale(calc(1 - var(--press) * 0.015));
  transition: --press var(--release) var(--spring);
  box-shadow:
    0 calc((1.54cqw - var(--sink)) * 0.5) 0 #1e2025,
    0 calc(1.54cqw - var(--sink)) 0 #141519,
    0 calc(1.54cqw - var(--sink) + 0.3cqw) 0.5cqw rgba(0, 0, 0, 0.6),
    0 calc(2cqw - var(--sink)) calc(2.6cqw - var(--press) * 1.6cqw) rgba(0, 0, 0, calc(0.45 - var(--press) * 0.15)),
    var(--glow);
}

.dock-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background:
    radial-gradient(110% 55% at 50% -5%, rgba(255, 255, 255, calc(0.14 - var(--press) * 0.07)), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0) 20% 80%, rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.dock-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  box-shadow:
    var(--ring, 0 0 0 transparent),
    inset 0 0 0 100cqw rgba(0, 0, 0, calc(var(--press) * 0.2)),
    inset 0 0.4cqw 0 rgba(255, 255, 255, calc(0.16 - var(--press) * 0.08)),
    inset 0 -0.5cqw 1cqw rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.dock-tile--fill {
  background: var(--tile-bg);
}

.dock-tile--prime {
  --tile-bg: #0779ff;
}

.dock-item.is-on .dock-tile {
  --glow: 0 0 2.6cqw rgba(231, 163, 74, 0.22);
  --ring: inset 0 0 0 0.51cqw #e7a34a, inset 0 0 2.4cqw rgba(231, 163, 74, 0.22);
}

.dock-logo {
  display: block;
  width: 11.8cqw;
  height: 11.8cqw;
  object-fit: contain;
}

.dock-tile--fill .dock-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dock-name {
  color: #6f695f;
  font-size: 2.82cqw;
  font-weight: 500;
}

.dock-item.is-on .dock-name {
  color: #f3e6d0;
  font-weight: 600;
}

.app-slab {
  padding: 3.08cqw;
  border: 1px solid rgba(246, 241, 231, 0.08);
  border-radius: 7.2cqw;
  background: #14171e;
  display: flex;
  flex-direction: column;
  gap: 3.08cqw;
}

.app-mode {
  display: flex;
  align-items: center;
  gap: 3.6cqw;
}

.app-mode-track {
  flex: 1;
  display: flex;
  padding: 1.03cqw;
  border-radius: 4.1cqw;
  background: #0e1015;
}

.app-mode-track span,
.app-lock {
  flex: 1;
  padding: 2.05cqw 0;
  border-radius: 3.08cqw;
  color: #6f695f;
  font-weight: 500;
  text-align: center;
}

.app-mode-track .is-on {
  background: #232733;
  color: #f6f1e7;
}

.app-lock {
  flex: none;
  min-width: 21.5cqw;
  padding: 3.08cqw 4.1cqw;
  border-radius: 4.1cqw;
  background: #0e1015;
}

/* Channel and volume rockers around the direction pad. 334 wide. */

.cluster {
  container-type: inline-size;
  width: 100%;
}

.cluster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rocker {
  --rock: 0;
  --rp: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3cqw;
  width: 18.6cqw;
  transition: --rock var(--release) var(--spring), --rp var(--release) var(--spring);
}

.rocker::before {
  content: "";
  position: absolute;
  top: -0.9cqw;
  left: 0;
  width: 100%;
  height: calc(40.1cqw + 3.6cqw);
  border-radius: 9.3cqw;
  background: rgba(0, 0, 0, 0.34);
  box-shadow:
    inset 0 0.5cqw 1.2cqw rgba(0, 0, 0, 0.8),
    0 0.3cqw 0 rgba(255, 255, 255, 0.04);
}

.rocker-cap {
  --sink: calc(var(--rp) * 0.9cqw);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6cqw;
  width: 16.77cqw;
  height: 40.1cqw;
  overflow: hidden;
  border-radius: 8.4cqw;
  background: #101114;
  transform: perspective(110cqw) translateY(var(--sink)) rotateX(calc(var(--rock) * 11deg));
  box-shadow:
    0 calc((1.8cqw - var(--sink)) * 0.5) 0 #1d1f24,
    0 calc(1.8cqw - var(--sink)) 0 #141519,
    0 calc(1.8cqw - var(--sink) + 0.3cqw) 0.6cqw rgba(0, 0, 0, 0.6),
    0 calc(3cqw - var(--sink)) calc(4cqw - var(--rp) * 1.6cqw) rgba(0, 0, 0, 0.55);
}

.rocker-cap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 30% at 50% 0%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0) 22% 78%, rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.rocker-half {
  flex: 1;
  display: grid;
  place-items: center;
  color: #f2eee6;
  font-size: 7.8cqw;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 -0.3cqw 0 rgba(0, 0, 0, 0.55), 0 0.25cqw 0 rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 0 0 100cqw rgba(0, 0, 0, calc(var(--shade) * 0.2)),
    inset 0 0.45cqw 0 rgba(255, 255, 255, 0.16),
    inset 0 -1cqw 2cqw rgba(0, 0, 0, 0.3);
}

.rocker-half--up {
  --shade: max(var(--rock), 0);
  background: linear-gradient(180deg, #4a4d56, #3a3d45 55%, #30323a);
}

.rocker-half--down {
  --shade: max(var(--rock) * -1, 0);
  background: linear-gradient(180deg, #3a3d45, #30323a 55%, #26282e);
}

.rocker.is-up { --rock: 1; --rp: 1; }
.rocker.is-down { --rock: -1; --rp: 1; }

.rocker-label {
  color: #6f695f;
  font-size: 3.3cqw;
  font-weight: 600;
  letter-spacing: 0.15em;
}

/* Direction pad. Its own parts use a 100-wide reference. The ring rocks on a
   pivot under OK, so the pressed side sinks while the opposite edge stays up. */

.dpad {
  --tx: 0;
  --ty: 0;
  --rp: 0;
  --sink: calc(var(--rp) * 1.6cqw - var(--tx) * 0.6cqw);
  container-type: inline-size;
  position: relative;
  width: 55.7cqw;
  padding-bottom: 4cqw;
  transition:
    --tx var(--release) var(--spring),
    --ty var(--release) var(--spring),
    --rp var(--release) var(--spring);
}

.dpad::before,
.dpad::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.dpad::before {
  left: -2.6cqw;
  top: -1cqw;
  width: 105.2cqw;
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.36);
  box-shadow:
    inset 0 1cqw 2.4cqw rgba(0, 0, 0, 0.85),
    0 0.5cqw 0 rgba(255, 255, 255, 0.05);
}

.dpad::after {
  left: 0;
  top: 3.2cqw;
  width: 100cqw;
  aspect-ratio: 1;
  background: linear-gradient(180deg, #a86c27, #7a4b17 60%, #5e3810);
  box-shadow:
    0 0.6cqw 1cqw rgba(0, 0, 0, 0.7),
    0 calc(4cqw - var(--rp) * 1.5cqw) calc(9cqw - var(--rp) * 4cqw) rgba(0, 0, 0, calc(0.55 - var(--rp) * 0.2));
}

.dpad-ring {
  position: relative;
  z-index: 1;
  display: block;
  width: 100cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(80% 50% at 50% 2%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.26)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0) 22% 78%, rgba(0, 0, 0, 0.16)),
    linear-gradient(45deg, transparent calc(50% - 1.35cqw), #1b1209 0 calc(50% + 1.35cqw), transparent 0),
    linear-gradient(-45deg, transparent calc(50% - 1.35cqw), #1b1209 0 calc(50% + 1.35cqw), transparent 0),
    #e7a042;
  transform:
    perspective(260cqw)
    translateY(var(--sink))
    rotateX(calc(var(--tx) * 8deg))
    rotateY(calc(var(--ty) * 8deg));
  box-shadow:
    inset 0 0.8cqw 0 rgba(255, 255, 255, 0.26),
    inset 0 -1.6cqw 3.2cqw rgba(0, 0, 0, 0.3),
    inset 0 0 0 0.3cqw rgba(122, 75, 23, 0.35);
}

.dpad-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 47.4cqw;
  height: 47.4cqw;
  border-radius: 50%;
  background: #1b1209;
  box-shadow: inset 0 1cqw 1.6cqw rgba(0, 0, 0, 0.8);
}

.dpad-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from -45deg,
    rgba(40, 20, 0, calc(max(var(--tx), 0) * 0.26)) 0 90deg,
    rgba(40, 20, 0, calc(max(var(--ty), 0) * 0.26)) 0 180deg,
    rgba(40, 20, 0, calc(max(var(--tx) * -1, 0) * 0.26)) 0 270deg,
    rgba(40, 20, 0, calc(max(var(--ty) * -1, 0) * 0.26)) 0 360deg
  );
  pointer-events: none;
}

.dpad.is-n { --tx: 1; --rp: 1; }
.dpad.is-s { --tx: -1; --rp: 1; }
.dpad.is-e { --ty: 1; --rp: 1; }
.dpad.is-w { --ty: -1; --rp: 1; }

.chev {
  position: absolute;
  width: 6.5cqw;
  height: 6.5cqw;
  border-top: 1.9cqw solid #3a2408;
  border-left: 1.9cqw solid #3a2408;
  border-top-left-radius: 1cqw;
  filter: drop-shadow(0.25cqw 0.25cqw 0 rgba(255, 226, 170, 0.45));
}

.chev--n { left: 46.75cqw; top: 12.5cqw; transform: rotate(45deg); }
.chev--e { left: 81cqw; top: 46.75cqw; transform: rotate(135deg); }
.chev--s { left: 46.75cqw; top: 81cqw; transform: rotate(225deg); }
.chev--w { left: 12.5cqw; top: 46.75cqw; transform: rotate(-45deg); }

.dpad-ok {
  --press: 0;
  --sink: calc(var(--press) * 2.3cqw);
  position: absolute;
  z-index: 2;
  left: 29cqw;
  top: 29cqw;
  display: grid;
  place-items: center;
  width: 42cqw;
  height: 42cqw;
  border-radius: 50%;
  color: #f8f8fa;
  font-size: 8.8cqw;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 -0.3cqw 0 rgba(110, 68, 20, 0.55);
  background:
    radial-gradient(70% 45% at 50% 8%, rgba(255, 255, 255, calc(0.32 - var(--press) * 0.18)), rgba(255, 255, 255, 0) 70%),
    radial-gradient(100% 100% at 50% 35%, rgba(0, 0, 0, 0) 55%, rgba(110, 68, 20, 0.22)),
    linear-gradient(180deg, #f0b65c, #e7a34a 55%, #c9842e);
  transform: translateY(var(--sink)) scale(calc(1 - var(--press) * 0.02));
  transition: --press var(--release) var(--spring);
  box-shadow:
    inset 0 0 0 100cqw rgba(60, 40, 10, calc(var(--press) * 0.12)),
    inset 0 0.8cqw 0 rgba(255, 255, 255, calc(0.4 - var(--press) * 0.2)),
    inset 0 -1.6cqw 3cqw rgba(0, 0, 0, 0.16),
    0 calc((2.7cqw - var(--sink)) * 0.5) 0 #a86b22,
    0 calc(2.7cqw - var(--sink)) 0 #6e4414,
    0 calc(2.7cqw - var(--sink) + 0.5cqw) 0.9cqw rgba(0, 0, 0, 0.55),
    0 calc(4.5cqw - var(--sink) * 1.4) calc(6cqw - var(--press) * 3.5cqw) rgba(0, 0, 0, calc(0.45 - var(--press) * 0.15));
}

/* Keycaps. 334 wide. */

.keys {
  container-type: inline-size;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2.4cqw;
}

.keys-row {
  display: flex;
  gap: 2.4cqw;
}

.key {
  --press: 0;
  --depth: 1.8cqw;
  --sink: calc(var(--press) * (var(--depth) - 0.25cqw));
  --f1: #464952;
  --f2: #373a42;
  --f3: #2d2f36;
  --side: #18191d;
  --side-hi: #24262c;
  --hi: 0.2;
  --engrave: 0 -0.3cqw 0 rgba(0, 0, 0, 0.55), 0 0.25cqw 0 rgba(255, 255, 255, 0.07);
  position: relative;
  flex: 1;
  display: block;
  padding-bottom: var(--depth);
  transition: --press var(--release) var(--spring);
}

.key::before {
  content: "";
  position: absolute;
  inset: -0.6cqw;
  border-radius: 4.8cqw;
  background: rgba(0, 0, 0, 0.3);
  box-shadow:
    inset 0 0.5cqw 1cqw rgba(0, 0, 0, 0.75),
    0 0.3cqw 0 rgba(255, 255, 255, 0.04);
}

.key-face {
  position: relative;
  display: grid;
  place-items: center;
  height: 15.6cqw;
  border-radius: 4.2cqw;
  color: #f6f1e7;
  font-size: 3.9cqw;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-shadow: var(--engrave);
  background:
    radial-gradient(120% 70% at 50% -12%, rgba(255, 255, 255, calc(var(--hi) * 0.8 - var(--press) * 0.08)), rgba(255, 255, 255, 0) 62%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0) 16% 84%, rgba(0, 0, 0, 0.14)),
    linear-gradient(180deg, var(--f1), var(--f2) 55%, var(--f3));
  transform: translateY(var(--sink)) scale(calc(1 - var(--press) * 0.012));
  box-shadow:
    inset 0 0 0 100cqw rgba(0, 0, 0, calc(var(--press) * 0.14)),
    inset 0 0.45cqw 0 rgba(255, 255, 255, calc(var(--hi) * (1 - var(--press) * 0.5))),
    inset 0 -0.9cqw 1.8cqw rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 calc((var(--depth) - var(--sink)) * 0.5) 0 var(--side-hi),
    0 calc(var(--depth) - var(--sink)) 0 var(--side),
    0 calc(var(--depth) - var(--sink) + 0.3cqw) 0.6cqw rgba(0, 0, 0, 0.6),
    0 calc((var(--depth) - var(--sink)) * 1.7 + 0.6cqw) calc(3.4cqw - var(--press) * 2.6cqw) rgba(0, 0, 0, calc(0.5 - var(--press) * 0.22));
}

.key--ok {
  --f1: #f0b65c;
  --f2: #e7a34a;
  --f3: #c9842e;
  --side: #6e4414;
  --side-hi: #a86b22;
  --hi: 0.4;
  --engrave: 0 0.3cqw 0 rgba(255, 220, 160, 0.45), 0 -0.2cqw 0 rgba(90, 60, 20, 0.3);
}

.key-face svg {
  display: block;
  width: 7.2cqw;
  height: 7.2cqw;
  fill: currentColor;
  filter: drop-shadow(0 -0.3cqw 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0.25cqw 0 rgba(255, 255, 255, 0.07));
}

.key--ok .key-face svg {
  width: 8cqw;
  height: 8cqw;
  filter: drop-shadow(0 0.3cqw 0 rgba(255, 255, 255, 0.7));
}

.key--ok .key-face {
  color: #2a1c08;
  font-size: 4.8cqw;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}

.key--red { --f1: #e66b6b; --f2: #c93e3e; --f3: #a52d2d; --side: #4a1111; --side-hi: #7a2020; --hi: 0.25; }
.key--green { --f1: #55b37e; --f2: #33905c; --f3: #267247; --side: #0f321e; --side-hi: #1b5233; --hi: 0.25; }
.key--yellow { --f1: #ebc963; --f2: #cfa82c; --f3: #ae8a1b; --side: #4a3a0a; --side-hi: #7a6014; --hi: 0.3; }
.key--blue { --f1: #6189da; --f2: #3463c4; --f3: #284fa0; --side: #0f2147; --side-hi: #1c3a78; --hi: 0.25; }

/* Going down is quick and plain; coming back up overshoots a touch. */
.key.is-pressed,
.dpad-ok.is-pressed,
.dock-tile.is-pressed,
.app-power.is-pressed { --press: 1; }

.key.is-pressed,
.dpad-ok.is-pressed,
.dock-tile.is-pressed,
.app-power.is-pressed,
.dpad:is(.is-n, .is-e, .is-s, .is-w),
.rocker:is(.is-up, .is-down) {
  transition-duration: 0.07s;
  transition-timing-function: cubic-bezier(0.3, 0, 0.6, 1);
}

@keyframes key-tap {
  0%, 74%, 100% { --press: 0; }
  78%, 85% { --press: 1; }
  89% { --press: -0.14; }
  93% { --press: 0.05; }
}

@keyframes ok-tap {
  0%, 70%, 100% { --press: 0; }
  74%, 81% { --press: 1; }
  85% { --press: -0.12; }
  89% { --press: 0.04; }
}

@keyframes dpad-tour {
  0%, 6%, 20%, 26%, 40%, 46%, 60%, 66%, 100% { --tx: 0; --ty: 0; --rp: 0; }
  8%, 13% { --tx: 1; --ty: 0; --rp: 1; }
  28%, 33% { --tx: 0; --ty: 1; --rp: 1; }
  48%, 53% { --tx: -1; --ty: 0; --rp: 1; }
  68%, 73% { --tx: 0; --ty: -1; --rp: 1; }
  16% { --tx: -0.12; --rp: -0.1; }
  36% { --ty: -0.12; --rp: -0.1; }
  56% { --tx: 0.12; --rp: -0.1; }
  76% { --ty: 0.12; --rp: -0.1; }
}

@keyframes ok-tour {
  0%, 82%, 100% { --press: 0; }
  86%, 91% { --press: 1; }
  94% { --press: -0.12; }
  97% { --press: 0.04; }
}

@media (prefers-reduced-motion: no-preference) {
  .device .dpad-ok { animation: ok-tap 4.2s ease-in-out 1.8s infinite; }
  .device .key--ok { animation: key-tap 4.2s ease-in-out 3.4s infinite; }
}

/* Pack looks (Soft and Convex): the same parts on a plate modelled by a shadow and a highlight
   instead of plastic sides. Palettes match the app's themes; everything else (gradients, shadows,
   grooves) is mixed from these six colours. */

.remote-look {
  --cl-plate: #ebecf0;
  --cl-dark: #a3b8cc;
  --cl-light: #ffffff;
  --cl-ink: #2b303a;
  --cl-dim: #525a67;
  --cl-accent: #0062d6;
  --cl-canvas: color-mix(in srgb, var(--cl-plate) 80%, var(--cl-dark));
  --cl-well: color-mix(in srgb, var(--cl-plate) 84%, var(--cl-dark));
  --cl-face-hi: color-mix(in srgb, var(--cl-plate) 72%, var(--cl-light));
  --cl-face-lo: color-mix(in srgb, var(--cl-plate) 94%, var(--cl-dark));
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3.6vw, 28px);
  padding: clamp(16px, 3.6vw, 28px);
  border-radius: clamp(32px, 6vw, 48px);
  background: var(--cl-canvas);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--cl-light) 70%, transparent),
    0 50px 100px -30px rgba(0, 0, 0, 0.7),
    0 20px 40px -20px rgba(0, 0, 0, 0.5);
}

.remote-look[data-look="gold"] {
  --cl-plate: #c4a35a; --cl-dark: #8e6f2e; --cl-light: #e8d08a;
  --cl-ink: #3a2e18; --cl-dim: #5c4a28; --cl-accent: #7a5414;
}

.remote-look[data-look="graphite"] {
  --cl-plate: #303030; --cl-dark: #1f1f1f; --cl-light: #454545;
  --cl-ink: #ededed; --cl-dim: #b8b8b8; --cl-accent: #6eb6ff;
}

.remote-look[data-look="soft"] {
  --cl-plate: #e0e5ec; --cl-dark: #a3b1c6; --cl-light: #ffffff;
  --cl-ink: #4d5566; --cl-dim: #7a8499; --cl-accent: #5b7cff;
}

.remote-look[data-look="metallic"] {
  --cl-plate: #6f7884; --cl-dark: #3e464f; --cl-light: #9aa4b0;
  --cl-ink: #f0f3f6; --cl-dim: #c8d0d8; --cl-accent: #d8dee6;
}

.remote-look[data-look="warm"] {
  --cl-plate: #f4f0ea; --cl-dark: #d6cec2; --cl-light: #ffffff;
  --cl-ink: #2b303a; --cl-dim: #525a67; --cl-accent: #0062d6;
}

.look-slab {
  padding: clamp(16px, 4vw, 30px) clamp(14px, 3.4vw, 26px);
  border-radius: clamp(24px, 4.6vw, 36px);
  background: linear-gradient(145deg, color-mix(in srgb, var(--cl-plate) 88%, var(--cl-dark)), color-mix(in srgb, var(--cl-plate) 74%, var(--cl-dark)));
  box-shadow:
    8px 8px 20px color-mix(in srgb, var(--cl-dark) 55%, transparent),
    -8px -8px 20px color-mix(in srgb, var(--cl-light) 75%, transparent);
}

.look-name {
  margin: clamp(-6px, -1vw, -2px) 0 0;
  color: var(--cl-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.look-name b {
  margin-left: 0.4em;
  color: color-mix(in srgb, var(--cl-dim) 65%, var(--cl-canvas));
  font-weight: 500;
}

.remote-look .rocker::before {
  background: none;
  box-shadow: none;
}

.remote-look .rocker-cap {
  gap: 0;
  background: linear-gradient(145deg, var(--cl-face-hi), var(--cl-face-lo));
  box-shadow:
    calc(1.2cqw - var(--sink)) calc(1.4cqw - var(--sink)) calc(3.4cqw - var(--rp) * 1.4cqw) color-mix(in srgb, var(--cl-dark) calc(80% - var(--rp) * 30%), transparent),
    -1cqw -1cqw 2.8cqw color-mix(in srgb, var(--cl-light) 95%, transparent);
}

.remote-look .rocker-cap::after {
  background: linear-gradient(160deg, color-mix(in srgb, var(--cl-light) 55%, transparent), transparent 40%);
}

.remote-look .rocker-half {
  color: var(--cl-ink);
  text-shadow: none;
  background: none;
  box-shadow: inset 0 0 0 100cqw color-mix(in srgb, var(--cl-dark) calc(var(--held, 0) * 28%), transparent);
}

.remote-look .rocker-half--up {
  --held: max(var(--rock), 0);
  background: linear-gradient(color-mix(in srgb, var(--cl-dark) 55%, transparent), color-mix(in srgb, var(--cl-dark) 55%, transparent)) no-repeat 50% 100% / 40% 0.3cqw;
}

.remote-look .rocker-half--down { --held: max(var(--rock) * -1, 0); }

.remote-look .rocker-label { color: var(--cl-dim); }

.remote-look .dpad::before {
  background: var(--cl-well);
  box-shadow:
    inset 1.4cqw 1.4cqw 3cqw color-mix(in srgb, var(--cl-dark) 60%, transparent),
    inset -1.4cqw -1.4cqw 3cqw color-mix(in srgb, var(--cl-light) 90%, transparent);
}

.remote-look .dpad::after {
  background: var(--cl-face-lo);
  box-shadow:
    calc(2cqw - var(--rp) * 1cqw) calc(2.4cqw - var(--rp) * 1.2cqw) calc(5cqw - var(--rp) * 2cqw) color-mix(in srgb, var(--cl-dark) 70%, transparent),
    -1.6cqw -1.6cqw 4cqw color-mix(in srgb, var(--cl-light) 90%, transparent);
}

/* Four convex petals: the diagonal grooves and centre well show the plate below. */
.remote-look .dpad-ring {
  background:
    radial-gradient(90% 70% at 30% 18%, color-mix(in srgb, var(--cl-light) 70%, transparent), transparent 70%),
    linear-gradient(45deg, transparent calc(50% - 1.5cqw), var(--cl-well) 0 calc(50% + 1.5cqw), transparent 0),
    linear-gradient(-45deg, transparent calc(50% - 1.5cqw), var(--cl-well) 0 calc(50% + 1.5cqw), transparent 0),
    var(--cl-plate);
  box-shadow:
    inset 0.8cqw 0.8cqw 1.4cqw color-mix(in srgb, var(--cl-light) 85%, transparent),
    inset -1.2cqw -1.2cqw 2.4cqw color-mix(in srgb, var(--cl-dark) 40%, transparent);
}

.remote-look .dpad-ring::before {
  background: var(--cl-well);
  box-shadow:
    inset 1.2cqw 1.2cqw 2.4cqw color-mix(in srgb, var(--cl-dark) 60%, transparent),
    inset -1cqw -1cqw 2cqw color-mix(in srgb, var(--cl-light) 90%, transparent);
}

.remote-look .dpad-ring::after {
  background: conic-gradient(
    from -45deg,
    color-mix(in srgb, var(--cl-dark) calc(max(var(--tx), 0) * 30%), transparent) 0 90deg,
    color-mix(in srgb, var(--cl-dark) calc(max(var(--ty), 0) * 30%), transparent) 0 180deg,
    color-mix(in srgb, var(--cl-dark) calc(max(var(--tx) * -1, 0) * 30%), transparent) 0 270deg,
    color-mix(in srgb, var(--cl-dark) calc(max(var(--ty) * -1, 0) * 30%), transparent) 0 360deg
  );
}

.remote-look .chev {
  border-top: 1.5cqw solid var(--cl-ink);
  border-left: 1.5cqw solid var(--cl-ink);
  filter: none;
}

.remote-look .dpad-ok {
  color: var(--cl-ink);
  text-shadow: none;
  background: linear-gradient(145deg, var(--cl-face-hi), var(--cl-face-lo));
  box-shadow:
    inset 0 0 0 100cqw color-mix(in srgb, var(--cl-dark) calc(var(--press) * 22%), transparent),
    calc(1.6cqw - var(--sink) * 0.5) calc(1.8cqw - var(--sink) * 0.5) calc(3.6cqw - var(--press) * 2cqw) color-mix(in srgb, var(--cl-dark) calc(80% - var(--press) * 35%), transparent),
    -1.2cqw -1.2cqw 3cqw color-mix(in srgb, var(--cl-light) calc(95% - var(--press) * 40%), transparent);
}

.remote-look .key::before {
  background: none;
  box-shadow: none;
}

.remote-look .key-face {
  color: var(--cl-ink);
  text-shadow: none;
  background: linear-gradient(145deg, var(--cl-face-hi), var(--cl-face-lo));
  box-shadow:
    inset 0 0 0 100cqw color-mix(in srgb, var(--cl-dark) calc(var(--press) * 20%), transparent),
    inset 0.3cqw 0.3cqw 0 color-mix(in srgb, var(--cl-light) calc(70% - var(--press) * 40%), transparent),
    calc(1.3cqw - var(--sink) * 0.5) calc(1.5cqw - var(--sink) * 0.5) calc(3.2cqw - var(--press) * 1.8cqw) color-mix(in srgb, var(--cl-dark) calc(75% - var(--press) * 35%), transparent),
    -1cqw -1cqw 2.6cqw color-mix(in srgb, var(--cl-light) calc(95% - var(--press) * 40%), transparent);
}

.remote-look .key-face svg,
.remote-look .key--ok .key-face svg { filter: none; }

.remote-look .key--ok .key-face { color: var(--cl-accent); }
