/* Audio Island demo — same look & motion as the desktop app (iOS Dynamic
   Island style): spring morphs, compact live activity, player, calendar and
   iOS-style settings categories. */

.ai-desk {
  container-type: inline-size;
}

.ai {
  --open: cubic-bezier(0.3, 1.3, 0.52, 1);
  --close: cubic-bezier(0.4, 1.06, 0.6, 1);
  --bg: #000;
  --ink: #fff;
  --ink-2: rgba(235, 235, 245, 0.55);
  --ink-3: rgba(235, 235, 245, 0.35);
  --fill: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.08);
  --hover: rgba(255, 255, 255, 0.07);
  --a1: #ff8fc1;
  --a2: #7c9cff;
  --w: min(410px, calc(100cqw - 40px));
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 2;
  width: 124px;
  height: 37px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  transform: translateX(-50%);
  overflow: hidden;
  cursor: pointer;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.075);
  transition:
    width 0.46s var(--close),
    height 0.46s var(--close),
    border-radius 0.4s var(--close),
    background 0.3s ease,
    box-shadow 0.4s ease;
}

.ai.is-light {
  --bg: #f7f7f9;
  --ink: #111216;
  --ink-2: rgba(60, 60, 67, 0.6);
  --ink-3: rgba(60, 60, 67, 0.35);
  --fill: rgba(0, 0, 0, 0.05);
  --line: rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.05);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.ai[data-mode="compact"] {
  width: 250px;
  height: 44px;
  border-radius: 22px;
  transition:
    width 0.55s var(--open),
    height 0.55s var(--open),
    border-radius 0.5s var(--open),
    background 0.3s ease;
}

.ai[data-mode="compact"]:hover {
  width: 258px;
  height: 46px;
  border-radius: 23px;
}

.ai[data-mode="expanded"] {
  width: var(--w);
  height: 182px;
  border-radius: 40px;
  cursor: default;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.075);
  transition:
    width 0.62s var(--open),
    height 0.62s var(--open),
    border-radius 0.5s var(--open),
    background 0.3s ease,
    box-shadow 0.4s ease;
}

.ai.is-light[data-mode="expanded"] {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.ai[data-mode="expanded"].has-volume { height: 228px; }
.ai[data-mode="expanded"].has-friends { height: 248px; }
.ai[data-mode="expanded"][data-page="settings"]:not([data-cat]) { height: 270px; }

/* ---------- compact ---------- */

.ai-compact {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px 0 9px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.ai[data-mode="compact"] .ai-compact {
  opacity: 1;
  transition: opacity 0.24s ease 0.18s;
}

.ai-compact-cover {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
}

.ai-compact-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
}

.ai-bars {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 26px;
  height: 26px;
}

.ai-bars i {
  width: 3.25px;
  height: calc(3.25px + var(--h, 0.12) * 20px);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--a1), var(--a2));
}

.ai-compact-bars { width: 22px; }
.ai-compact-bars i { height: calc(3px + var(--h, 0.12) * 16px); }

/* ---------- pages ---------- */

.ai-pages {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--w);
  height: 100%;
  opacity: 0;
  transform: translateX(-50%) scale(0.9);
  transform-origin: 50% 8px;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.4s var(--close);
}

.ai[data-mode="expanded"] .ai-pages {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
  transition: opacity 0.28s ease 0.08s, transform 0.6s var(--open) 0.02s;
}

.ai-page {
  position: absolute;
  inset: 0 0 auto 0;
  padding: 22px;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(34px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.5s var(--open);
}

.ai-page.is-before { transform: translateY(-46px) scale(0.97); }

.ai-page.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.3s ease 0.06s, transform 0.55s var(--open);
}

/* ---------- player ---------- */

.ai-top {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 58px;
}

.ai-cover {
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 13px;
  object-fit: cover;
}

.ai-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ai-meta strong {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-meta span {
  color: var(--ink-2);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.ai-time {
  flex: none;
  width: 44px;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ai-time-right { text-align: right; }

.ai-track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  background: color-mix(in srgb, var(--ink) 20%, transparent);
  cursor: pointer;
  transition: height 0.15s ease;
}

.ai-track::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}

.ai-track:hover { height: 7px; }

.ai-track b {
  display: block;
  width: 30%;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  opacity: 0.92;
}

.ai-controls {
  display: grid;
  grid-template-columns: 40px 1fr 56px 64px 56px 1fr 40px;
  align-items: center;
  height: 44px;
  margin-top: 12px;
}

.ai-btn,
.ai-side {
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.ai-btn {
  width: 46px;
  height: 46px;
  justify-self: center;
}

.ai-btn:hover,
.ai-side:hover { background: var(--hover); }
.ai-btn:active,
.ai-side:active { transform: scale(0.88); }

#aiPrev { grid-column: 3; }
#aiPlay { grid-column: 4; }
#aiNext { grid-column: 5; }
#aiSound { grid-column: 7; }

.ai-btn svg { width: 26px; height: 19px; fill: currentColor; }
.ai-play svg { width: 28px; height: 28px; }
.ai-play .ai-icon-play { display: none; }
.ai-play.is-paused .ai-icon-play { display: block; }
.ai-play.is-paused .ai-icon-pause { display: none; }

.ai-side {
  width: 36px;
  height: 36px;
  color: var(--ink-2);
}

.ai-side:hover,
.ai-side.is-active { color: var(--ink); }
.ai-side.is-active { color: #0a84ff; }
.ai-side svg { width: 21px; height: 21px; fill: currentColor; }

.ai-drawer {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 182px;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.4s var(--open);
}

.ai.has-volume .ai-volume,
.ai.has-friends .ai-friends {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ai-volume {
  display: grid;
  grid-template-columns: 20px 1fr 24px;
  align-items: center;
  gap: 12px;
  height: 28px;
  top: 174px;
  color: var(--ink-2);
}

.ai-volume svg { width: 18px; height: 18px; fill: currentColor; }
.ai-volume svg:last-child { width: 22px; height: 22px; }

.ai-volume input {
  width: 100%;
  height: 7px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 78%, transparent) var(--v, 68%), color-mix(in srgb, var(--ink) 20%, transparent) var(--v, 68%));
  cursor: pointer;
}

.ai-volume input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 15px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.35);
  transition: width 0.15s ease, height 0.15s ease, background 0.15s ease;
}

.ai-volume input:active::-webkit-slider-thumb {
  width: 36px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.ai-volume input::-moz-range-thumb {
  width: 24px;
  height: 15px;
  border: 0;
  border-radius: 999px;
  background: #fff;
}

.ai-friends { top: 176px; }

.ai-friends-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: 20px;
  background: var(--fill);
}

.ai-friends-card div {
  flex: 1;
  min-width: 0;
  display: grid;
}

.ai-friends-card strong { font-size: 14.5px; font-weight: 600; }
.ai-friends-card small { color: var(--ink-2); font-size: 11.5px; }

.ai-pill-btn {
  border: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- calendar ---------- */

.ai-calendar {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
  padding: 18px 22px 18px 26px;
}

.ai-cal-left strong,
.ai-cal-right > strong {
  display: block;
  color: #ff2d55;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-cal-left span {
  display: block;
  margin: 2px 0 8px;
  font-size: 46px;
  font-weight: 300;
  line-height: 1;
}

.ai-cal-left p {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.ai-cal-left p.ai-dim { color: var(--ink-3); }

.ai-weekdays,
.ai-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
}

.ai-weekdays { margin: 6px 0 4px; color: var(--ink-2); }

.ai-days span {
  display: grid;
  place-items: center;
  height: 19px;
  font-size: 12px;
}

.ai-days span:nth-child(7n + 1),
.ai-days span:nth-child(7n) { color: var(--ink-3); }

.ai-days span.is-today {
  justify-self: center;
  width: 20px;
  border-radius: 999px;
  background: #ff2d55;
  color: #fff;
}

/* ---------- settings ---------- */

.ai-settings { padding: 14px 16px 16px; }

.ai-set-list,
.ai-set-cat {
  transition: opacity 0.22s ease, transform 0.45s var(--open);
}

.ai-set-list h3 {
  margin: 4px 8px 12px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ai-set-cat {
  position: absolute;
  inset: 14px 16px auto;
  opacity: 0;
  transform: translateX(30%);
  pointer-events: none;
}

.ai[data-cat] .ai-set-list {
  opacity: 0;
  transform: translateX(-25%);
  pointer-events: none;
}

.ai[data-cat="discord"] .ai-set-cat[data-cat="discord"],
.ai[data-cat="look"] .ai-set-cat[data-cat="look"],
.ai[data-cat="system"] .ai-set-cat[data-cat="system"],
.ai[data-cat="account"] .ai-set-cat[data-cat="account"] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.26s ease 0.06s, transform 0.5s var(--open);
}

.ai-cat-head {
  position: relative;
  display: grid;
  place-items: center;
  height: 32px;
  margin-bottom: 14px;
}

.ai-cat-head strong { font-size: 16px; font-weight: 600; }

.ai-back {
  position: absolute;
  left: -4px;
  top: 0;
  height: 32px;
  padding: 0 10px 0 22px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4d9eff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.ai-back::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.ai-back:hover { background: var(--hover); }

.ai-group {
  border-radius: 14px;
  background: var(--fill);
  overflow: hidden;
}

.ai-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  padding: 0 12px 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-row + .ai-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.ai-row:hover { background: var(--hover); }
.ai-row:active { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.ai-row-static { cursor: default; }
.ai-row-static:hover { background: transparent; }

.ai-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--tile, #8e8e93);
}

.ai-tile svg { width: 17px; height: 17px; fill: #fff; stroke: none; }
.ai-tile svg [stroke] { fill: none; }

.ai-row-label { flex: 1; font-size: 15px; }
.ai-row-value { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.ai-danger { color: #ff5b55; font-weight: 600; }

.ai-chevron {
  width: 7px;
  height: 7px;
  margin: 0 4px 0 2px;
  border-right: 2px solid var(--ink-3);
  border-top: 2px solid var(--ink-3);
  transform: rotate(45deg);
}

.ai-row-text {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.2;
}

.ai-row-text b { font-size: 14.5px; font-weight: 400; }
.ai-row-text small { color: var(--ink-2); font-size: 11.5px; }

.ai-switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  transition: background 0.25s ease;
}

.ai-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.32s var(--open);
}

.ai-switch.is-on { background: #30c759; }
.ai-switch.is-on::after { transform: translateX(20px); }

.ai-swatches { display: flex; gap: 8px; }

.ai-swatches button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--sw, linear-gradient(135deg, #ff5c7a, #9f5cff 50%, #19b8ff));
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-swatches button:hover { transform: scale(1.12); }
.ai-swatches button.is-active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* ---------- dots & hint ---------- */

.ai-dots {
  position: absolute;
  left: 50%;
  bottom: 54px;
  z-index: 2;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-desk.is-open .ai-dots { opacity: 1; }

.ai-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text, #fff) 30%, transparent);
  cursor: pointer;
  transition: width 0.3s var(--open, ease), background 0.2s ease;
}

.ai-dots button.is-active {
  width: 22px;
  background: color-mix(in srgb, var(--text, #fff) 85%, transparent);
}

.ai-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 2;
  margin: 0;
  text-align: center;
  color: color-mix(in srgb, var(--text, #fff) 45%, transparent);
  font-size: 13px;
}

/* ---------- micro-motion ---------- */

.ai-play svg { transition: transform 0.32s var(--open); }
.ai-play.is-pop svg { animation: aiPop 0.36s var(--open); }
.ai-meta.is-swap,
.ai-compact-title.is-swap { animation: aiSwap 0.5s var(--open); }
.ai-cover.is-swap,
.ai-compact-cover.is-swap { animation: aiCoverSwap 0.55s var(--open); }
.ai-cover { transition: transform 0.5s var(--open), filter 0.4s ease; }
.ai-player:has(.ai-play.is-paused) .ai-cover { transform: scale(0.9); filter: saturate(0.8); }
.ai-tile { transition: transform 0.2s var(--open); }
.ai-row:hover .ai-tile { transform: scale(1.08); }

@keyframes aiPop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes aiSwap {
  0% { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  100% { opacity: 1; transform: none; filter: none; }
}

@keyframes aiCoverSwap {
  0% { opacity: 0.2; transform: scale(0.82) rotate(-4deg); }
  100% { opacity: 1; transform: none; }
}

/* ---------- page reveal ---------- */

@keyframes aiRise {
  from { opacity: 0; transform: translateY(22px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes aiDeskIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.hero-media { animation: aiDeskIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-copy > * { animation: aiRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-copy > :nth-child(1) { animation-delay: 0.12s; }
.hero-copy > :nth-child(2) { animation-delay: 0.22s; }
.hero-copy > :nth-child(3) { animation-delay: 0.32s; }

.hero-actions a { transition: transform 0.25s cubic-bezier(0.3, 1.3, 0.52, 1), box-shadow 0.25s ease; }
.hero-actions a:hover { transform: translateY(-2px); }
.hero-actions a:active { transform: scale(0.96); }

@keyframes aiFade { from { opacity: 0; } to { opacity: 1; } }

/* Reduced motion: keep the morphs (they are the product demo) but without
   overshoot; page reveal becomes a plain fade. */
@media (prefers-reduced-motion: reduce) {
  .ai { --open: cubic-bezier(0.22, 1, 0.36, 1); --close: cubic-bezier(0.22, 1, 0.36, 1); }
  .hero-copy > *, .hero-media { animation-name: aiFade; }
}
