:root {
  --ag-bg: #f9f9fc;
  --ag-bg-result: #f5f4fb;
  --ag-card: #ffffff;
  --ag-ink: #14151a;
  --ag-ink-2: #3a3d4a;
  --ag-muted: #6e7385;
  --ag-border: #e8eaf2;
  --ag-border-strong: #d7dbe8;
  --ag-purple: #6d5ef6;
  --ag-purple-2: #8b7cf8;
  --ag-purple-soft: #eeecff;
  --ag-purple-hl: #ded8ff;
  --ag-green: #189a59;
  --ag-green-soft: #e6f7ee;
  --ag-red: #e5484d;
  --ag-red-soft: #fdebec;
  --ag-btn: #18191f;
  --ag-btn-hover: #2a2c36;
  --ag-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --ag-sans: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ag-mono: "SF Mono", "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--ag-bg);
  color: var(--ag-ink);
  font-family: var(--ag-sans);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ag-app {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
  background: radial-gradient(ellipse at 78% 8%, rgba(224, 221, 255, 0.35) 0%, transparent 52%), var(--ag-bg);
  transition: background-color 0.25s ease;
}

.ag-app[data-view="result"] {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(215, 208, 255, 0.42) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(232, 224, 255, 0.38) 0%, transparent 50%),
    var(--ag-bg-result);
}

/* Decorative 3D crystal ribbons */
.ag-ribbon {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease;
}
.ag-ribbon--tr {
  top: 0;
  right: 0;
  width: min(44vw, 560px);
}
.ag-ribbon--bl {
  bottom: 0;
  left: 0;
  width: min(30vw, 380px);
}
.ag-ribbon svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 36px rgba(120, 128, 175, 0.12));
}
.ag-app[data-view="result"] .ag-ribbon {
  opacity: 0.32;
}

.ag-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== TOP BAR ==================== */
.ag-topbar {
  height: 64px;
  padding: 0 clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--ag-border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.ag-nav-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-left: -10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ag-ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.ag-nav-back:hover {
  background: rgba(20, 21, 26, 0.05);
  color: var(--ag-ink);
}

.ag-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ag-ink);
}
.ag-cube {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.ag-unlock-status {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ag-ink-2);
  font-weight: 500;
}
.ag-unlock-status svg {
  width: 16px;
  height: 16px;
  color: var(--ag-muted);
}

/* ==================== VIEW 1: LOBBY ==================== */
.ag-lobby-main {
  flex: 1;
  width: min(1200px, calc(100% - clamp(32px, 6vw, 96px)));
  margin: 0 auto;
  padding: clamp(36px, 5.5vh, 68px) 0 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(32px, 4.5vh, 48px);
}

.ag-kicker {
  margin: 0 0 14px;
  font-family: var(--ag-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: var(--ag-muted);
  text-transform: uppercase;
}

.ag-slash {
  color: var(--ag-purple);
  font-weight: 800;
  margin-right: 6px;
}

.ag-hero-title {
  margin: 0 0 18px;
  font-family: var(--ag-serif);
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ag-ink);
}

.ag-hl {
  background: linear-gradient(180deg, transparent 18%, var(--ag-purple-hl) 18%, var(--ag-purple-hl) 88%, transparent 88%);
  color: inherit;
  padding: 0 6px;
  border-radius: 4px;
}

.ag-hero-sub {
  margin: 0 0 34px;
  font-size: clamp(14.5px, 1.3vw, 17px);
  color: var(--ag-ink-2);
  line-height: 1.65;
}

.ag-metrics {
  display: inline-flex;
  align-items: center;
  gap: clamp(28px, 4.5vw, 68px);
  flex-wrap: wrap;
}

.ag-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ag-metric strong {
  font-family: var(--ag-serif);
  font-size: clamp(34px, 3.4vw, 46px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ag-ink);
}
.ag-metric span {
  font-size: 13.5px;
  color: var(--ag-muted);
}

.ag-metric-divider {
  width: 1px;
  height: 46px;
  background: var(--ag-border-strong);
}

.ag-section-label {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ag-ink);
  display: flex;
  align-items: center;
}

.ag-roster-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.ag-model-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--ag-border);
  border-radius: 14px;
  padding: 20px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(20, 22, 40, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ag-model-card:hover {
  transform: translateY(-2px);
  border-color: #cbcfe4;
  box-shadow: 0 10px 24px rgba(20, 22, 40, 0.06);
}
.ag-model-card__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ag-model-card__icon svg {
  width: 28px;
  height: 28px;
}
.ag-model-card__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ag-ink);
}
.ag-model-card__harness {
  font-size: 11.5px;
  color: var(--ag-muted);
  margin-top: -4px;
}

.ag-lobby-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.ag-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  background: var(--ag-btn);
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(24, 25, 31, 0.16);
  transition: background-color 0.18s ease, transform 0.16s ease, opacity 0.18s ease;
}
.ag-btn-primary:hover:not(:disabled) {
  background: var(--ag-btn-hover);
  transform: translateY(-1px);
}
.ag-btn-primary:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  box-shadow: none;
}
.ag-btn-primary--lg {
  min-width: min(360px, 88vw);
  padding: 17px 38px;
  font-size: 17px;
}
.ag-btn-primary--block {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
}

.ag-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1.5px solid var(--ag-ink);
  background: #ffffff;
  color: var(--ag-ink);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.16s ease, transform 0.16s ease;
}
.ag-btn-outline:hover {
  background: #f3f4f9;
  transform: translateY(-1px);
}

.ag-history-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ag-muted);
}
.ag-history-line svg {
  width: 15px;
  height: 15px;
}

/* ==================== VIEW 2: PLAY ARENA ==================== */
.ag-play-subbar {
  width: min(1360px, calc(100% - clamp(28px, 4vw, 64px)));
  margin: 18px auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ag-progress-group {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ag-progress-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--ag-ink);
}
.ag-progress-text strong {
  color: var(--ag-purple);
  font-size: 22px;
  margin: 0 2px;
}

.ag-step-boxes {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ag-step-box {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #eaecf4;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
}
.ag-step-box.is-done {
  background: var(--ag-purple-2);
}
.ag-step-box.is-current {
  background: #ffffff;
  border-color: var(--ag-purple);
  box-shadow: 0 0 0 3px rgba(109, 94, 246, 0.14);
}

.ag-stage-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ag-tool-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ag-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.ag-tool-link:hover {
  background: rgba(20, 21, 26, 0.05);
  color: var(--ag-ink);
}
.ag-tool-link svg {
  width: 16px;
  height: 16px;
}
.ag-tool-sep {
  width: 1px;
  height: 16px;
  background: var(--ag-border-strong);
}

.ag-play-grid {
  flex: 1;
  width: min(1360px, calc(100% - clamp(28px, 4vw, 64px)));
  margin: 0 auto 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(320px, 0.95fr);
  gap: 28px;
  align-items: stretch;
}

.ag-stage-outer {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ag-border);
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(20, 24, 48, 0.06);
  display: flex;
  min-height: clamp(480px, calc(100vh - 190px), 760px);
}
.ag-stage-inner {
  position: relative;
  flex: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #0e1017;
  border: 1px solid rgba(20, 21, 26, 0.08);
}
.ag-stage-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: #11131a center / contain no-repeat;
  color: #fff;
  font-size: 14px;
  z-index: 2;
}
.ag-stage-loading span {
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(20, 21, 26, 0.88);
}
.ag-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #ffffff;
}

.ag-vote-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0;
}
.ag-vote-title {
  margin: 0;
  font-family: var(--ag-serif);
  font-size: clamp(24px, 2.2vw, 31px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ag-ink);
}

.ag-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ag-option-row {
  width: 100%;
  padding: 12px 16px;
  border-radius: 13px;
  border: 1px solid var(--ag-border);
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.ag-option-row:hover {
  border-color: #c8cde2;
  background: #ffffff;
}
.ag-option-row.is-selected {
  background: var(--ag-purple-soft);
  border-color: #c7bfff;
  box-shadow: 0 4px 14px rgba(109, 94, 246, 0.10);
}

.ag-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.8px solid #c2c6d6;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ag-option-row.is-selected .ag-radio-dot {
  border-color: var(--ag-purple);
  background: var(--ag-purple);
}
.ag-option-row.is-selected .ag-radio-dot::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}

.ag-option-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ag-option-icon svg {
  width: 20px;
  height: 20px;
}

.ag-option-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ag-ink);
}
.ag-option-harness {
  font-size: 13px;
  font-weight: 400;
  color: var(--ag-muted);
  margin-left: 4px;
}

/* ==================== VIEW 3: SETTLEMENT & ROAST ==================== */
.ag-result-shell {
  width: min(1280px, calc(100% - clamp(24px, 4vw, 64px)));
  margin: 0 auto;
  padding: 14px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.ag-result-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ag-result-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ag-pill-back {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--ag-border);
  background: #ffffff;
  color: var(--ag-ink);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(20, 22, 40, 0.04);
}
.ag-pill-back:hover {
  background: #f5f6fb;
}
.ag-result-crumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ag-ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
}
.ag-result-crumb .ag-cube {
  color: var(--ag-purple);
}
.ag-result-cum {
  font-size: 13px;
  color: var(--ag-muted);
  font-weight: 500;
}

/* Hero Row */
.ag-result-hero {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 230px;
  align-items: center;
  gap: 24px;
  padding: 8px 8px 4px;
}

.ag-score-label {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ag-ink-2);
}
.ag-score-pct {
  font-size: clamp(58px, 6vw, 82px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--ag-ink);
}
.ag-score-count {
  margin: 8px 0 12px;
  font-size: 15px;
  color: var(--ag-muted);
  font-weight: 500;
}
.ag-score-count strong {
  color: var(--ag-ink);
}
.ag-score-bar {
  width: 210px;
  height: 10px;
  border-radius: 999px;
  background: #e3e0f7;
  overflow: hidden;
  margin-bottom: 14px;
}
.ag-score-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c66f5, #9f8df9);
  transition: width 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.ag-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #ebe7ff;
  color: #4a3bc2;
  font-size: 13px;
  font-weight: 700;
}

/* Speech Bubble Taunts */
.ag-taunt-bubbles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
.ag-bubble-item {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: agBubblePop 0.45s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}
.ag-bubble-item:nth-child(2) {
  margin-left: 18px;
  animation-delay: 0.12s;
}
.ag-bubble-avatar {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 14px rgba(25, 22, 56, 0.12));
}
.ag-bubble-avatar.is-card {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 18px rgba(25, 22, 56, 0.14);
  filter: none;
}
.ag-bubble-box {
  position: relative;
  background: #ffffff;
  border: 1px solid #eceaf8;
  border-radius: 18px;
  padding: 13px 22px;
  box-shadow: 0 10px 26px rgba(45, 38, 94, 0.06);
  font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 700;
  color: var(--ag-ink);
  transform: rotate(-1deg);
}
.ag-bubble-combo {
  position: absolute;
  right: -14px;
  bottom: -10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b75ff, #6d5ef6);
  color: #ffffff;
  font-family: var(--ag-mono);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(109, 94, 246, 0.3);
}

.ag-hero-mascot {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ag-hero-mascot img {
  width: 170px;
  height: 170px;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(34, 28, 72, 0.16));
  animation: agMascotFloat 2.8s ease-in-out infinite;
}
.ag-hero-mascot img.is-meme-card {
  width: 162px;
  height: 162px;
  object-fit: cover;
  border-radius: 24px;
  border: 4px solid #ffffff;
  box-shadow: 0 14px 30px rgba(34, 28, 72, 0.18);
  animation: agStifleShake 0.45s ease-in-out infinite alternate;
}

/* Middle Bento */
.ag-result-bento {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.ag-roast-card,
.ag-review-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #eae8f6;
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(32, 28, 76, 0.05);
}

.ag-roast-card {
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.ag-roast-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.ag-roast-badge {
  font-size: 15px;
  font-weight: 700;
  color: #493cc4;
}
.ag-reroll-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2dff5;
  background: #f7f6ff;
  color: #5b4dd6;
  font-size: 12px;
  font-weight: 600;
}
.ag-reroll-btn:hover {
  background: #ece9ff;
}

.ag-roast-quote {
  margin: 0 0 12px;
  font-family: var(--ag-serif);
  font-size: clamp(22px, 1.9vw, 27px);
  font-weight: 800;
  line-height: 1.34;
  color: var(--ag-ink);
}
.ag-roast-sub {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ag-muted);
}

.ag-roast-sticker-wrap {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding-top: 8px;
}
.ag-roast-sticker-wrap img.is-sticker {
  width: 148px;
  height: 148px;
  object-fit: contain;
  transform: translateY(10px);
}
.ag-putongren-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 18px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #f6f4ff;
  border: 1px dashed #c8bfff;
}
.ag-putongren-card img {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  animation: agStifleShake 0.4s ease-in-out infinite alternate;
}
.ag-putongren-card div {
  font-size: 12.5px;
  line-height: 1.45;
  color: #463c94;
  font-weight: 600;
}

/* Review Table */
.ag-review-card {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
}
.ag-review-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ag-review-card__head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ag-review-card__head h3 span {
  color: var(--ag-purple);
}
.ag-review-tally {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ag-ink-2);
}
.ag-review-tally .ok { color: var(--ag-green); }
.ag-review-tally .miss { color: var(--ag-red); }

.ag-review-table-wrap {
  overflow-x: auto;
}
.ag-review-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
.ag-review-table th {
  padding: 10px 12px;
  background: #f6f6fb;
  color: var(--ag-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}
.ag-review-table th:first-child { border-radius: 10px 0 0 10px; width: 42px; }
.ag-review-table th:last-child { border-radius: 0 10px 10px 0; width: 96px; }

.ag-review-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f0f1f7;
  vertical-align: middle;
  font-size: 13.5px;
}
.ag-review-table tr:last-child td {
  border-bottom: none;
}

.ag-row-num {
  font-family: var(--ag-mono);
  font-weight: 700;
  color: var(--ag-ink-2);
}

.ag-preview-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 4px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  color: var(--ag-ink);
  transition: background-color 0.15s ease;
}
.ag-preview-btn:hover {
  background: #f3f2fc;
}
.ag-preview-thumb {
  width: 66px;
  height: 42px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--ag-border);
  background: #14151a;
  flex-shrink: 0;
}
.ag-preview-title {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.35;
}
.ag-preview-sub {
  display: block;
  font-size: 11.5px;
  color: var(--ag-purple);
  font-weight: 500;
}

.ag-model-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: #f1f0fb;
  color: #383552;
  white-space: nowrap;
}
.ag-model-pill--hit {
  background: var(--ag-green-soft);
  color: var(--ag-green);
}
.ag-model-pill--miss {
  background: var(--ag-red-soft);
  color: #c93338;
}

.ag-verdict-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ag-verdict-mark {
  font-size: 17px;
  font-weight: 900;
}
.ag-verdict-mark.is-hit { color: var(--ag-green); }
.ag-verdict-mark.is-miss { color: var(--ag-red); }
.ag-verdict-emote {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

/* Bottom Counter-Attack Bar */
.ag-counter-bar {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #eae8f6;
  border-radius: 22px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 10px 28px rgba(32, 28, 76, 0.05);
}

.ag-counter-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.ag-counter-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ag-counter-copy strong {
  font-size: 15px;
  color: var(--ag-ink);
}
.ag-counter-copy span {
  font-size: 12.5px;
  color: var(--ag-muted);
}

.ag-emote-deck {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ag-emote-btn {
  width: 72px;
  padding: 6px 6px 5px;
  border-radius: 14px;
  border: 1px solid #e9e7f5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 3px 10px rgba(32, 28, 76, 0.04);
  transition: transform 0.12s cubic-bezier(0.2, 1.4, 0.4, 1), border-color 0.15s ease;
}
.ag-emote-btn:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--ag-purple-2);
}
.ag-emote-btn:active {
  transform: scale(0.93);
}
.ag-emote-btn img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.ag-emote-btn--meme img {
  object-fit: cover;
  border-radius: 8px;
}
.ag-emote-btn span {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ag-ink-2);
}

.ag-counter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* ==================== FULLSCREEN MODAL & FX ==================== */
.ag-fs-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #090b10;
  display: flex;
  flex-direction: column;
}
.ag-fs-bar {
  height: 50px;
  padding: 0 20px;
  background: rgba(16, 18, 26, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f3f5fa;
}
.ag-fs-title {
  font-size: 14px;
  font-weight: 600;
}
.ag-fs-close {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}
.ag-fs-close:hover {
  background: rgba(255, 255, 255, 0.18);
}
.ag-fs-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #ffffff;
}

.ag-fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9500;
  overflow: hidden;
}
.ag-flying-emote {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid #d5ceff;
  box-shadow: 0 12px 28px rgba(45, 36, 108, 0.18);
  font-size: 14px;
  font-weight: 800;
  color: var(--ag-ink);
  animation: agFlyUp 1.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.ag-flying-emote img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}

.ag-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9800;
  padding: 12px 22px;
  border-radius: 999px;
  background: #18191f;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

@keyframes agBubblePop {
  0% { opacity: 0; transform: scale(0.82) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes agMascotFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}
@keyframes agStifleShake {
  0% { transform: rotate(-1.5deg) translateY(0); }
  100% { transform: rotate(1.5deg) translateY(-2px); }
}
@keyframes agFlyUp {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -12px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -135px) scale(0.96); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1080px) {
  .ag-roster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .ag-play-grid {
    grid-template-columns: 1fr;
  }
  .ag-stage-outer {
    min-height: 420px;
  }
  .ag-result-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ag-hero-mascot {
    display: none;
  }
  .ag-result-bento {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ag-topbar {
    grid-template-columns: auto 1fr;
    gap: 8px;
  }
  .ag-unlock-status {
    display: none;
  }
  .ag-roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ag-bubble-avatar {
    width: 56px;
    height: 56px;
  }
  .ag-counter-actions {
    width: 100%;
    justify-content: stretch;
  }
  .ag-counter-actions button {
    flex: 1;
  }
}
