
.amg {
  position: relative; display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 16px; border-radius: 28px; text-align: left; color: #f5f5f7;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 28px 80px rgba(0, 0, 0, 0.5);
}
.amg button { font: inherit; color: inherit; }
.amg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.amg-headtext { min-width: 0; }
.amg-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--am-ink3, rgba(245, 245, 247, 0.5)); }
.amg-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--am-go, #0a84ff); animation: amg-dot 1.6s infinite ease-out; }
@keyframes amg-dot { 0% { box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.55); } 100% { box-shadow: 0 0 0 10px rgba(10, 132, 255, 0); } }
.amg-h2 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.amg-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--am-ink2, rgba(245, 245, 247, 0.72)); }
.amg .amg-sound { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px 0 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--am-ink2, rgba(245, 245, 247, 0.72)); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.amg .amg-sound:hover { background: rgba(255, 255, 255, 0.13); }
.amg .amg-sound[aria-pressed="true"] { background: rgba(10, 132, 255, 0.24); color: #fff; }
.amg-sound svg { display: block; flex: none; }
.amg-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.amg .amg-theme { position: relative; flex: none; display: inline-flex; align-items: center; padding: 3px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--am-ink3, rgba(245, 245, 247, 0.5)); cursor: pointer; }
.amg-theme i { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; transition: color 0.2s; }
.amg-theme svg { display: block; }
.amg-theme::before { content: ""; position: absolute; left: 3px; top: 3px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.2, 1), background 0.22s; }
.amg-theme[aria-checked="true"]::before { transform: translateX(28px); background: #fff; }
.amg-theme[aria-checked="false"] i:first-child { color: #fff; }
.amg-theme[aria-checked="true"] i:last-child { color: #c27c00; }
.amg-theme:hover { background: rgba(255, 255, 255, 0.13); }


.amg-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.amg-tile {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px 8px 12px; border: 0; border-radius: 22px; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); transition: background 0.15s, transform 0.15s;
}
.amg-tile:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-2px); }
.amg-tile:active { transform: scale(0.98); }
.amg-thumb { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 16px; background: #0b0d18; }
.amg-name { padding: 0 4px; font-size: 15px; font-weight: 650; line-height: 1.2; }
.amg-best { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 4px; font-size: 12.5px; line-height: 1.2; color: var(--am-ink3, rgba(245, 245, 247, 0.5)); }
.amg-best span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amg-medal { width: 9px; height: 9px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.amg-medal.is-0 { background: #d58b52; }
.amg-medal.is-1 { background: #d9dee8; }
.amg-medal.is-2 { background: #ffd60a; }
.amg-medal.is-3 { background: #a8ecff; }
.amg-foot { margin: 0; font-size: 12.5px; color: var(--am-ink3, rgba(245, 245, 247, 0.5)); text-align: center; }
.amg.is-many .amg-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }


.amg-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.amg-back { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); cursor: pointer; }
.amg-back:hover { background: rgba(255, 255, 255, 0.14); }
.amg-back svg { display: block; }
.amg-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amg-rec { flex: none; font-size: 13px; color: var(--am-ink2, rgba(245, 245, 247, 0.72)); white-space: nowrap; }
.amg-rec:empty { display: none; }
.amg-stage { width: min(100%, 400px); width: min(100%, 400px, calc((100vh - 150px) * 2 / 3)); width: min(100%, 400px, calc((100dvh - 150px) * 2 / 3)); margin: 0 auto; }
.amg-canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 22px; background: #07080e; cursor: pointer; outline: none;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.amg-canvas:focus-visible { box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.45); }
.amg-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.amg-sound:focus-visible, .amg-tile:focus-visible, .amg-back:focus-visible, .amg-theme:focus-visible { outline: 3px solid rgba(10, 132, 255, 0.6); outline-offset: 2px; }


.amg.is-light {
  color: #1d1d1f; --am-ink2: rgba(29, 29, 31, 0.72); --am-ink3: rgba(29, 29, 31, 0.54);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 248, 252, 0.9));
  box-shadow: inset 0 0 0 1px rgba(20, 40, 80, 0.08), 0 20px 60px rgba(20, 30, 60, 0.12);
}
.amg.is-light .amg-sound, .amg.is-light .amg-back, .amg.is-light .amg-theme { background: rgba(0, 0, 0, 0.06); }
.amg.is-light .amg-sound:hover, .amg.is-light .amg-back:hover, .amg.is-light .amg-theme:hover { background: rgba(0, 0, 0, 0.1); }
.amg.is-light .amg-sound[aria-pressed="true"] { background: rgba(10, 111, 224, 0.14); color: #0a5cc2; }
.amg.is-light .amg-theme::before { box-shadow: 0 1px 4px rgba(20, 30, 60, 0.2); }
.amg.is-light .amg-tile { background: rgba(255, 255, 255, 0.85); box-shadow: inset 0 0 0 1px rgba(20, 40, 80, 0.08), 0 1px 2px rgba(20, 40, 80, 0.06); }
.amg.is-light .amg-tile:hover { background: #fff; }
.amg.is-light .amg-thumb { background: #eef2f8; }
.amg.is-light .amg-canvas { background: #f4f6fa; }
.amg.is-light .amg-medal { background: rgba(0, 0, 0, 0.14); }
.amg.is-light .amg-medal.is-1 { background: #aab2c0; }
.amg.is-light .amg-medal.is-3 { background: #5fc4e6; }

@media (max-width: 760px) {
  .amg { padding: 12px; gap: 10px; border-radius: 24px; }
  .amg-h2 { font-size: 18px; }
  .amg-tiles { gap: 8px; }
  .amg-tile { border-radius: 18px; padding: 6px 6px 10px; }
  .amg-thumb { border-radius: 13px; }
  .amg-stage { width: min(100%, calc((100vh - 110px) * 2 / 3)); width: min(100%, calc((100dvh - 110px) * 2 / 3)); }
}
@media (prefers-reduced-motion: reduce) {
  .amg-dot { animation: none; }
  .amg-theme::before, .amg-theme i { transition: none; }
  .amg-tile { transition: none; }
  .amg-tile:hover, .amg-tile:active { transform: none; }
}
