:root {
  --ag-bg: #050505;
  --ag-bg-2: #0c0c0c;
  --ag-text: #f7f7f7;
  --ag-muted: rgba(255, 255, 255, 0.62);
  --ag-panel: rgba(255, 255, 255, 0.06);
  --ag-stroke: rgba(255, 255, 255, 0.09);
  --ag-stroke-strong: rgba(255, 255, 255, 0.16);
  --ag-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --ag-safe-top: max(env(safe-area-inset-top), 12px);
  --ag-safe-bottom: max(env(safe-area-inset-bottom), 12px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(180deg, #151515 0%, #0b0b0b 34%, #040404 100%);
  color: var(--ag-text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  -webkit-tap-highlight-color: transparent;
}

.ag-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ag-text);
  background: transparent;
}

.ag-topbar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: var(--ag-safe-top);
  pointer-events: none;
}

.ag-logo-button {
  pointer-events: auto;
  width: min(180px, 52vw);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
}

.ag-logo-button img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(0 8px 24px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.08));
}

.ag-logo-fallback {
  display: inline-block;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-transform: uppercase;
}

.ag-frame {
  position: relative;
  min-height: 100vh;
  padding:
    calc(var(--ag-safe-top) + 82px)
    12px
    calc(var(--ag-safe-bottom) + 94px);
}

.ag-stage-wrap {
  position: relative;
  min-height: calc(100vh - var(--ag-safe-top) - var(--ag-safe-bottom) - 176px);
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    linear-gradient(180deg, #181818 0%, #0d0d0d 48%, #080808 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.03),
    0 24px 80px rgba(0, 0, 0, 0.45);
}

.ag-stage-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 18%);
}

.ag-stage-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.04) 50%, rgba(255, 255, 255, 0.02) 100%);
  transform: perspective(900px) rotateX(72deg) scale(1.35);
  transform-origin: bottom center;
  opacity: 0.55;
}

.ag-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.ag-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}

.ag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.84;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}

.ag-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  touch-action: pan-y;
}

.ag-stage[aria-busy='true']::before,
.ag-stage.ag-empty::before {
  content: attr(data-empty-label);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(260px, 76vw);
  text-align: center;
  color: rgba(255, 255, 255, 0.54);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  z-index: 2;
}

.ag-card {
  position: absolute;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.34);
  transform-origin: center center;
  transition:
    transform 0.48s cubic-bezier(0.2, 0.82, 0.2, 1),
    opacity 0.28s ease,
    left 0.48s cubic-bezier(0.2, 0.82, 0.2, 1),
    top 0.48s cubic-bezier(0.2, 0.82, 0.2, 1),
    width 0.48s cubic-bezier(0.2, 0.82, 0.2, 1),
    height 0.48s cubic-bezier(0.2, 0.82, 0.2, 1),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  user-select: none;
  pointer-events: auto;
  cursor: pointer;
}

.ag-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 26%),
    linear-gradient(180deg, transparent 70%, rgba(0, 0, 0, 0.18) 100%);
}

.ag-card.ag-active {
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 22px 54px rgba(0, 0, 0, 0.40),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

.ag-card img,
.ag-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #101010;
}

.ag-caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.40);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ag-caption span:last-child {
  color: rgba(255, 255, 255, 0.62);
}

.ag-bottom {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--ag-safe-bottom) + 10px);
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  box-shadow: var(--ag-shadow);
}

.ag-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ag-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.44);
}

.ag-meta-value {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ag-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ag-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ag-btn:active {
  transform: translateY(1px);
}

.ag-btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.ag-footer-note {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ag-safe-bottom) + 72px);
  transform: translateX(-50%);
  z-index: 38;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.ag-shell.theme-black .ag-stage-wrap {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    linear-gradient(180deg, #101010 0%, #090909 46%, #050505 100%);
  filter: contrast(1.04);
}

.ag-shell.theme-gloss .ag-stage-wrap::after {
  opacity: 0.75;
}

.ag-shell.theme-gloss .ag-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 20px 50px rgba(0, 0, 0, 0.38),
    0 0 30px rgba(255, 255, 255, 0.03);
}

.ag-shell.theme-minimal .ag-caption {
  display: none;
}

.ag-shell.theme-minimal .ag-bottom,
.ag-shell.theme-minimal .ag-footer-note {
  background: rgba(0, 0, 0, 0.28);
}

@media (min-width: 700px) {
  .ag-frame {
    padding:
      calc(var(--ag-safe-top) + 92px)
      20px
      calc(var(--ag-safe-bottom) + 104px);
  }

  .ag-bottom {
    left: 20px;
    right: 20px;
  }

  .ag-logo-button {
    width: 170px;
  }
}
