.as-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 14px 22px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.as-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.as-stats,
.as-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.as-stat {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  text-align: center;
}

.as-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.as-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  line-height: 1.05;
  white-space: nowrap;
}

.as-btn,
.as-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  transition: transform 120ms ease, border-color 120ms ease;
}

.as-btn:hover,
.as-close:hover {
  transform: translateY(-1px);
  border-color: var(--cg-teal);
}

.as-btn:focus-visible,
.as-close:focus-visible,
.as-canvas:focus-visible {
  outline: 3px solid rgba(122, 200, 255, 0.6);
  outline-offset: 3px;
}

.as-icon {
  display: inline-grid;
  padding: 0;
  place-items: center;
  font-size: 19px;
}

.as-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.as-primary {
  border-color: transparent;
  background: var(--cg-teal);
  color: #fff;
}

.as-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid #16283f;
  border-radius: 14px;
  background: #050b16;
  box-shadow: var(--cg-shadow);
  touch-action: none;
  user-select: none;
}

.as-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: min(70vh, 620px);
  cursor: crosshair;
}

.as-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 6px;
  width: min(88%, 420px);
  padding: 16px 18px;
  border: 1px solid rgba(138, 215, 255, 0.35);
  border-radius: 12px;
  background: rgba(6, 16, 30, 0.72);
  color: #dff1ff;
  text-align: center;
  box-shadow: 0 0 40px rgba(20, 90, 140, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.as-banner strong {
  font-size: 26px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.as-banner span {
  color: #9dc4dd;
  font-size: 13.5px;
  line-height: 1.35;
}

.as-result {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  gap: 8px;
  width: min(86%, 330px);
  padding: 20px;
  border: 1px solid var(--cg-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  text-align: center;
  box-shadow: 0 26px 70px rgba(4, 12, 24, 0.6);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
}

.as-result span,
.as-result p {
  margin: 0;
  color: var(--cg-muted);
  font-size: 13.5px;
  line-height: 1.35;
}

.as-result strong {
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.as-result-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.as-result-row .as-btn {
  flex: 1 1 0;
}

.as-pad {
  display: none;
}

@media (pointer: coarse) {
  .as-pad {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 10px;
  }

  .as-key {
    min-height: 58px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
    touch-action: none;
  }

  .as-key:active {
    background: var(--cg-ink);
    color: #fff;
  }

  .as-key-fire {
    font-size: 16px;
    letter-spacing: 0.1em;
    grid-column: span 2;
    border-color: transparent;
    background: var(--cg-teal);
    color: #fff;
  }
}

.as-legend {
  margin: 10px 0 0;
  color: var(--cg-muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.as-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 11, 22, 0.5);
}

.as-modal-card {
  position: relative;
  width: min(100%, 460px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 14px;
  background: var(--cg-panel);
  box-shadow: 0 26px 76px rgba(30, 37, 40, 0.28);
}

.as-modal-card h2 {
  margin: 0 48px 10px 0;
  font-size: 23px;
  line-height: 1.1;
}

.as-modal-card p {
  margin: 9px 0 0;
  color: var(--cg-muted);
  font-size: 14px;
  line-height: 1.5;
}

.as-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.as-hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .as-shell {
    padding: 0 8px 18px;
  }

  .as-top {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .as-stats {
    justify-content: space-between;
    gap: 6px;
  }

  .as-stat {
    min-width: 0;
    flex: 1 1 0;
    padding: 6px 4px;
  }

  .as-stat strong {
    font-size: 15px;
  }

  .as-actions {
    justify-content: center;
  }

  .as-canvas {
    aspect-ratio: 3 / 4;
    max-height: 62vh;
  }

  .as-banner strong {
    font-size: 21px;
  }
}
