/* ==========================================================================
   Apple Invites (iCloud Invites / iOS 18 Liquid Glass) Unified Design System
   Cohesive Main Stage + Refactored Tool Internals (Zero Legacy/Terminal UI)
   ========================================================================== */

:root {
  --bg-canvas: #06070b;
  --glass-surface: rgba(28, 30, 40, 0.56);
  --glass-surface-elevated: rgba(42, 45, 58, 0.62);
  --glass-tile: rgba(255, 255, 255, 0.055);
  --glass-tile-hover: rgba(255, 255, 255, 0.09);
  --glass-well: rgba(8, 10, 16, 0.42);

  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.18);
  --border-strong: rgba(255, 255, 255, 0.3);

  --specular-top: inset 0 1px 0 0 rgba(255, 255, 255, 0.24);
  --specular-card: inset 0 1px 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 0 rgba(255, 255, 255, 0.05);
  --shadow-card: 0 32px 80px -16px rgba(0, 0, 0, 0.72), 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 16px 40px rgba(0, 0, 0, 0.5);

  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(235, 235, 245, 0.66);
  --text-tertiary: rgba(235, 235, 245, 0.4);

  --apple-green: #30d158;
  --apple-amber: #ff9f0a;
  --apple-purple: #bf5af2;
  --apple-cyan: #5ac8fa;
  --apple-rose: #ff375f;
  --apple-red: #ff453a;

  /* Dynamic Active Theme Variables */
  --theme-color: #30d158;
  --theme-glow: rgba(48, 209, 88, 0.28);
  --orb-1: #059669;
  --orb-2: #10b981;
  --orb-3: #0f766e;

  --radius-card: 36px;
  --radius-tile: 24px;
  --radius-control: 16px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, monospace;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: default;
}

/* Only allow text selection & text cursor inside interactive input/result areas */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  cursor: text;
}

svg {
  pointer-events: none;
}

/* ==========================================================================
   1. Apple Invites Dynamic Ambient Aurora Canvas
   ========================================================================== */

.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 50% -10%, rgba(30, 34, 52, 0.65), var(--bg-canvas) 75%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  transition: background 1s var(--ease-out-expo), transform 1.2s ease;
  will-change: background, transform;
}

.orb-1 {
  width: 60vw;
  height: 60vw;
  max-width: 760px;
  max-height: 760px;
  top: -20%;
  left: -10%;
  background: var(--orb-1);
  animation: drift1 20s ease-in-out infinite alternate;
}

.orb-2 {
  width: 52vw;
  height: 52vw;
  max-width: 680px;
  max-height: 680px;
  top: 12%;
  right: -14%;
  background: var(--orb-2);
  animation: drift2 24s ease-in-out infinite alternate;
}

.orb-3 {
  width: 48vw;
  height: 48vw;
  max-width: 620px;
  max-height: 620px;
  bottom: -20%;
  left: 20%;
  background: var(--orb-3);
  animation: drift3 22s ease-in-out infinite alternate;
}

@keyframes drift1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6%, 8%) scale(1.08); }
}
@keyframes drift2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-7%, 5%) scale(0.94); }
}
@keyframes drift3 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4%, -7%) scale(1.06); }
}

/* ==========================================================================
   2. Top Floating Glass Navigation Bar
   ========================================================================== */

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 24px 110px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(22, 24, 34, 0.56);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--specular-top), 0 12px 32px rgba(0, 0, 0, 0.32);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.28), rgba(255,255,255,0.06));
  border: 1px solid var(--border-light);
  box-shadow: var(--specular-top);
  color: #fff;
}

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.view-switcher {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.36);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s var(--ease-spring);
}

.view-btn:hover {
  color: #fff;
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: var(--specular-top), 0 2px 8px rgba(0, 0, 0, 0.28);
}

/* ==========================================================================
   3. Apple Invites Poster Carousel / Left Showcase Deck
   ========================================================================== */

.workspace-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

body[data-layout="bento"] .workspace-layout {
  grid-template-columns: 1fr;
}

body[data-layout="bento"] .invite-deck {
  display: none;
}

.invite-deck {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 20px;
}

.deck-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

/* Mini Apple Invite Poster Card in Deck */
.poster-nav-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 26px;
  background: var(--glass-surface);
  backdrop-filter: blur(36px) saturate(190%);
  -webkit-backdrop-filter: blur(36px) saturate(190%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--specular-card), 0 10px 28px rgba(0, 0, 0, 0.26);
  color: var(--text-primary);
  text-align: left;
  font-family: var(--font-sans);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.3s var(--ease-spring), border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.poster-nav-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 50%, var(--card-accent), transparent 72%);
  opacity: 0.08;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.poster-nav-card:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--border-light);
  background: var(--glass-surface-elevated);
}

.poster-nav-card:hover::before {
  opacity: 0.16;
}

.poster-nav-card.active {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(40, 44, 60, 0.72);
  box-shadow: var(--specular-card), 0 16px 38px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--card-accent);
}

.poster-nav-card.active::before {
  opacity: 0.26;
}

.poster-art-thumb {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-poster-bg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.3);
  color: #fff;
  flex-shrink: 0;
}

.poster-nav-info {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.poster-nav-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--card-accent);
  margin-bottom: 2px;
}

.poster-nav-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-nav-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   4. Apple Invites Main Card Sheet & Poster Hero Cover
   ========================================================================== */

.cards-stage {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

body[data-layout="stage"] .invite-card {
  display: none;
  animation: inviteSheetReveal 0.46s var(--ease-out-expo) forwards;
}

body[data-layout="stage"] .invite-card.active {
  display: flex;
}

body[data-layout="bento"] .cards-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 24px;
  align-items: stretch;
}

body[data-layout="bento"] .invite-card {
  display: flex;
  animation: inviteSheetReveal 0.42s var(--ease-out-expo) forwards;
  transition: grid-column 0.4s var(--ease-out-expo), transform 0.35s var(--ease-spring), border-color 0.3s ease, box-shadow 0.35s ease;
}

.invite-badge-pill.bento-size-btn {
  display: none !important;
}

.poster-right-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Desktop Dynamic 12-Column Asymmetric Bento Grid */
@media (min-width: 1040px) {
  body[data-layout="bento"] .cards-stage {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: dense;
    align-items: start;
  }

  /* Default Asymmetric Apple Bento Proportions (7:5, 5:7, 12) */
  body[data-layout="bento"] .invite-card[data-tool="aes"]     { grid-column: span 7; }
  body[data-layout="bento"] .invite-card[data-tool="rc4"]     { grid-column: span 5; }
  body[data-layout="bento"] .invite-card[data-tool="jump"]    { grid-column: span 5; }
  body[data-layout="bento"] .invite-card[data-tool="cloudid"] { grid-column: span 7; }
  body[data-layout="bento"] .invite-card[data-tool="sina"]    { grid-column: span 12; }

  /* Dynamic Focus & Content-Driven Span Overrides */
  body[data-layout="bento"] .invite-card[data-bento-span="5"]  { grid-column: span 5 !important; }
  body[data-layout="bento"] .invite-card[data-bento-span="6"]  { grid-column: span 6 !important; }
  body[data-layout="bento"] .invite-card[data-bento-span="7"]  { grid-column: span 7 !important; }
  body[data-layout="bento"] .invite-card[data-bento-span="8"]  { grid-column: span 8 !important; }
  body[data-layout="bento"] .invite-card[data-bento-span="12"] { grid-column: span 12 !important; }

  /* Highlight & Elevate Currently Focused Card in Bento Mode */
  body[data-layout="bento"] .invite-card.bento-focused {
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: var(--specular-card), 0 36px 90px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--card-accent);
    transform: translateY(-3px);
  }

  /* Sleek Compact Poster Header in Bento Mode for Dynamic Vertical Height */
  body[data-layout="bento"] .invite-poster {
    padding: 20px 24px 18px;
    text-align: center;
    align-items: center;
    gap: 8px;
  }

  body[data-layout="bento"] .poster-emblem {
    display: none;
  }

  body[data-layout="bento"] .poster-title {
    font-size: 22px;
    margin-top: 2px;
  }

  body[data-layout="bento"] .poster-subtitle {
    font-size: 12.5px;
    max-width: 100%;
  }

  body[data-layout="bento"] .invite-badge-pill.bento-size-btn {
    display: inline-flex !important;
    cursor: pointer;
  }
}

@keyframes inviteSheetReveal {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Theme Palettes per Invite Card */
.invite-card[data-tool="aes"] {
  --card-accent: var(--apple-green);
  --card-poster-bg: radial-gradient(circle at 20% 20%, rgba(48, 209, 88, 0.55), rgba(13, 148, 136, 0.35) 55%, rgba(16, 20, 30, 0.1) 100%);
}
.invite-card[data-tool="rc4"] {
  --card-accent: var(--apple-amber);
  --card-poster-bg: radial-gradient(circle at 80% 20%, rgba(255, 159, 10, 0.55), rgba(217, 119, 6, 0.32) 55%, rgba(16, 20, 30, 0.1) 100%);
}
.invite-card[data-tool="cloudid"] {
  --card-accent: var(--apple-purple);
  --card-poster-bg: radial-gradient(circle at 50% 15%, rgba(191, 90, 242, 0.55), rgba(94, 92, 230, 0.35) 55%, rgba(16, 20, 30, 0.1) 100%);
}
.invite-card[data-tool="jump"] {
  --card-accent: var(--apple-cyan);
  --card-poster-bg: radial-gradient(circle at 25% 25%, rgba(90, 200, 250, 0.55), rgba(10, 132, 255, 0.35) 55%, rgba(16, 20, 30, 0.1) 100%);
}
.invite-card[data-tool="sina"] {
  --card-accent: var(--apple-rose);
  --card-poster-bg: radial-gradient(circle at 75% 20%, rgba(255, 55, 95, 0.55), rgba(236, 72, 153, 0.35) 55%, rgba(16, 20, 30, 0.1) 100%);
}

.invite-card {
  position: relative;
  flex-direction: column;
  border-radius: var(--radius-card);
  background: var(--glass-surface);
  backdrop-filter: blur(52px) saturate(200%);
  -webkit-backdrop-filter: blur(52px) saturate(200%);
  border: 1px solid var(--border-light);
  box-shadow: var(--specular-card), var(--shadow-card);
  overflow: hidden;
}

/* Apple Invites Poster Cover (Centered Editorial Banner + Floating Glass Pill) */
.invite-poster {
  position: relative;
  padding: 32px 28px 26px;
  background: var(--card-poster-bg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.invite-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(12,14,22,0.52) 100%);
  pointer-events: none;
}

.poster-top-bar {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.invite-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--specular-top);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--card-accent);
  box-shadow: 0 0 8px var(--card-accent);
}

.poster-emblem {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--specular-top), 0 14px 32px rgba(0, 0, 0, 0.32);
  color: #fff;
}

.poster-title {
  position: relative;
  z-index: 1;
  margin: 4px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.poster-subtitle {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 520px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
}

/* ==========================================================================
   5. Refactored Tool Internal UI — Apple Invites Glass Tiles & Controls
   ========================================================================== */

.invite-sheet-body {
  padding: 24px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Apple Invites Event Tile (Replaces boxy sections) */
.apple-tile {
  background: var(--glass-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-tile);
  padding: 18px 20px;
  box-shadow: var(--specular-top);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.apple-tile:focus-within {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.22);
}

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.01em;
}

.tile-title svg {
  color: var(--card-accent);
}

.tile-caption {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Clean iOS / macOS Frosted Inputs (Sans-serif by default, clean rounded well) */
.apple-input,
.apple-textarea {
  width: 100%;
  background: var(--glass-well);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-control);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  padding: 13px 16px;
  outline: none;
  transition: all 0.25s var(--ease-spring);
}

.apple-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
}

.apple-input.mono,
.apple-textarea.mono {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.apple-input:focus,
.apple-textarea:focus {
  border-color: var(--card-accent);
  background: rgba(6, 8, 14, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.apple-input::placeholder,
.apple-textarea::placeholder {
  color: var(--text-tertiary);
}

.input-pill-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-pill-wrap .apple-input {
  flex: 1;
}

/* iOS Segmented Control (Replaces ALL native <select> and radio boxes) */
.ios-segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.36);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 4px;
}

.seg-option {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
  text-align: center;
  white-space: nowrap;
}

.seg-option:hover {
  color: #fff;
}

.seg-option.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: var(--specular-top), 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Interactive Glass Filter Chips (Replaces Character Mode <select> dropdown) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.glass-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.22s var(--ease-spring);
}

.glass-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.glass-chip.active {
  background: var(--card-accent);
  color: #06080c;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: var(--specular-top), 0 4px 14px -2px var(--card-accent);
}

/* iOS Range Slider & Capacity Meter */
.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ios-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.ios-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.ios-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.length-pill-val {
  min-width: 58px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.capacity-meter {
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 2px;
}

.capacity-fill {
  height: 100%;
  width: 35%;
  background: var(--apple-green);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease, background 0.3s ease;
}

/* Apple Invites RSVP-Style Action Bar */
.rsvp-action-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.rsvp-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: var(--specular-top), 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: all 0.25s var(--ease-spring);
}

.rsvp-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.rsvp-btn:active {
  transform: translateY(0) scale(0.98);
}

.rsvp-btn.primary {
  background: var(--card-accent);
  color: #05070b;
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: var(--specular-top), 0 10px 26px -6px var(--card-accent);
}

.rsvp-btn.primary:hover {
  filter: brightness(1.07);
}

.glass-pill-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s var(--ease-spring);
  white-space: nowrap;
}

.glass-pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.26);
}

.glass-pill-btn.accent {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 600;
}

/* iOS Settings Toggle Row */
.ios-options-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.ios-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.ios-switch-label input[type="checkbox"] {
  appearance: none;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
  margin: 0;
}

.ios-switch-label input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s var(--ease-spring);
}

.ios-switch-label input[type="checkbox"]:checked {
  background: var(--card-accent);
}

.ios-switch-label input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

/* Apple Wallet Pass / Invite Ticket Output Card */
.invite-ticket-well {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-tile);
  padding: 18px 20px;
  box-shadow: var(--specular-top), inset 0 0 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.ticket-output-body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  color: #fff;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 54px;
  display: flex;
  align-items: center;
  -webkit-user-select: text !important;
  user-select: text !important;
  cursor: text;
}

.ticket-output-body.ticket-hero-code {
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 10px 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.ticket-output-body.ticket-placeholder,
.ticket-placeholder {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-tertiary);
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: default;
}

.ticket-divider {
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0, rgba(255,255,255,0.18) 6px, transparent 6px, transparent 12px);
}

.ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Auto-Shred Countdown Ring Pill */
.shred-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 69, 58, 0.18);
  border: 1px solid rgba(255, 69, 58, 0.35);
  color: #ff6961;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.shred-progress-line {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.shred-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--card-accent), var(--apple-red));
  transition: width 1s linear;
}

/* ==========================================================================
   6. Apple Invites Route Cards (IPFS & Weibo) & Shared Album Gallery (Sina)
   ========================================================================== */

.protocol-detect-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.protocol-detect-pill.detected {
  background: rgba(90, 200, 250, 0.2);
  border-color: rgba(90, 200, 250, 0.45);
  color: #fff;
}

.route-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.apple-route-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--specular-top);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.25s var(--ease-spring);
}

.apple-route-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-2px);
}

.route-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.route-node-badge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(90, 200, 250, 0.18);
  border: 1px solid rgba(90, 200, 250, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.route-node-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}

.route-node-url {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

/* Apple Invites Shared Album Photo Grid for Sina Image Parser */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.album-photo-card {
  position: relative;
  border-radius: 24px;
  background: rgba(12, 14, 22, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--specular-top), 0 12px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  group: photo;
}

.album-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.4s var(--ease-out-expo);
}

.album-photo-card:hover img {
  transform: scale(1.05);
}

.album-photo-overlay {
  position: absolute;
  inset: auto 10px 10px 10px;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(16, 18, 26, 0.76);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.album-meta-text {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-circle-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s ease;
}

.mini-circle-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: scale(1.08);
}

/* Compact Converted URL Pill List */
.url-pill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.url-pill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
}

.url-pill-row a {
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.url-pill-row a:hover {
  color: var(--apple-rose);
}

/* ==========================================================================
   7. Apple Glass Modal Sheets (Cloud ID Mapping & Photo Lightbox)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.25s ease forwards;
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 84vh;
  background: rgba(30, 33, 46, 0.86);
  backdrop-filter: blur(50px) saturate(190%);
  -webkit-backdrop-filter: blur(50px) saturate(190%);
  border: 1px solid var(--border-light);
  border-radius: 32px;
  box-shadow: var(--specular-card), 0 32px 90px rgba(0, 0, 0, 0.75);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.map-scroll-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
}

.map-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

/* Lightbox Image Viewer */
.lightbox-img-wrap {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   8. Mobile Bottom Glass Dock & Dynamic Island Toast
   ========================================================================== */

.mobile-dock {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: rgba(22, 24, 34, 0.78);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--border-light);
  box-shadow: var(--specular-top), var(--shadow-float);
  border-radius: var(--radius-pill);
  padding: 6px;
  gap: 4px;
  max-width: 94vw;
}

.dock-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.22s var(--ease-spring);
}

.dock-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: var(--specular-top);
}

.island-toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 350;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.island-toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(14, 16, 24, 0.88);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  animation: islandPop 0.32s var(--ease-out-expo) forwards;
}

@keyframes islandPop {
  from { opacity: 0; transform: translateY(-14px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* ==========================================================================
   9. Responsive Design (Mobile Apple Invites Carousel + Sheet)
   ========================================================================== */

@media (max-width: 960px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .invite-deck {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .invite-deck::-webkit-scrollbar {
    display: none;
  }
  .deck-section-label {
    display: none;
  }
  .poster-nav-card {
    flex: 0 0 auto;
    min-width: 225px;
    padding: 12px 14px;
  }

  body[data-layout="bento"] .cards-stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px 14px 96px;
    gap: 16px;
  }

  .brand-text p {
    display: none;
  }

  .invite-poster {
    padding: 24px 20px 20px;
  }

  .poster-title {
    font-size: 23px;
  }

  .invite-sheet-body {
    padding: 18px;
  }

  .ios-segmented {
    flex-wrap: wrap;
  }

  .mobile-dock {
    display: flex;
  }
}
