/* Shared native-button component. Frame SVGs contain no fill or text.
   Nine-sliced 24px rails stay fixed while the middle stretches. */
button.hud-button {
  --hud-accent: #45d9ff;
  --hud-rgb: 69, 217, 255;
  --hud-frame: url('../assets/ui/hud-frame-blue.svg');
  --hud-cut: 20px;
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 5 / 1;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-image: var(--hud-frame) 28 / 24px / 0 stretch;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  font-family: var(--display-font);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .06em;
  text-align: center;
  color: #eefaff;
  text-shadow: 0 0 7px rgba(var(--hud-rgb), .28);
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  filter: drop-shadow(0 0 3px rgba(var(--hud-rgb), .23));
  transform: none;
  animation: none;
  transition: filter .15s ease, color .15s ease, transform .08s ease;
}
button.hud-green { --hud-accent: #66f0ba; --hud-rgb: 102, 240, 186; --hud-frame: url('../assets/ui/hud-frame-green.svg'); }
button.hud-orange { --hud-accent: #ffb65b; --hud-rgb: 255, 182, 91; --hud-frame: url('../assets/ui/hud-frame-orange.svg'); }

button.hud-button::before, button.hud-button::after {
  content: '';
  position: absolute;
  inset: 4px;
  z-index: -1;
  pointer-events: none;
  border-radius: 0;
  clip-path: polygon(var(--hud-cut) 0, 100% 0, 100% calc(100% - var(--hud-cut)), calc(100% - var(--hud-cut)) 100%, 0 100%, 0 var(--hud-cut));
}
button.hud-button::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(var(--hud-rgb), .045) 3px 4px),
    linear-gradient(180deg, rgba(var(--hud-rgb), .12), transparent 65%),
    #071622;
  background-size: 8px 100%, 100% 100%, auto;
  box-shadow: inset 0 0 18px rgba(var(--hud-rgb), .12);
  animation: hud-scan 28s linear infinite;
}
button.hud-button::after {
  background: linear-gradient(105deg, transparent 44%, rgba(var(--hud-rgb), .08) 48%, rgba(235,255,255,.65) 50%, rgba(var(--hud-rgb), .08) 52%, transparent 56%);
  background-size: 250% 100%;
  background-position: 100% 0;
  opacity: 0;
  animation: none;
}
@keyframes hud-scan { to { background-position: 8px 0, 0 0, 0 0; } }
@keyframes hud-sweep {
  0% { background-position: 100% 0; opacity: 0; }
  15%, 85% { opacity: .8; }
  100% { background-position: 0% 0; opacity: 0; }
}
@keyframes hud-confirm {
  0% { opacity: .5; }
  100% { opacity: 0; }
}
@media (hover: hover) and (pointer: fine) {
  button.hud-button:hover:not(:disabled):not([aria-disabled='true']):not(.is-wait) {
    background: transparent;
    transform: none;
    box-shadow: none;
    color: #fff;
    filter: brightness(1.18) drop-shadow(0 0 6px rgba(var(--hud-rgb), .55));
  }
  button.hud-button:hover:not(:disabled):not([aria-disabled='true']):not(.is-wait)::after {
    animation: hud-sweep .42s ease-out 1;
  }
}
button.hud-button:focus-visible {
  outline: none;
  filter: brightness(1.3) drop-shadow(0 0 8px rgba(var(--hud-rgb), .8));
}
/* A persistent inset highlight follows the cut corners, including during hover
   and reduced motion, without drawing a rectangle around the SVG frame. */
button.hud-button:focus-visible::before { background-color: #123044; }
button.hud-button:focus-visible::after { animation: hud-sweep .42s ease-out 1; }
button.hud-button:active:not(:disabled):not([aria-disabled='true']):not(.is-wait) {
  transform: translateY(2px);
  filter: brightness(1.2) drop-shadow(0 0 2px rgba(var(--hud-rgb), .5));
}
button.hud-button:active:not(:disabled):not([aria-disabled='true']):not(.is-wait)::before {
  box-shadow: inset 0 0 26px rgba(var(--hud-rgb), .4);
}
button.hud-button.hud-confirmed:not(:disabled):not([aria-disabled='true']):not(.is-wait)::after {
  background: radial-gradient(ellipse at center, rgba(var(--hud-rgb), .5), transparent 72%);
  background-size: 100% 100%;
  animation: hud-confirm .28s ease-out 1;
}
button.hud-button.hud-confirmed:not(:disabled):not([aria-disabled='true']):not(.is-wait) {
  filter: brightness(1.45) drop-shadow(0 0 9px rgba(var(--hud-rgb), .85));
}
button.hud-button.hud-pressed:not(:disabled):not([aria-disabled='true']):not(.is-wait) {
  transform: translateY(2px) scale(.97);
  filter: brightness(1.35) drop-shadow(0 0 7px rgba(var(--hud-rgb), .7));
}
button.hud-button:is(.hud-pressed, .hud-confirmed):not(:disabled):not([aria-disabled='true']):not(.is-wait)::before {
  background-color: #20516a;
}
/* Independent of outgoing panels, so a successful tap stays visible on navigation. */
.hud-tap-burst {
  position: fixed;
  z-index: 2147483647;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor, inset 0 0 8px currentColor;
  pointer-events: none;
  animation: hud-tap-burst .32s ease-out both;
}
@keyframes hud-tap-burst {
  from { transform: scale(.35); opacity: .95; }
  to { transform: scale(1.6); opacity: 0; }
}
button.hud-button:disabled, button.hud-button[aria-disabled='true'], button.hud-button.is-wait {
  color: #a0abb6;
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  filter: saturate(.25);
  text-shadow: none;
  animation: none;
}
button.hud-button:is(:disabled, [aria-disabled='true'], .is-wait)::before { animation: none; box-shadow: none; }
button.hud-button:is(:disabled, [aria-disabled='true'], .is-wait)::after { animation: none; opacity: 0; }

/* Content-first variants keep native markup and dynamic text updates intact. */
button.hud-button.mode-button { display: grid; gap: 3px; aspect-ratio: auto; min-height: 88px; }
button.hud-button.mode-button :is(small, em) { color: #b8d5da; opacity: 1; }
button.hud-button.hud-icon { width: 44px; height: 44px; min-width: 44px; aspect-ratio: 1; padding: 7px; font-size: 18px; }
button.hud-button.hud-compact { display: inline-flex; width: auto; min-width: 44px; min-height: 44px; aspect-ratio: auto; padding: 8px 13px; }
button.hud-button.hud-icon, button.hud-button.hud-compact { --hud-cut: 9px; border-image-width: 13px; }
button.hud-button.hud-card { display: flex; gap: 12px; aspect-ratio: auto; min-height: 82px; text-align: left; padding: 14px 20px; }
.hud-card .shop-card-copy { flex: 1; }
.hud-card .shop-price { max-width: 42%; flex-shrink: 1; color: var(--hud-accent); text-shadow: none; }
.hud-card .shop-grant { color: #bfd0d9; }
.hud-card .shop-badge { color: #e6c599; }
.hud-card .shop-price, .hud-card .shop-name, .hud-card .shop-grant { overflow-wrap: anywhere; }
.panel, .ad-modal { max-height: calc(100svh - 32px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.shop-panel { overflow: hidden; }
.shop-list { padding: 6px; }
.menu-inner { max-height: calc(100svh - 32px); overflow-y: auto; touch-action: pan-y; padding: 7px; }
/* Main actions: narrower glass panels, with space below the logo. */
#screen-menu .title-wrap { margin-bottom: clamp(28px, 5svh, 48px); }
#screen-menu .menu-inner > button.hud-button {
  width: 78%; max-width: 320px; min-height: 52px; margin-inline: auto;
}
#screen-menu .menu-inner > button.hud-button::before { background-color: rgba(7, 22, 34, .32); }
#screen-menu .menu-inner > button.hud-button:focus-visible::before { background-color: rgba(18, 48, 68, .7); }
#screen-menu .menu-inner > button.hud-button:is(.hud-pressed, .hud-confirmed)::before { background-color: rgba(32, 81, 106, .72); }
@media (max-height: 500px) {
  #screen-menu .title-wrap { margin-bottom: 24px; }
}
@media (max-width: 380px) {
  button.hud-button { font-size: 14px; padding-inline: 18px; letter-spacing: .025em; }
  button.hud-button.hud-icon { padding: 6px; font-size: 18px; }
  button.hud-button.hud-compact { padding: 7px 10px; }
  button.hud-button.hud-card { gap: 8px; padding: 13px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  button.hud-button { transition: none; }
  button.hud-button::before, button.hud-button::after { animation: none !important; }
  button.hud-button::after { display: none; }
  button.hud-button:active:not(:disabled):not([aria-disabled='true']):not(.is-wait) { transform: none; }
  button.hud-button.hud-pressed:not(:disabled):not([aria-disabled='true']):not(.is-wait) { transform: none; }
  .hud-tap-burst { display: none; animation: none; }
}
@media (forced-colors: active) {
  button.hud-button { border: 2px solid ButtonText; border-image: none; color: ButtonText; filter: none; }
  button.hud-button:focus-visible { outline: 2px solid Highlight; outline-offset: 3px; filter: none !important; }
  button.hud-button::before, button.hud-button::after { display: none; }
  button.hud-button:disabled { color: GrayText; border-color: GrayText; }
}
