.al-shell {
  --al-tar: #3c424a;
  --al-kerb: #b03a30;
  --al-teal: #2fd0be;
  --al-amber2: #f2b632;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.cg-shell-game .cg-stage-main #game-root > .al-shell {
  max-width: min(100%, 900px) !important;
}

.al-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.al-statline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.al-stat {
  min-width: 0;
  padding: 6px 11px;
  border: 1px solid var(--cg-line);
  border-radius: 9px;
  background: var(--cg-panel);
  box-shadow: 0 4px 12px rgba(33, 43, 40, 0.06);
}

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

.al-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--cg-ink);
  font-size: 15px;
  line-height: 1.1;
  white-space: nowrap;
}

.al-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.al-btn,
.al-close {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(33, 43, 40, 0.07);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.al-btn:hover,
.al-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(33, 43, 40, 0.13);
}

.al-btn:active,
.al-close:active {
  transform: translateY(0);
}

.al-btn:focus-visible,
.al-close:focus-visible,
.al-canvas:focus-visible,
.al-seg:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.4);
  outline-offset: 2px;
}

.al-icon {
  display: grid;
  place-items: center;
  padding: 0;
}

.al-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--cg-ink);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.al-icon svg path:first-child {
  fill: var(--cg-ink);
  stroke: none;
}

.al-icon[aria-pressed="true"] svg {
  stroke: var(--cg-red);
}

.al-icon[aria-pressed="true"] svg path:first-child {
  fill: var(--cg-red);
  stroke: none;
}

.al-primary {
  border-color: transparent;
  background: var(--cg-teal);
  color: #fff;
  box-shadow: 0 8px 20px rgba(18, 122, 137, 0.3);
}

.al-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: flex;
  gap: 5px;
  pointer-events: none;
}

.al-chip {
  min-width: 0;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(12, 22, 18, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(4px);
}

.al-chip span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}

.al-chip strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.al-chip-pos strong {
  color: var(--al-amber2);
}

.al-delta {
  position: absolute;
  top: 46px;
  left: 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(12, 22, 18, 0.8);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.al-gauge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  width: min(38%, 200px);
  height: 10px;
  border-radius: 6px;
  background: rgba(12, 22, 18, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  pointer-events: none;
}

.al-gauge-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f2b632, #e0503a);
}

.al-gauge-fill.al-boost {
  background: linear-gradient(90deg, #2fd0be, #b6fff5);
}

.al-gauge-drift {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: #fff;
}

.al-gauge-drift.al-ready {
  background: var(--al-teal);
}

.al-stage {
  position: relative;
  width: min(100%, 720px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: #2b5534;
  box-shadow: var(--cg-shadow);
  touch-action: none;
}

.al-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 230px);
  min-height: 300px;
  cursor: crosshair;
  touch-action: none;
}

.al-overlay {
  position: absolute;
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(88%, 330px);
  padding: 16px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--cg-ink);
  text-align: center;
  box-shadow: var(--cg-shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.al-start {
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  animation: al-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.al-overlay strong {
  font-size: 22px;
  line-height: 1.1;
}

.al-overlay span {
  margin: 0;
  color: var(--cg-muted);
  font-size: 13px;
  line-height: 1.4;
}

.al-result {
  top: 50%;
  transform: translate(-50%, -50%);
  animation: al-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes al-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.al-win {
  box-shadow: 0 0 0 3px #f2b632, 0 0 40px rgba(242, 182, 50, 0.6);
}

.al-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.al-result-grid > div {
  min-width: 0;
  padding: 6px 3px;
  border: 1px solid var(--cg-line);
  border-radius: 7px;
  background: rgba(246, 247, 242, 0.92);
}

.al-result-grid span {
  display: block;
  color: var(--cg-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.al-result-grid strong {
  display: block;
  margin-top: 1px;
  font-size: 15px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.al-result-actions {
  display: flex;
  gap: 8px;
}

.al-result-actions .al-btn {
  flex: 1 1 0;
  padding: 0 8px;
}

.al-pad {
  display: none;
}

.al-modes {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(100%, 720px);
  margin: 10px auto 0;
}

.al-seg {
  min-height: 44px;
  min-width: 44px;
  flex: 0 1 auto;
  padding: 0 16px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  color: var(--cg-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  transition: background 120ms ease, color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.al-seg:hover {
  background: #eef4f2;
  color: var(--cg-ink);
}

.al-seg[aria-pressed="true"] {
  border-color: transparent;
  background: var(--cg-teal);
  color: #fff;
}

.al-note {
  width: min(100%, 720px);
  margin: 10px auto 0;
  color: var(--cg-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.al-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 37, 40, 0.32);
}

.al-modal-card {
  position: relative;
  width: min(100%, 440px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 70px rgba(30, 37, 40, 0.22);
}

.al-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.al-modal-card p {
  margin: 10px 0 0;
  color: var(--cg-muted);
  line-height: 1.45;
}

.al-modal-card p:last-child {
  margin-bottom: 0;
}

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

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

@media (max-width: 560px) {
  .al-shell {
    padding: 0 8px 14px;
  }

  .al-topbar {
    gap: 8px;
    margin-bottom: 6px;
  }

  .al-statline .al-stat:nth-child(1),
  .al-statline .al-stat:nth-child(3),
  .al-actions #al-share {
    display: none;
  }

  .al-stage {
    width: 100%;
  }

  .al-canvas {
    aspect-ratio: 1 / 1.05;
    max-height: none;
    min-height: 0;
  }

  .al-chip {
    padding: 4px 7px;
  }

  .al-chip strong {
    font-size: 15px;
  }

  .al-chip-x {
    display: none;
  }

  .al-overlay {
    width: min(92%, 320px);
    padding: 13px;
  }

  .al-overlay strong {
    font-size: 19px;
  }

  .al-overlay span {
    font-size: 12px;
  }

  .al-modes .al-seg {
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 13px;
  }

  .al-note {
    display: none;
  }
}

@media (pointer: coarse) {
  .al-pad {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    width: min(100%, 720px);
    margin: 10px auto 0;
  }

  .al-pad-set {
    display: flex;
    gap: 8px;
  }

  .al-key {
    box-sizing: border-box;
    min-width: 58px;
    min-height: 58px;
    padding: 0 12px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(33, 43, 40, 0.1);
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .al-key:active,
  .al-key[aria-pressed="true"] {
    transform: translateY(1px);
    border-color: transparent;
    background: var(--cg-teal);
    color: #fff;
  }

  .al-key:focus-visible {
    outline: 3px solid rgba(49, 95, 157, 0.45);
    outline-offset: 2px;
  }

  .al-gas {
    min-width: 74px;
    background: var(--al-amber2);
    color: #2b2200;
  }

  .al-gas:active,
  .al-gas[aria-pressed="true"] {
    background: var(--al-amber2);
    color: #2b2200;
  }
}
