.fc-page {
  background:
    radial-gradient(circle at 15% 14%, rgba(216, 58, 50, 0.22), transparent 25%),
    radial-gradient(circle at 82% 18%, rgba(215, 166, 74, 0.18), transparent 24%),
    linear-gradient(135deg, #151013, #241217 48%, #101419);
  touch-action: manipulation;
}

.fc-shell {
  width: min(1220px, calc(100% - 24px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 0 22px;
}

.fc-cabinet {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(420px, 1fr) minmax(150px, 210px);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 130px);
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.1), transparent 32%),
    linear-gradient(135deg, #d8d2c8, #a59d93 48%, #6f6862);
  color: #191315;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.42), inset 0 -10px 0 rgba(0,0,0,.1);
}

.controller-area {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-width: 0;
}

.pad-label {
  font-size: 28px;
  font-weight: 700;
  color: rgba(25, 19, 21, 0.58);
}

.dpad {
  position: relative;
  width: 156px;
  height: 156px;
}

.dpad button,
.ab-buttons button,
.function-row button {
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dpad button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2e2e32, #0b0b0d);
  color: #dfdfdf;
  box-shadow: 0 7px 0 #050506, 0 14px 20px rgba(0, 0, 0, 0.28);
}

.dpad button:active,
.dpad button.pressed,
.ab-buttons button:active,
.ab-buttons button.pressed,
.function-row button:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #050506, 0 8px 12px rgba(0, 0, 0, 0.28);
}

.dpad .up { left: 51px; top: 0; }
.dpad .left { left: 0; top: 51px; }
.dpad .right { right: 0; top: 51px; }
.dpad .down { left: 51px; bottom: 0; }
.dpad i {
  position: absolute;
  left: 54px;
  top: 54px;
  width: 48px;
  height: 48px;
  border-radius: 9px;
  background: #151518;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.screen-area {
  display: grid;
  grid-template-rows: auto auto minmax(320px, 1fr) auto;
  gap: 14px;
  min-width: 0;
}

.cartridge {
  justify-self: center;
  display: grid;
  gap: 3px;
  min-width: min(460px, 100%);
  padding: 13px 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #211b1d, #0f0d0e);
  color: #f8e3b0;
  text-align: center;
  font-weight: 700;
  letter-spacing: .08em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.cartridge span {
  color: rgba(248, 227, 176, .68);
  font-size: 11px;
}

.cartridge strong {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.game-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.game-menu button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(0, 0, 0, .16);
  border-radius: 999px;
  background: linear-gradient(180deg, #f5efe5, #c5bbb0);
  color: #201819;
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
  cursor: pointer;
  font-weight: 700;
}

.game-menu button.selected {
  background: linear-gradient(135deg, #d83a32, #8d1f21);
  color: #fff6e8;
}

.screen-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 18px;
  border: 18px solid #0a0a0c;
  border-radius: 18px;
  background:
    linear-gradient(transparent 50%, rgba(0, 0, 0, 0.18) 51%),
    #101418;
  background-size: 100% 4px;
  overflow: hidden;
  box-shadow: inset 0 0 38px rgba(0,0,0,.76), 0 18px 40px rgba(0,0,0,.24);
}

.screen-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,0,0,.035), rgba(0,255,255,.035)),
    radial-gradient(circle at 50% 50%, transparent 40%, rgba(0,0,0,.24));
  mix-blend-mode: screen;
}

iframe {
  width: 100%;
  height: min(62vh, 560px);
  min-height: 360px;
  border: 0;
  background: #101418;
}

.function-row {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.function-row button {
  min-width: 116px;
  min-height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a3a3d, #111113);
  color: #f1f1f1;
  box-shadow: 0 5px 0 #050506, 0 10px 14px rgba(0,0,0,.22);
  font-weight: 700;
}

.ab-buttons {
  position: relative;
  display: flex;
  gap: 22px;
  align-items: center;
  transform: rotate(-12deg);
}

.ab-buttons button {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e84b45, #8d1f21);
  color: #fff6e8;
  box-shadow: 0 8px 0 #5d1214, 0 16px 22px rgba(0,0,0,.3);
  font-size: 28px;
  font-weight: 700;
}

.ab-buttons .b {
  margin-top: 22px;
}

.fc-help {
  margin-top: 12px;
  color: rgba(255,255,255,.62);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 900px) {
  .fc-cabinet {
    grid-template-columns: 1fr 1fr;
  }

  .screen-area {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .left-pad {
    grid-column: 1;
    grid-row: 2;
  }

  .action-pad {
    grid-column: 2;
    grid-row: 2;
  }

  canvas {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .fc-shell {
    width: min(100% - 14px, 1220px);
    padding-top: 10px;
  }

  .fc-cabinet {
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .screen-frame {
    min-height: 250px;
    padding: 10px;
    border-width: 10px;
  }

  iframe {
    min-height: 270px;
    height: 52vh;
  }

  .dpad {
    width: 132px;
    height: 132px;
  }

  .dpad button {
    width: 46px;
    height: 46px;
  }

  .dpad .up { left: 43px; }
  .dpad .left { top: 43px; }
  .dpad .right { top: 43px; }
  .dpad .down { left: 43px; }
  .dpad i {
    left: 46px;
    top: 46px;
    width: 40px;
    height: 40px;
  }

  .ab-buttons {
    gap: 14px;
  }

  .ab-buttons button {
    width: 64px;
    height: 64px;
  }
}
