/* On touch devices only the release canvas and its original controls are visible. */
.handheld, .handheld-case, .handheld-glass { display: contents; }
.handheld-pad, .handheld-wordmark, .handheld-actions, .handheld-system, .handheld-keys { display: none; }

@media (hover: hover) and (pointer: fine) {
  body {
    background: radial-gradient(ellipse at 50% 39%, #37334c 0, #201e32 45%, #131323 86%);
    overflow: auto;
    touch-action: auto;
  }
  .handheld {
    --lcd: min(565px, 45vw, 65vh);
    --wing: min(166px, 16vw, 21vh);
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    box-sizing: border-box;
    align-content: center;
    justify-items: center;
    gap: clamp(18px, 3.5vh, 36px);
    padding: 16px 8px 24px;
    color: #efebfa;
    font-family: system-ui, sans-serif;
  }
  .handheld-case {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: var(--wing) minmax(0, auto) var(--wing);
    align-items: center;
    padding: clamp(12px, 2.2vh, 22px) 0;
    border: 2px solid #d9cff3;
    border-bottom-color: #9284ac;
    border-radius: clamp(28px, 5vw, 66px);
    background: linear-gradient(120deg, #d5cbe5, #b6a5d0 34%, #b4a3ce 70%, #cebddf);
    box-shadow: inset 0 3px 1px #f0e4f3, inset 0 -6px 0 #a798ba,
      0 4px 0 #786b8d, 0 7px 0 #554c68, 0 23px 48px #09081399;
  }
  .handheld-case::before, .handheld-case::after {
    content: "";
    position: absolute;
    pointer-events: none;
  }
  .handheld-case::before {
    left: calc(var(--wing) * .37);
    top: 13%;
    width: 7px; height: 7px;
    border-radius: 100%;
    background: #c1f6d6;
    box-shadow: 0 0 0 2px #847b92, 0 0 8px 3px #cdffdd88;
  }
  .handheld-case::after {
    bottom: 14%; right: calc(var(--wing) * .29);
    width: calc(var(--wing) * .43); height: 19px;
    background: radial-gradient(circle, #776d8a 1.4px, transparent 2px) 0 0 / 7px 7px;
  }
  .handheld-glass {
    display: grid;
    grid-area: 1 / 2;
    justify-items: center;
    padding: clamp(9px, 1.5vh, 18px) clamp(9px, 1.2vw, 18px) 0;
    border: 2px solid #242133;
    border-radius: clamp(10px, 1.6vw, 22px);
    background: linear-gradient(128deg, #302d41, #1e1d2b 55%, #312c41);
    box-shadow: 0 1px 1px #ede2ff, inset 0 1px 1px #59546b;
  }
  .handheld #game {
    position: relative;
    display: grid;
    width: var(--lcd);
    height: auto;
    aspect-ratio: 160 / 144;
    overflow: hidden;
    border-radius: 3px;
    background: #14151e;
  }
  .handheld #game canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    margin: 0;
    object-fit: contain;
  }
  .handheld-wordmark {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    padding: 6px 0 8px;
    color: #d6cee5;
    line-height: 1;
  }
  .handheld-wordmark b { font-size: 12px; font-weight: 850; letter-spacing: .12em; }
  .handheld-wordmark span { font-size: 10px; letter-spacing: .02em; }
  .handheld-case button {
    appearance: none;
    border: 0;
    color: #f0eaf7;
    cursor: pointer;
    font: 650 14px/1 system-ui, sans-serif;
    touch-action: none;
  }
  .handheld-case button:focus-visible { outline: 3px solid #fff8db; outline-offset: 3px; z-index: 1; }
  .handheld-pad {
    display: grid;
    grid-area: 1 / 1;
    place-self: center;
    width: min(77%, 110px);
    aspect-ratio: 1;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    filter: drop-shadow(0 3px 1px #736985);
  }
  .handheld-pad::before { content: ""; grid-area: 2 / 2; background: #504a60; }
  .handheld-pad button { padding: 0; background: #504a60; color: #cfc6de; }
  .pad-up { grid-area: 1 / 2; border-radius: 6px 6px 0 0; }
  .pad-left { grid-area: 2 / 1; border-radius: 6px 0 0 6px; }
  .pad-right { grid-area: 2 / 3; border-radius: 0 6px 6px 0; }
  .pad-down { grid-area: 3 / 2; border-radius: 0 0 6px 6px; }
  .handheld-actions {
    display: flex;
    grid-area: 1 / 3;
    place-self: center;
    justify-content: space-between;
    align-items: center;
    width: 76%;
    max-width: 122px;
  }
  .handheld-actions button {
    width: 44%; aspect-ratio: 1;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #5c3d77;
    background: linear-gradient(150deg, #9578b7, #6d4d93);
    box-shadow: inset 1px 2px 1px #c1a1dc, 0 3px 0 #503467, 0 4px 5px #69587788;
    font-size: clamp(12px, 1.25vw, 21px);
  }
  .action-a { translate: 0 -24%; }
  .action-b { translate: 0 24%; }
  .handheld-system {
    display: flex;
    position: absolute;
    bottom: 17%; left: 0;
    justify-content: center;
    gap: 7px;
    width: var(--wing);
  }
  .handheld-system button {
    padding: 0; background: transparent; color: #43394f;
    font-size: clamp(8px, .8vw, 11px); letter-spacing: .02em;
  }
  .handheld-system button::before {
    display: block;
    content: "";
    width: 22px; height: 7px; margin: 0 auto 5px;
    border-radius: 10px;
    background: #746a85;
    box-shadow: inset 0 1px 1px #b4a6c8, 0 2px 0 #5b5269;
  }
  .handheld-pad button:active, .handheld-pad button[data-held],
  .handheld-actions button:active, .handheld-actions button[data-held],
  .handheld-system button:active::before, .handheld-system button[data-held]::before {
    filter: brightness(.78);
  }
  .handheld-keys {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: clamp(14px, 2.5vw, 34px);
    row-gap: 8px;
    margin: 0;
  }
  .handheld-keys > div, .handheld-keys dd { display: flex; align-items: center; gap: 5px; }
  .handheld-keys dt { font-size: 13px; font-weight: 550; margin-right: 2px; }
  .handheld-keys dd { margin: 0; gap: 3px; }
  .handheld-keys kbd {
    padding: 4px 6px;
    border: 1px solid #736a85; border-bottom-width: 2px; border-radius: 5px;
    background: #373246; color: #f6f1fc;
    font: 600 12px/1 ui-monospace, monospace;
  }
  .handheld-keys dd span { margin-left: 3px; color: #c9c1d6; font-size: 12px; }
  #controller { display: none !important; }
}
@media (hover: hover) and (pointer: fine) and (max-width: 560px) {
  .handheld { --wing: 17vw; --lcd: min(52vw, 65vh); }
  .handheld-keys { max-width: 350px; }
  .handheld-system { bottom: 9%; gap: 4px; }
  .handheld-case::after { bottom: 11%; }
}
