/* Portrait control geometry adapted from OpenSmash.
https://github.com/turtlesoupy/opensmash/tree/419d195ee53373a7f50bb48469eb22114436797d
Original: web-prototype/src/styles.css, lines 1514–1742.
Melee adaptation: scoped selectors, local background fallback, real Shield/L semantics.

MIT License

Copyright (c) 2026 Thomas Dimson and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
.melee-touch-controls { display: none; }
.melee-touch-controls .touch-controls-help { position:absolute; width:1px; height:1px; margin:-1px; padding:0; border:0; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
@media (max-width: 960px), (hover: none) and (pointer: coarse) {
  .melee-touch-controls {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: clamp(200px, 53vw, 236px);
    overflow: hidden;
    border-top: 2px solid rgba(126, 74, 47, .72);
    background:
      linear-gradient(rgba(4, 3, 3, .58), rgba(3, 2, 2, .82)),
      var(--stone-background-image, linear-gradient(#161318, #09080b)) center / 256px 128px;
    box-shadow: inset 0 10px 24px rgba(0, 0, 0, .55);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .melee-touch-controls button {
    appearance: none;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 244, 220, .48);
    outline: 0;
    color: #fff9e9;
    font-family: "Kanit", ui-sans-serif, system-ui, sans-serif;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .75);
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }

  .melee-touch-controls button:focus-visible {
    outline: 3px solid #fff0b5;
    outline-offset: 3px;
  }

  .melee-touch-controls .mobile-control-button {
    display: grid;
    place-content: center;
    gap: 2px;
    border-radius: 999px;
    background: rgba(28, 25, 27, .76);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .18),
      inset 0 -4px 0 rgba(0, 0, 0, .3),
      0 4px 12px rgba(0, 0, 0, .35);
    transition: transform 70ms ease, filter 70ms ease, background 70ms ease;
  }

  .melee-touch-controls .mobile-control-button > span { font-size: clamp(15px, 4.6vw, 22px); }
  .melee-touch-controls .mobile-control-button > small {
    font-size: clamp(7px, 1.8vw, 9px);
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .8;
  }

  .melee-touch-controls .mobile-control-button[aria-pressed="true"] {
    filter: brightness(1.24);
    transform: translateY(3px) scale(.96);
  }

  .melee-touch-controls .mobile-shoulder-controls {
    position: absolute;
    top: max(6px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    pointer-events: none;
  }

  .melee-touch-controls .mobile-control-button.is-shoulder {
    width: clamp(50px, 14vw, 72px);
    min-height: 44px;
    border-radius: 14px 14px 22px 22px;
    background: rgba(80, 82, 88, .76);
  }

  .melee-touch-controls .mobile-control-button.is-shoulder > span { font-size: clamp(14px, 3.8vw, 18px); }
  .melee-touch-controls .mobile-control-button.is-shoulder > small { display: none; }

  .melee-touch-controls .mobile-start-button {
    width: clamp(60px, 16vw, 84px);
    height: 44px;
    border-radius: 999px;
    background: rgba(106, 28, 23, .8);
    box-shadow: inset 0 2px rgba(255, 255, 255, .15), 0 3px 10px rgba(0, 0, 0, .35);
    font-size: clamp(10px, 2.6vw, 13px);
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .melee-touch-controls .mobile-start-button:active { transform: translateY(2px); }

  .melee-touch-controls .mobile-joystick {
    position: absolute;
    left: max(clamp(10px, 3.5vw, 24px), env(safe-area-inset-left));
    bottom: max(clamp(10px, 3.5vw, 24px), env(safe-area-inset-bottom));
    width: clamp(96px, 28vw, 130px);
    height: clamp(96px, 28vw, 130px);
    border-radius: 50%;
    background:
      radial-gradient(circle, rgba(102, 104, 111, .62) 0 24%, transparent 25%),
      repeating-conic-gradient(from 22.5deg, rgba(255, 255, 255, .05) 0 45deg, rgba(0, 0, 0, .08) 45deg 90deg),
      rgba(23, 24, 27, .64);
    box-shadow:
      inset 0 0 0 8px rgba(255, 255, 255, .05),
      inset 0 0 26px rgba(0, 0, 0, .52),
      0 5px 18px rgba(0, 0, 0, .4);
  }


  .melee-touch-controls .mobile-joystick::before,
  .melee-touch-controls .mobile-joystick::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: rgba(255, 255, 255, .13);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .melee-touch-controls .mobile-joystick::before { width: 56%; height: 1px; }
  .melee-touch-controls .mobile-joystick::after { width: 1px; height: 56%; }

  .melee-touch-controls .mobile-joystick-ring {
    position: absolute;
    inset: 22%;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 50%;
    pointer-events: none;
  }

  .melee-touch-controls .mobile-joystick-knob {
    position: absolute;
    left: calc(50% - clamp(22px, 6.25vw, 29px));
    top: calc(50% - clamp(22px, 6.25vw, 29px));
    width: clamp(44px, 12.5vw, 58px);
    height: clamp(44px, 12.5vw, 58px);
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, #8a8d94, #45474d 60%, #292b2f);
    box-shadow: inset 0 3px 4px rgba(255, 255, 255, .16), 0 5px 10px rgba(0, 0, 0, .45);
    pointer-events: none;
    will-change: transform;
  }

  /* Action cluster: Z (shield) bottom-left, B bottom-middle, A bottom-right,
     Jump (C-up) above A. */
  .melee-touch-controls .mobile-action-controls {
    position: absolute;
    right: max(clamp(8px, 2.5vw, 20px), env(safe-area-inset-right));
    bottom: max(clamp(8px, 2.5vw, 20px), env(safe-area-inset-bottom));
    width: clamp(168px, 46vw, 214px);
    height: clamp(128px, 36vw, 162px);
    pointer-events: none;
  }

  .melee-touch-controls .mobile-action-controls > .mobile-control-button { position: absolute; }

  .melee-touch-controls .mobile-control-button.is-action {
    border-width: 2px;
    color: #fff;
  }

  .melee-touch-controls .mobile-control-button.is-a {
    right: 0;
    bottom: 14%;
    width: clamp(58px, 16vw, 74px);
    height: clamp(58px, 16vw, 74px);
    border-color: rgba(179, 210, 255, .8);
    background: rgba(38, 88, 190, .82);
  }

  .melee-touch-controls .mobile-control-button.is-b {
    right: 37%;
    bottom: 0;
    width: clamp(50px, 14vw, 64px);
    height: clamp(50px, 14vw, 64px);
    border-color: rgba(177, 241, 194, .78);
    background: rgba(16, 139, 67, .82);
  }

  .melee-touch-controls .mobile-control-button.is-jump {
    right: 4%;
    top: 0;
    width: clamp(46px, 13vw, 58px);
    height: clamp(46px, 13vw, 58px);
    border-color: rgba(255, 224, 150, .8);
    background: rgba(196, 130, 24, .82);
  }

  .melee-touch-controls .mobile-control-button.is-jump > span { font-size: clamp(16px, 5vw, 24px); }
  .melee-touch-controls .mobile-control-button.is-jump > small { font-size: clamp(6px, 1.6vw, 8px); }

  .melee-touch-controls .mobile-control-button.is-z {
    left: 0;
    bottom: 0;
    width: clamp(50px, 13vw, 64px);
    height: clamp(44px, 11vw, 54px);
    border-radius: 16px;
    background: rgba(78, 75, 96, .82);
  }

  .melee-touch-controls .mobile-control-button.is-z > span { font-size: clamp(14px, 3.8vw, 18px); }
  .melee-touch-controls .mobile-control-button.is-z > small { font-size: clamp(6px, 1.6vw, 8px); }

}
@media (max-width: 480px) and (orientation: portrait) {
  .melee-touch-controls .mobile-action-controls { right: 6px; }
  .melee-touch-controls .mobile-joystick { left: 8px; }
}
.melee-touch-controls[hidden] { display:none; }
@media (prefers-reduced-motion: reduce) { .melee-touch-controls .mobile-control-button { transition:none; } }
