:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.08);
  --card-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --primary: #7c3aed;
  --primary-2: #8b5cf6;
  --ring: rgba(124, 58, 237, 0.22);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);

  --radius: 18px;
  --radius-sm: 14px;
  --gap: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";

  /* iOS 安全区 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1000px 700px at 20% 10%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(1000px 700px at 80% 30%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(1000px 700px at 50% 90%, rgba(16, 185, 129, 0.14), transparent 60%),
    var(--bg);
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.topbar {
  height: calc(64px + var(--safe-top));
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-hint {
  font-size: 12px;
  color: var(--muted);
}

.view {
  flex: 1;
  padding: 18px;
  display: grid;
  place-items: start center;
}

.card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: radial-gradient(900px 220px at 30% 0%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(800px 220px at 85% 20%, rgba(59, 130, 246, 0.18), transparent 60%);
  opacity: 0.9;
}

.card > * {
  position: relative;
}

.card-tight {
  width: 100%;
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.h1 {
  margin: 0;
  padding: 18px 18px 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card > .muted {
  padding: 6px 18px 0;
  margin: 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 18px 0;
}

.segmented-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
}

.segmented-item.is-active {
  border-color: rgba(124, 58, 237, 0.65);
  background: rgba(124, 58, 237, 0.22);
}

.form {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.input {
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline: none;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
}

.input:focus {
  border-color: rgba(124, 58, 237, 0.75);
  box-shadow: 0 0 0 4px var(--ring);
}

.mono {
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.btn {
  height: 44px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.05);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-full {
  width: 100%;
}

.btn + .btn {
  margin-top: 10px;
}

.btn-primary.is-on {
  position: relative;
  animation: vib 0.12s infinite linear;
}

.btn-primary.is-on::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 55%),
    radial-gradient(circle at 70% 60%, rgba(124, 58, 237, 0.28), transparent 55%);
  filter: blur(10px);
  opacity: 0.9;
  pointer-events: none;
}

@keyframes vib {
  0% { transform: translate(0, 0) scale(0.999); }
  25% { transform: translate(0.6px, -0.4px) scale(1); }
  50% { transform: translate(-0.5px, 0.6px) scale(1.001); }
  75% { transform: translate(0.5px, 0.4px) scale(1); }
  100% { transform: translate(0, 0) scale(0.999); }
}

.title-lg {
  font-size: 18px;
  font-weight: 700;
}

.spacer {
  height: 6px;
}

.remote-bg {
  width: 100%;
  display: grid;
  place-items: start center;
}

.remote-wrap {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.remote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remote-title {
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.grid-2 {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-card {
  width: 100%;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: left;
  padding-left: 16px;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.action-card:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.06);
}

.action-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.action-card.fx-pulse {
  animation: pulse 800ms ease-out 1;
}

.action-card.fx-wave {
  animation: wave 1100ms ease-out 1;
}

.action-card.fx-heat {
  animation: heat 1200ms ease-out 1;
}

.action-card.fx-drops {
  position: relative;
}

.action-card.fx-drops::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: calc(var(--radius) + 10px);
  background:
    radial-gradient(circle at 12% 22%, rgba(56, 189, 248, 0.0) 0 38%, rgba(56, 189, 248, 0.65) 40%, rgba(56, 189, 248, 0.0) 58%),
    radial-gradient(circle at 78% 28%, rgba(56, 189, 248, 0.0) 0 36%, rgba(56, 189, 248, 0.55) 40%, rgba(56, 189, 248, 0.0) 60%),
    radial-gradient(circle at 30% 82%, rgba(56, 189, 248, 0.0) 0 36%, rgba(56, 189, 248, 0.55) 40%, rgba(56, 189, 248, 0.0) 60%),
    radial-gradient(circle at 88% 78%, rgba(56, 189, 248, 0.0) 0 34%, rgba(56, 189, 248, 0.50) 40%, rgba(56, 189, 248, 0.0) 62%);
  filter: blur(0.2px);
  opacity: 0;
  animation: drops 1300ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-speed-up {
  position: relative;
}

.action-card.fx-speed-up::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(90deg, rgba(16,185,129,0.0), rgba(16,185,129,0.18), rgba(16,185,129,0.0)),
    radial-gradient(circle at 70% 40%, rgba(167,243,208,0.20), transparent 55%);
  opacity: 0;
  transform: translateX(-18px);
  animation: speedUp 900ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-speed-down {
  position: relative;
}

.action-card.fx-speed-down::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(90deg, rgba(59,130,246,0.0), rgba(59,130,246,0.16), rgba(59,130,246,0.0)),
    radial-gradient(circle at 30% 60%, rgba(191,219,254,0.18), transparent 55%);
  opacity: 0;
  transform: translateX(18px);
  animation: speedDown 900ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-shimmer {
  position: relative;
}

.action-card.fx-shimmer::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: calc(var(--radius) + 14px);
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.0) 0 40%, rgba(255,255,255,0.16) 44%, rgba(255,255,255,0.0) 60%),
    radial-gradient(circle at 85% 35%, rgba(255,255,255,0.0) 0 40%, rgba(255,255,255,0.14) 44%, rgba(255,255,255,0.0) 60%),
    linear-gradient(120deg, rgba(124,58,237,0.0), rgba(124,58,237,0.10), rgba(124,58,237,0.0));
  opacity: 0;
  animation: shimmer 1100ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-tick {
  animation: tick 800ms ease-out 1;
}

.action-card.is-active {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.10);
}

@keyframes speedUp {
  0% { opacity: 0; transform: translateX(-18px); }
  25% { opacity: 0.85; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(10px); }
}

@keyframes speedDown {
  0% { opacity: 0; transform: translateX(18px); }
  25% { opacity: 0.85; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-10px); }
}

@keyframes shimmer {
  0% { opacity: 0; transform: rotate(-2deg) scale(0.98); }
  30% { opacity: 0.9; transform: rotate(0deg) scale(1); }
  100% { opacity: 0; transform: rotate(1deg) scale(1.02); }
}

@keyframes tick {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(0) scale(1.01); }
  60% { transform: translateY(0) scale(0.995); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.18); transform: translateY(0) scale(1.01); }
  100% { filter: brightness(1); transform: translateY(0) scale(1); }
}

@keyframes wave {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.0); }
  30% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.18); }
  100% { box-shadow: 0 0 0 18px rgba(124, 58, 237, 0.0); }
}

@keyframes heat {
  0% { filter: hue-rotate(0deg) brightness(1); }
  30% { filter: hue-rotate(-14deg) brightness(1.12); }
  100% { filter: hue-rotate(0deg) brightness(1); }
}

@keyframes drops {
  0% { opacity: 0; transform: scale(0.98); }
  25% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}

.action-card::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.85;
}

.action-card {
  padding-left: 38px;
}

.tone-positive {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.22);
}
.tone-positive::before {
  background: rgba(167, 243, 208, 0.85);
}

.tone-neutral {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.tone-neutral::before {
  background: rgba(255, 255, 255, 0.75);
}

.tone-accent {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.22);
}
.tone-accent::before {
  background: rgba(191, 219, 254, 0.90);
}

.tone-accent2 {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.22);
}
.tone-accent2::before {
  background: rgba(221, 214, 254, 0.92);
}

.tone-warning {
  background: rgba(254, 226, 226, 0.90);
  border-color: rgba(254, 202, 202, 1);
  color: #991b1b;
}
.tone-warning::before {
  background: rgba(153, 27, 27, 0.85);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  z-index: 50;
}

.overlay-card {
  width: min(360px, 92vw);
  background: rgba(20, 24, 38, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.overlay-text {
  font-weight: 650;
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.88);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  z-index: 60;
}

.modal-card {
  width: min(420px, 92vw);
  background: rgba(20, 24, 38, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.modal-title {
  font-size: 18px;
  font-weight: 750;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 80;
  max-width: min(520px, 92vw);
  text-align: center;
}

@media (max-width: 480px) {
  .view {
    padding: 14px;
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .remote-wrap {
    width: min(560px, 100%);
  }

  .action-card {
    height: 60px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}


