/* Swings (sw-): the feed (one card a screen, snap scrolling, the action rail beside the
   card), the side boxes (menu on the left, the member's standing on the right; both
   fold away on phones), the maker (write, then design), a Swing's own page, the Swing
   Race, My Swings / Saved Swings and staff review. swings.js draws the cards themselves,
   so only the frame is here, plus the line animations it uses (sw-m-*). */

.sw-page {
  --sw-ink: var(--bb-blue-900, #1e3a8a);
  --sw-text: #334155;
  --sw-muted: #64748b;
  --sw-line: #e2e8f0;
  --sw-card: #ffffff;
  --sw-gold: #C9A961;
  --sw-accent: var(--bb-blue-700, #1d4ed8);
  max-width: 1180px;
  margin: 0.5rem auto 3rem;
  color: var(--sw-text);
}

.sw-page-narrow { max-width: 760px; }

.sw-muted { color: var(--sw-muted); font-size: 0.9rem; }

/* A drawn card: swings.js fills it. Its height sets the scale of everything inside. */
[data-swing-card] {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background: #0f1f4d;
  border-radius: 18px;
  isolation: isolate;
  user-select: none;
}

[data-swing-card]:not(.sw-drawn) {
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
}

/* ---------- The feed page ---------- */

.sw-feed-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 1.25rem;
  align-items: start;
}

.sw-side {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sw-box {
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.sw-box h2, .sw-box h3 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sw-muted);
  margin: 0 0 0.6rem;
}

.sw-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.25rem;
}

.sw-brand h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--sw-ink);
  margin: 0;
}

.sw-new-tag {
  font: 800 0.62rem/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.08em;
  background: var(--sw-gold);
  color: #1b2440;
  padding: 4px 7px;
  border-radius: 999px;
}

.sw-make {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.sw-make:hover, .sw-make:focus-visible { color: #fff; filter: brightness(1.08); }

.sw-make-gold {
  background: linear-gradient(135deg, #b08a2e, #e9c46a);
  color: #1b2440;
  box-shadow: 0 8px 20px rgba(176, 138, 46, 0.3);
}

.sw-make-gold:hover, .sw-make-gold:focus-visible { color: #1b2440; }

.sw-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sw-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  color: var(--sw-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93rem;
}

.sw-nav a:hover { background: var(--bb-blue-50, #eff6ff); color: var(--sw-ink); }

.sw-nav a[aria-current="page"] {
  background: var(--bb-blue-50, #eff6ff);
  color: var(--sw-ink);
  box-shadow: inset 3px 0 0 var(--sw-accent);
}

.sw-count-pill {
  font-size: 0.72rem;
  font-weight: 800;
  background: #fde68a;
  color: #713f12;
  border-radius: 999px;
  padding: 1px 7px;
}

.sw-feed-wrap > * { min-width: 0; }

.sw-feed-col { min-width: 0; }

.sw-tabs {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0 0.6rem;
  flex-wrap: wrap;
}

.sw-tabs a {
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--sw-line);
  background: var(--sw-card);
  color: var(--sw-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
}

.sw-tabs a[aria-current="page"] {
  background: var(--sw-ink);
  border-color: var(--sw-ink);
  color: #fff;
}

/* The scrolling column: one Swing per screen. */
.sw-feed {
  position: relative;
  height: calc(100vh - 150px);
  height: calc(100dvh - 150px);
  min-height: 460px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 20px;
}

.sw-feed::-webkit-scrollbar { display: none; }

.sw-slide {
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 0.5rem 0;
}

.sw-slide-card {
  position: relative;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.sw-slide-card [data-swing-card] {
  height: calc(100% - 2.2rem);
  width: auto;
  max-width: 100%;
  box-shadow: 0 18px 40px rgba(15, 31, 77, 0.22);
}

.sw-slide-card.no-extra [data-swing-card] { height: 100%; }

.sw-extra {
  display: flex;
  gap: 0.4rem;
  min-height: 1.8rem;
  align-items: center;
  font-size: 0.82rem;
  overflow: hidden;
}

.sw-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--bb-blue-50, #eff6ff);
  color: var(--sw-ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sw-chip-link:hover { background: var(--bb-blue-100, #dbeafe); }

.sw-flag {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
  max-width: calc(100% - 20px);
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #7c2d12;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* The action rail beside the card. */
.sw-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.sw-act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--sw-text);
  font: 700 0.72rem Inter, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.sw-act-face {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
  box-shadow: 0 4px 12px rgba(15, 31, 77, 0.08);
  font-size: 1.25rem;
  transition: transform 0.15s, background 0.15s;
}

.sw-act:hover .sw-act-face { transform: scale(1.06); }
.sw-act:focus-visible { outline: none; }
.sw-act:focus-visible .sw-act-face { outline: 3px solid var(--sw-accent); outline-offset: 2px; }

.sw-act.is-on .sw-act-face { background: #fef3c7; border-color: #e9c46a; }
.sw-act[data-sw-react="Learned"].is-on .sw-act-face { background: #dcfce7; border-color: #86efac; }
.sw-act[data-sw-react="Push"].is-on .sw-act-face { background: #dbeafe; border-color: #93c5fd; }
.sw-act:disabled { opacity: 0.6; cursor: default; }

.sw-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, #C9A961);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
}

.sw-burst {
  position: absolute;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #15803d;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  pointer-events: none;
  animation: swBurst 1.1s ease-out forwards;
}

@keyframes swBurst {
  from { opacity: 0; transform: translate(-50%, 6px); }
  20% { opacity: 1; transform: translate(-50%, -6px); }
  to { opacity: 0; transform: translate(-50%, -26px); }
}

.sw-steps {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.sw-steps button {
  width: 40px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--sw-line);
  background: var(--sw-card);
  color: var(--sw-ink);
  font-weight: 800;
}

.sw-loader {
  height: 100%;
  scroll-snap-align: start;
  display: grid;
  place-items: center;
  color: var(--sw-muted);
}

.sw-end {
  height: 100%;
  scroll-snap-align: start;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.sw-end-card {
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, #0f1f4d, #1e3a8a);
  color: #fdf8ec;
  border-radius: 20px;
  padding: 2rem 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 31, 77, 0.25);
}

.sw-end-card h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.5rem;
  color: #fff;
}

.sw-end-card p { color: #dbe4ff; }

.sw-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  border: 2px dashed var(--sw-line);
  border-radius: 20px;
  background: var(--sw-card);
}

/* The member's standing (right side). */
.sw-stand {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.sw-stand div {
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.5rem 0.6rem;
}

.sw-stand b {
  display: block;
  font-size: 1.25rem;
  color: var(--sw-ink);
  line-height: 1.1;
}

.sw-stand span { font-size: 0.75rem; color: var(--sw-muted); font-weight: 600; }

.sw-ink {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
}

.sw-how {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
}

.sw-how li { margin-bottom: 0.3rem; }

.sw-toast {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(92vw, 460px);
  background: #0f1f4d;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  font-size: 0.9rem;
  animation: swToast 0.25s ease-out;
}

@keyframes swToast {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.sw-preview-note {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #713f12;
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

/* Tablets: the right box goes under the menu. */
@media (max-width: 1100px) {
  .sw-feed-wrap { grid-template-columns: 210px minmax(0, 1fr); }
  .sw-side-right { display: none; }
}

/* Phones: the menu becomes one row above the feed. */
@media (max-width: 760px) {
  .sw-page { margin-top: 0; }
  .sw-feed-wrap { grid-template-columns: 1fr; gap: 0.5rem; }
  .sw-side { position: static; }
  .sw-side-left .sw-box.sw-box-nav { padding: 0.35rem; }
  .sw-side-left .sw-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .sw-side-left .sw-nav a { white-space: nowrap; padding: 0.4rem 0.65rem; font-size: 0.85rem; }
  .sw-side-left .sw-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--sw-accent); }
  .sw-side-left .sw-box-intro { display: none; }
  .sw-brand h1 { font-size: 1.3rem; }
  .sw-side-left .sw-head-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
  .sw-side-left .sw-make { width: auto; padding: 0.5rem 0.95rem; font-size: 0.9rem; }
  .sw-feed { height: calc(100dvh - 190px); min-height: 420px; border-radius: 16px; }
  .sw-slide { gap: 0.4rem; position: relative; }
  .sw-slide-card { flex: 1; width: 100%; align-items: stretch; }
  /* The card fills the phone's feed, whatever its shape. */
  .sw-slide-card [data-swing-card] { width: 100%; aspect-ratio: auto; box-shadow: none; }
  .sw-extra { padding: 0 0.25rem; }
  .sw-rail { position: absolute; right: 6px; bottom: 54px; z-index: 6; gap: 0.55rem; }
  .sw-act { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
  .sw-act-face { width: 42px; height: 42px; font-size: 1.1rem; background: rgba(255, 255, 255, 0.92); color: var(--sw-ink); text-shadow: none; }
  .sw-avatar { width: 42px; height: 42px; }
  .sw-steps { display: none; }
}

/* ---------- Small cards (Race, My Swings, chains, review) ---------- */

.sw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.sw-tile {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
  border-radius: 18px;
  padding: 0.5rem;
}

.sw-tile > a { display: block; border-radius: 14px; }
.sw-tile [data-swing-card] { width: 100%; border-radius: 14px; }

.sw-tile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.78rem;
  color: var(--sw-muted);
  padding: 0 0.3rem;
}

.sw-tile-meta b { color: var(--sw-text); }

.sw-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.3rem 0.3rem;
}

.sw-tile-actions form { margin: 0; }

.sw-mini-btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--sw-line);
  background: #fff;
  color: var(--sw-text);
  text-decoration: none;
}

.sw-mini-btn:hover { background: #f1f5f9; }
.sw-mini-btn-danger { color: #b91c1c; border-color: #fecaca; }
.sw-mini-btn-ok { color: #15803d; border-color: #bbf7d0; }

.sw-hidden-note {
  font-size: 0.78rem;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  margin: 0 0.3rem;
}

.sw-wait-note {
  font-size: 0.78rem;
  background: #fef3c7;
  color: #713f12;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  margin: 0 0.3rem;
}

.sw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sw-head h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--sw-ink);
  margin: 0;
}

.sw-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.sw-pills a {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--sw-line);
  background: #fff;
  color: var(--sw-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
}

.sw-pills a[aria-current="page"] { background: var(--sw-ink); border-color: var(--sw-ink); color: #fff; }

/* ---------- A Swing's own page ---------- */

.sw-details {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.sw-details-card [data-swing-card] {
  width: 100%;
  box-shadow: 0 18px 40px rgba(15, 31, 77, 0.22);
}

.sw-details-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.9rem;
}

.sw-parent {
  display: block;
  background: #f8fafc;
  border: 1px solid var(--sw-line);
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
  color: var(--sw-text);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.sw-parent:hover { background: #f1f5f9; }

@media (max-width: 760px) {
  .sw-details { grid-template-columns: 1fr; }
  .sw-details-card { max-width: 360px; margin: 0 auto; width: 100%; }
  .sw-details-actions .sw-act { color: var(--sw-text); text-shadow: none; }
}

/* ---------- The Swing Race ---------- */

.sw-race-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 1.5rem 1.6rem;
  background: radial-gradient(circle at 88% 15%, rgba(201, 169, 97, 0.45), transparent 40%), linear-gradient(135deg, #0f1f4d, #1e3a8a);
  color: #fdf8ec;
  margin-bottom: 1.25rem;
}

.sw-race-hero h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.3rem;
}

.sw-race-hero p { margin: 0; color: #dbe4ff; }

.sw-race-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

.sw-racers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sw-racer {
  display: grid;
  grid-template-columns: 2.2rem 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
  border-radius: 14px;
  padding: 0.55rem 0.8rem;
}

.sw-racer.is-me { border-color: var(--sw-gold); box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.35); }

.sw-rank {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--sw-muted);
  text-align: center;
}

.sw-racer:nth-child(1) .sw-rank { color: #b08a2e; }
.sw-racer:nth-child(2) .sw-rank { color: #64748b; }
.sw-racer:nth-child(3) .sw-rank { color: #9a3412; }

.sw-racer .sw-avatar { width: 44px; height: 44px; }

.sw-racer-name { font-weight: 700; color: var(--sw-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-racer-sub { font-size: 0.8rem; color: var(--sw-muted); }

.sw-points {
  font-weight: 800;
  color: var(--sw-ink);
  text-align: right;
}

.sw-points small { display: block; font-weight: 600; color: var(--sw-muted); font-size: 0.72rem; }

.sw-bar {
  grid-column: 3 / 5;
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.sw-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1e3a8a, #C9A961); border-radius: inherit; }

@media (max-width: 900px) {
  .sw-race-grid { grid-template-columns: 1fr; }
}

/* ---------- The maker ---------- */

.sw-maker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}

.sw-maker-main { min-width: 0; }

.sw-panel {
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
  border-radius: 20px;
  padding: 1.25rem;
}

.sw-panel h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sw-ink);
  margin: 0 0 0.6rem;
}

.sw-kinds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sw-kind {
  position: relative;
  margin: 0;
}

.sw-kind input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

.sw-kind span {
  display: block;
  height: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  border: 1.5px solid var(--sw-line);
  background: #fff;
}

.sw-kind b { display: block; color: var(--sw-ink); font-size: 0.92rem; }
.sw-kind small { color: var(--sw-muted); font-size: 0.76rem; line-height: 1.25; display: block; }
.sw-kind input:checked + span { border-color: var(--sw-accent); background: var(--bb-blue-50, #eff6ff); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.sw-kind input:focus-visible + span { outline: 3px solid var(--sw-accent); outline-offset: 2px; }

.sw-write {
  position: relative;
}

.sw-write textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1.5px solid var(--sw-line);
  border-radius: 16px;
  padding: 0.85rem 1rem 1.6rem;
  font-size: 1.15rem;
  line-height: 1.5;
  font-family: Lora, Georgia, serif;
  color: var(--sw-ink);
}

.sw-write textarea:focus { outline: none; border-color: var(--sw-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

.sw-write textarea:lang(ur), .sw-urdu-input { font-family: "Noto Nastaliq Urdu", serif; line-height: 2.1; }

.sw-counter {
  position: absolute;
  right: 0.9rem;
  bottom: 0.55rem;
  font-size: 0.76rem;
  color: var(--sw-muted);
  font-weight: 700;
}

.sw-problem {
  margin-top: 0.75rem;
  border-radius: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.65rem 0.85rem;
  font-weight: 600;
}

.sw-busy {
  text-align: center;
  padding: 3rem 1rem;
}

.sw-spark {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: conic-gradient(#1e3a8a, #C9A961, #2563eb, #1e3a8a);
  animation: swSpin 1.2s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 18px, #000 19px);
  mask: radial-gradient(circle, transparent 18px, #000 19px);
}

@keyframes swSpin { to { transform: rotate(360deg); } }

.sw-design {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.sw-design-card [data-swing-card] {
  width: 100%;
  box-shadow: 0 18px 40px rgba(15, 31, 77, 0.22);
}

.sw-design-under {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.sw-row-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
}

.sw-row-title h3 { font-size: 0.85rem; font-weight: 800; color: var(--sw-ink); margin: 0; }
.sw-row-title small { color: var(--sw-muted); font-size: 0.76rem; }

.sw-families {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.sw-families button {
  border: 1px solid var(--sw-line);
  background: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sw-text);
}

.sw-families button[aria-pressed="true"] { background: var(--sw-ink); color: #fff; border-color: var(--sw-ink); }

.sw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.sw-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--sw-text);
}

.sw-chip-face {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  background-size: cover;
  background-position: center;
}

.sw-chip[aria-pressed="true"] .sw-chip-face { border-color: var(--sw-accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); }
.sw-chip:focus-visible { outline: none; }
.sw-chip:focus-visible .sw-chip-face { outline: 3px solid var(--sw-accent); outline-offset: 2px; }
.sw-chip[hidden] { display: none; }

.sw-chip-plain .sw-chip-face { background: linear-gradient(135deg, #f8fafc, #e2e8f0); color: var(--sw-ink); font-size: 1.1rem; }
.sw-chip-own .sw-chip-face { background: #f8fafc; border: 2px dashed #94a3b8; color: var(--sw-muted); font-size: 1.3rem; cursor: pointer; }
.sw-chip-own input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sw-chip-own:focus-within .sw-chip-face { outline: 3px solid var(--sw-accent); outline-offset: 2px; }

.sw-clarity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.sw-clarity input { flex: 1; accent-color: var(--sw-accent); }

.sw-rights {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.sw-rights input { margin-top: 0.2rem; accent-color: var(--sw-accent); }

.sw-book-box { position: relative; }

.sw-book-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.3rem;
}

.sw-book-pick {
  text-align: left;
  border: 0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font-size: 0.86rem;
  color: var(--sw-text);
}

.sw-book-pick:hover, .sw-book-pick:focus-visible { background: var(--bb-blue-50, #eff6ff); }

.sw-book-chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bb-blue-50, #eff6ff);
  border-radius: 12px;
  padding: 0.4rem 0.4rem 0.4rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--sw-ink);
}

.sw-post {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 0;
  font-weight: 800;
  font-size: 1rem;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.sw-post:disabled { opacity: 0.55; box-shadow: none; }

.sw-continuing {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--sw-line);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.sw-continuing [data-swing-card] { width: 48px; flex: none; border-radius: 8px; }

.sw-tips li { margin-bottom: 0.4rem; font-size: 0.88rem; }

@media (max-width: 960px) {
  .sw-maker { grid-template-columns: 1fr; }
  .sw-maker-aside { order: 2; }
}

@media (max-width: 640px) {
  .sw-design { grid-template-columns: 1fr; }
  .sw-design-card { max-width: 260px; margin: 0 auto; width: 100%; }
  .sw-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Line animations (swings.js sets sw-in sw-m-<motion> and a delay) ---------- */

.sw-in { animation-duration: 0.7s; animation-fill-mode: both; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
.sw-m-rise { animation-name: swRise; }
.sw-m-blur { animation-name: swBlur; animation-duration: 0.9s; }
.sw-m-zoom { animation-name: swZoom; }
.sw-m-slide { animation-name: swSlide; }
.sw-m-stamp { animation-name: swStamp; animation-duration: 0.45s; animation-timing-function: cubic-bezier(0.3, 1.6, 0.5, 1); }
.sw-m-type { animation-name: swType; animation-duration: 0.9s; animation-timing-function: steps(18, end); }

.sw-mark {
  animation: swMark 0.6s ease-out both;
}

/* The marker sweeps over the word from left to right. */
@keyframes swMark { from { background-size: 0% 40%; } to { background-size: 100% 40%; } }
@keyframes swRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes swBlur { from { opacity: 0; filter: blur(10px); } to { opacity: 1; filter: blur(0); } }
@keyframes swZoom { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes swSlide { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes swStamp { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: none; } }
@keyframes swType { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

[dir="rtl"] .sw-m-type, [lang="ur"] .sw-m-type { animation-name: swRise; }

/* A card waiting to be scrolled to stays still, so it doesn't play off screen. */
.sw-slide:not(.is-active) .sw-in, .sw-slide:not(.is-active) .sw-mark { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .sw-in, .sw-mark, .sw-spark, .sw-burst, .sw-toast { animation: none !important; }
  .sw-feed { scroll-behavior: auto; }
}
