/* Bennett flashcards — mobile-first, big-button layout
   Loaded after _shared/style.css in flashcards.html to override defaults */

.fc-stage {
  max-width: 740px; margin: 0 auto; padding: 12px 18px 120px;
}
.fc-meta {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center; font-size: 0.9rem;
}
.fc-meta .filter-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.fc-meta select {
  min-height: 44px; padding: 8px 12px; border-radius: 8px;
  background: #1a1828; color: #e2d9c3; border: 1px solid #3a3a44;
  font-family: inherit; font-size: 0.95rem; cursor: pointer; min-width: 200px;
}
.fc-meta .small { color: #888; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.fc-meta button { min-height: 44px; padding: 8px 16px; }

/* The card itself */
#flash-root { margin-top: 6px; }
.fc-card {
  position: relative; min-height: 320px;
  background: linear-gradient(160deg, #1a1828 0%, #221f33 100%);
  border: 1.5px solid #3a3a44; border-radius: 16px;
  padding: 24px 28px; cursor: pointer; user-select: none;
  box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  transition: transform 0.22s cubic-bezier(0.2,0.7,0.3,1), opacity 0.22s, border-color 0.18s;
  touch-action: pan-y; -webkit-tap-highlight-color: transparent;
}
.fc-card:hover { border-color: #b89a30; }
.fc-card.dragging { transition: none; cursor: grabbing; }
.fc-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: #b89a30;
  text-align: right; margin-bottom: 18px; opacity: 0.9;
}
.fc-side { display: none; }
.fc-card:not(.flipped) .fc-front { display: block; }
.fc-card.flipped .fc-back { display: block; }
.fc-q {
  font-family: 'Fraunces', serif; font-size: 1.75rem; line-height: 1.4;
  color: #fff; text-align: center; padding: 20px 0 44px;
}
.fc-a {
  font-size: 1.35rem; line-height: 1.55; color: #fde68a;
  text-align: center; padding: 20px 0 44px; font-weight: 500;
}
/* Treadmill (LARGE) mode — toggled via .treadmill class on body */
body.treadmill .fc-q { font-size: 2.4rem; line-height: 1.35; }
body.treadmill .fc-a { font-size: 1.8rem; line-height: 1.5; }
body.treadmill .fc-card { padding: 40px 36px; border-width: 3px; }
body.treadmill .fc-tag { font-size: 1rem; }
body.treadmill .srs-bar button { min-height: 110px; }
body.treadmill .srs-bar button .lbl { font-size: 1.7rem; }
body.treadmill .srs-bar button .keyhint { font-size: 0.95rem; }
body.treadmill .fc-meta, body.treadmill .srs-status { font-size: 1rem; }
.treadmill-toggle {
  background: #1a1828; color: #fef08a; border: 1.5px solid #b89a30;
  padding: 6px 14px; border-radius: 8px; font-family: inherit;
  cursor: pointer; min-height: 44px; font-weight: 600;
}
.treadmill-toggle:hover { background: #2a2840; }
.treadmill-toggle.active { background: #b89a30; color: #1a1828; }
.fc-hint {
  position: absolute; bottom: 16px; left: 0; right: 0;
  text-align: center; font-size: 0.78rem; color: #888;
  font-style: italic; pointer-events: none;
}
.swipe-hint {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 600;
  color: #b89a30; opacity: 0; transition: opacity 0.1s;
  pointer-events: none; text-shadow: 0 0 12px rgba(0,0,0,0.7);
}

/* Big buttons row */
.fc-controls {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px;
  margin-top: 16px;
}
.fc-controls .btn {
  min-height: 56px; padding: 10px 8px;
  font-size: 1rem; font-weight: 600;
  border-radius: 12px; border: 2px solid transparent;
  background: #2a2840; color: #e2d9c3; cursor: pointer;
  font-family: inherit; transition: transform 0.08s, background 0.15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  gap: 4px; white-space: nowrap;
}
.fc-controls .btn:active { transform: scale(0.96); }
.fc-controls .btn.prev { background: #2c2840; }
.fc-controls .btn.prev:hover { background: #3a3458; }
.fc-controls .btn.flip {
  background: linear-gradient(135deg, #b89a30, #d4b340);
  color: #1a1828; border-color: #b89a30; font-weight: 700;
}
.fc-controls .btn.flip:hover { filter: brightness(1.1); }
.fc-controls .btn.mark { background: #16412a; color: #d1fae5; }
.fc-controls .btn.mark.known { background: #1e4d35; color: #fff; }
.fc-controls .btn.mark:hover { background: #1f5238; }
.fc-controls .btn.next {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; font-weight: 700;
}
.fc-controls .btn.next:hover { filter: brightness(1.12); }

/* Mobile — sticky bottom bar, full-width thumb-zone buttons */
@media (max-width: 680px) {
  .fc-stage { padding: 8px 12px 130px; }
  .fc-meta { font-size: 0.85rem; gap: 8px; }
  .fc-meta select { width: 100%; min-width: 0; }
  .fc-meta .filter-row { width: 100%; }
  .fc-card {
    min-height: 360px; padding: 20px 18px; border-radius: 14px;
  }
  .fc-q { font-size: 1.25rem; padding: 12px 0 32px; }
  .fc-a { font-size: 1.05rem; padding: 12px 0 32px; }
  .fc-controls {
    position: fixed; left: 0; right: 0; bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(15, 15, 22, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid #2c2a3a;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 8px; margin: 0; z-index: 100;
    box-shadow: 0 -4px 18px rgba(0,0,0,0.45);
  }
  .fc-controls .btn {
    min-height: 60px;
    font-size: 0.95rem;
    border-radius: 14px;
    padding: 8px 6px;
  }
  .fc-controls .btn.prev::before { content: "← "; }
  .fc-controls .btn.next::after { content: " →"; }
  /* Hide the mark button on mobile - replaced by swipe down */
  .fc-controls .btn.mark { display: none; }
  .fc-controls .btn.flip { font-size: 1.1rem; }
  /* Add room for swipe hints — bigger card body */
  .fc-card .fc-hint { font-size: 0.7rem; bottom: 10px; }
}

/* Even smaller — phones in portrait */
@media (max-width: 400px) {
  .fc-q { font-size: 1.1rem; }
  .fc-controls .btn { font-size: 0.85rem; padding: 6px 4px; }
}

/* SRS rating bar (appears after flip) — TREADMILL-SIZED */
.srs-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 18px;
}
.srs-bar button {
  min-height: 86px; padding: 12px 8px;
  font-size: 1rem; font-weight: 700;
  border-radius: 14px; border: 3px solid transparent;
  cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}
.srs-bar button:active { transform: scale(0.94); box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.srs-bar button .lbl { font-size: 1.35rem; font-weight: 800; line-height: 1; letter-spacing: 0.02em; }
.srs-bar button .keyhint { font-size: 0.78rem; opacity: 0.85; font-family: 'JetBrains Mono', monospace; }
.srs-bar .again { background: linear-gradient(135deg, #7f1d1d, #b91c1c); color: #fee2e2; border-color: #b91c1c; }
.srs-bar .hard  { background: linear-gradient(135deg, #7c2d12, #c2410c); color: #fed7aa; border-color: #c2410c; }
.srs-bar .good  { background: linear-gradient(135deg, #14532d, #16a34a); color: #d1fae5; border-color: #16a34a; }
.srs-bar .easy  { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #dbeafe; border-color: #2563eb; }
.srs-bar button:hover { filter: brightness(1.15); }

.srs-status {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  background: #1a1828; padding: 10px 14px; border-radius: 8px;
  margin: 10px 0; color: #a5a8b8;
}
.srs-status strong { color: #fff; }
.srs-status .ok { color: #4ade80; }
.srs-status .bad { color: #f87171; }
.srs-status .info { color: #fcd34d; }

/* Help overlay */
.srs-help {
  position: fixed; inset: 0; background: rgba(8,8,16,0.92); backdrop-filter: blur(8px);
  z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.srs-help.visible { display: flex; }
.srs-help-card {
  background: #1a1828; border: 2px solid #b89a30; border-radius: 14px;
  padding: 24px 28px; max-width: 640px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.srs-help-card h3 { color: #fef08a; margin: 0 0 14px; font-size: 1.3rem; }
.srs-help-card h4 { color: #b89a30; margin: 16px 0 6px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; }
.srs-help-card .shortcut-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 5px 0;
  font-size: 0.9rem;
}
.srs-help-card .shortcut-row kbd {
  background: #2c2840; border: 1px solid #3a3a44; padding: 2px 8px;
  border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  color: #fef08a; margin-right: 4px;
}
.srs-help-card .shortcut-row span { color: #d4cba8; line-height: 1.4; }
.srs-help-card .close-row { margin-top: 18px; text-align: center; }
.srs-help-card .close-row button {
  padding: 10px 22px; border-radius: 8px; border: 1px solid #b89a30;
  background: #b89a30; color: #1a1828; font-weight: 600; font-family: inherit; cursor: pointer; font-size: 0.95rem;
}

/* Mobile SRS bar */
@media (max-width: 680px) {
  .srs-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(15,15,22,0.96); backdrop-filter: blur(12px);
    border-top: 1px solid #2c2a3a;
    gap: 6px; z-index: 100;
  }
  .srs-bar button { min-height: 68px; padding: 6px 4px; }
  .srs-bar button .lbl { font-size: 0.95rem; }
  .srs-bar button .keyhint { display: none; }
  .srs-status { font-size: 0.75rem; padding: 8px 10px; }
}

/* ============================================================
   AUTO-FIT TO VIEWPORT — everything visible without scrolling
   regardless of window size (phone portrait, phone landscape,
   tablet, laptop, ultrawide).
   - Fluid typography via clamp()
   - Card stretches to fill the available vertical room
   - SRS bar always reachable, never off-screen
   ============================================================ */

html, body { height: 100%; height: 100dvh; }
body { display: flex; flex-direction: column; max-height: 100vh; max-height: 100dvh; overflow: hidden; }
body > nav.topnav { flex-shrink: 0; }
body > header.hero { flex-shrink: 0; padding: 10px 0 6px; }
body > header.hero h1 { font-size: 1.4rem; margin: 4px 0; line-height: 1.2; }
body > header.hero .lede { font-size: 0.85rem; line-height: 1.4; margin-top: 4px; max-height: 2.8em; overflow: hidden; }
body > header.hero .eyebrow { font-size: 0.7rem; letter-spacing: 0.04em; line-height: 1.3; }
body > main.container { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body > footer.site { display: none; } /* hidden on the flashcards page so card+SRS always fit */

/* On larger screens give the hero a bit more breathing room since vertical space is plentiful */
@media (min-height: 800px) {
  body > header.hero { padding: 18px 0 10px; }
  body > header.hero h1 { font-size: 1.7rem; }
  body > header.hero .lede { font-size: 0.92rem; max-height: 4em; }
}

/* Short viewports — collapse hero to a tiny strip */
@media (max-height: 700px) {
  body > header.hero { padding: 6px 0 4px; }
  body > header.hero h1 { font-size: 1.05rem; margin: 2px 0; display: inline-block; }
  body > header.hero .lede { font-size: 0.72rem; line-height: 1.3; margin-top: 2px; max-height: 1.6em; overflow: hidden; }
  body > header.hero .eyebrow { font-size: 0.65rem; }
}
@media (max-height: 560px) {
  body > header.hero .lede { display: none; }
  body > header.hero { padding: 4px 0 2px; }
  body > header.hero h1 { font-size: 0.95rem; }
  body > header.hero .eyebrow { display: inline-block; margin-left: 10px; }
}
@media (max-height: 420px) {
  body > header.hero { display: none; } /* fully hidden when extremely tight */
}

.fc-stage {
  flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0;
  padding-bottom: 24px;
}
.fc-meta { flex-shrink: 0; }
.srs-status { flex-shrink: 0; }
#flash-root { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
body .fc-card {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.fc-q, .fc-a { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fc-side { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.fc-controls { flex-shrink: 0; }
.srs-bar { flex-shrink: 0; }

/* Fluid typography — scales with viewport but stays within sane bounds */
.fc-q { font-size: clamp(1.15rem, 1rem + 1.2vw, 2.1rem); padding: clamp(8px, 1.5vh, 24px) 0; }
.fc-a { font-size: clamp(1rem, 0.9rem + 0.9vw, 1.65rem); padding: clamp(8px, 1.5vh, 24px) 0; }
body.treadmill .fc-q { font-size: clamp(1.5rem, 1.2rem + 2vw, 2.8rem); }
body.treadmill .fc-a { font-size: clamp(1.25rem, 1rem + 1.5vw, 2.1rem); }

/* SRS buttons scale lettering with viewport too */
.srs-bar button .lbl { font-size: clamp(1rem, 0.85rem + 0.8vw, 1.45rem); }
body.treadmill .srs-bar button .lbl { font-size: clamp(1.2rem, 1rem + 1vw, 1.85rem); }

/* Compact srs-status on shortish viewports — wraps tightly, fewer dividers */
@media (max-height: 720px) {
  .srs-status { padding: 6px 12px; font-size: 0.78rem; gap: 8px; }
  .srs-status button { padding: 3px 8px; font-size: 0.72rem; min-height: 32px; }
}

/* Short viewport (landscape phone) — make everything tighter so it all fits */
@media (max-height: 600px) {
  .hero { padding: 8px 0 4px; }
  .hero h1 { font-size: 1.15rem; margin: 2px 0; }
  .hero .lede { font-size: 0.78rem; line-height: 1.3; margin-top: 4px; max-height: 2.6em; overflow: hidden; }
  .hero .eyebrow { font-size: 0.68rem; line-height: 1.2; }
  .fc-card { padding: 12px 18px; min-height: 140px; }
  .fc-q { font-size: clamp(1rem, 0.9rem + 0.8vw, 1.5rem); padding: 4px 0 8px; }
  .fc-a { font-size: clamp(0.9rem, 0.85rem + 0.5vw, 1.2rem); padding: 4px 0 8px; }
  .fc-tag { font-size: 0.7rem; margin-bottom: 6px; }
  .fc-hint { font-size: 0.65rem; bottom: 4px; }
  .srs-bar { gap: 6px; margin-top: 8px; }
  .srs-bar button { min-height: 56px; padding: 6px 4px; border-radius: 10px; }
  .srs-bar button .lbl { font-size: 0.95rem; }
  .srs-bar button .keyhint { display: none; }
  .fc-controls { gap: 6px; margin-top: 8px; }
  .fc-controls .btn { min-height: 48px; padding: 6px 8px; }
  .fc-meta { font-size: 0.75rem; gap: 6px; margin-bottom: 6px; }
  .srs-status { padding: 6px 10px; font-size: 0.72rem; }
}

/* Very short viewport (landscape with keyboard open) */
@media (max-height: 420px) {
  .hero { display: none; } /* drop the hero entirely to save room */
  .fc-card { min-height: 100px; }
  .srs-bar button { min-height: 44px; }
}

/* Wider screens — let the card breathe */
@media (min-width: 900px) {
  .fc-stage { max-width: 820px; margin: 0 auto; width: 100%; }
}

/* ============================================================
   100/100 VISUAL POLISH PASS
   3D card-flip, gradient depth, smooth transitions, progress bar,
   refined typography, sharper micro-interactions.
   ============================================================ */

/* Card chrome — richer gradient + deeper layered shadow + soft edge glow */
.fc-card {
  background:
    radial-gradient(circle at top right, rgba(184, 154, 48, 0.06), transparent 65%),
    linear-gradient(160deg, #1a1828 0%, #1f1d31 50%, #221f33 100%);
  border: 1px solid rgba(184, 154, 48, 0.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 12px 36px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.4s cubic-bezier(0.2,0.7,0.3,1.1);
  position: relative;
}
.fc-card:hover {
  border-color: rgba(184, 154, 48, 0.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 18px 48px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(184, 154, 48, 0.12);
}
/* Subtle "I just flipped" pulse */
.fc-card.flipped { animation: cardFlipIn 0.55s cubic-bezier(0.2,0.85,0.3,1.05); }
@keyframes cardFlipIn {
  0%   { transform: rotateX(8deg) scale(0.98); opacity: 0.6; }
  60%  { transform: rotateX(-1deg) scale(1.01); opacity: 1; }
  100% { transform: rotateX(0) scale(1); opacity: 1; }
}

/* Tag chip — positioned absolutely so it never overlaps card body text */
.fc-card { position: relative; }
.fc-tag {
  position: absolute; top: 12px; right: 16px;
  font-weight: 700; letter-spacing: 0.1em; font-size: 0.7rem;
  background: linear-gradient(90deg, rgba(184,154,48,0.12), rgba(184,154,48,0.02));
  padding: 4px 12px; border-radius: 999px;
  display: inline-block; float: none;
  border: 1px solid rgba(184,154,48,0.2);
  color: #fcd34d;
  max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  z-index: 2;
}
/* Push the question down so it never collides with the absolutely-positioned tag */
.fc-side { padding-top: 36px; }
@media (max-width: 680px) {
  .fc-tag { font-size: 0.62rem; max-width: 70%; }
}

/* Question typography — clearer hierarchy */
.fc-q {
  font-weight: 500; letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.fc-a {
  font-weight: 500; letter-spacing: -0.005em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color: #fef3c7;
}

/* Session progress bar (sits above status pill, fills with reviewed cards) */
.srs-status {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #1a1828, #221f33);
  border: 1px solid rgba(184, 154, 48, 0.12);
  border-radius: 10px;
}
.srs-status::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--session-progress, 0%);
  background: linear-gradient(90deg, rgba(184, 154, 48, 0.18), rgba(184, 154, 48, 0.08));
  transition: width 0.4s cubic-bezier(0.2,0.85,0.3,1);
  z-index: 0; pointer-events: none;
}
.srs-status > * { position: relative; z-index: 1; }

/* SRS bar buttons — refined gradients with inner highlight */
.srs-bar button {
  position: relative; isolation: isolate;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 -1px 0 rgba(0, 0, 0, 0.2) inset,
    0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.srs-bar button:hover {
  filter: brightness(1.18) saturate(1.05);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 -1px 0 rgba(0, 0, 0, 0.2) inset,
    0 8px 20px rgba(0, 0, 0, 0.55);
}
.srs-bar button:active {
  transform: scale(0.95);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.2) inset,
    0 2px 4px rgba(0, 0, 0, 0.4);
}
/* Focus ring for keyboard accessibility */
.srs-bar button:focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
}

/* Treadmill button polish */
.treadmill-toggle {
  background: linear-gradient(180deg, rgba(184,154,48,0.08), rgba(184,154,48,0.02));
  transition: background 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
}
.treadmill-toggle:hover {
  background: linear-gradient(180deg, rgba(184,154,48,0.18), rgba(184,154,48,0.08));
  box-shadow: 0 4px 12px rgba(184, 154, 48, 0.2);
}
.treadmill-toggle.active {
  background: linear-gradient(180deg, #d4b340, #b89a30);
  color: #1a1828; border-color: #b89a30;
  box-shadow: 0 4px 14px rgba(184, 154, 48, 0.4);
}

/* Filter dropdown refined */
.fc-meta select {
  background: linear-gradient(180deg, #1f1d31, #161426);
  border: 1px solid rgba(184, 154, 48, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.fc-meta select:hover, .fc-meta select:focus {
  border-color: rgba(184, 154, 48, 0.45);
  box-shadow: 0 2px 10px rgba(184, 154, 48, 0.15);
}

/* SRS pill — subtle gradient + smooth state changes */
.srs-pill {
  background: linear-gradient(180deg, #1a1828, #221f33) !important;
  border: 1px solid rgba(184, 154, 48, 0.15);
  transition: border-color 0.25s ease;
}

/* Card counter — monospace with subtle dot separator */
#card-counter { font-family: 'JetBrains Mono', monospace; color: #b89a30; font-weight: 500; }
#known-counter { font-family: 'JetBrains Mono', monospace; color: #888; }

/* Topbar refinement — subtle bottom edge */
nav.topnav { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35); }

/* Rating toast — improved animation */
@keyframes pop {
  0%   { transform: translate(-50%, -50%) scale(0.7) rotate(-3deg); opacity: 0; }
  35%  { transform: translate(-50%, -50%) scale(1.12) rotate(1deg); opacity: 1; }
  65%  { transform: translate(-50%, -50%) scale(0.98) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}

/* Help overlay polish */
.srs-help-card {
  background: radial-gradient(circle at top right, rgba(184,154,48,0.06), transparent 60%),
    linear-gradient(180deg, #1a1828 0%, #1f1d31 100%);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(184, 154, 48, 0.15);
}
.srs-help-card .shortcut-row {
  transition: background 0.15s ease;
  border-radius: 4px;
  padding: 6px 8px;
}
.srs-help-card .shortcut-row:hover { background: rgba(184, 154, 48, 0.05); }

/* Shortcut editor overlay */
.kb-editor { position: fixed; inset: 0; background: rgba(8,8,16,0.92); backdrop-filter: blur(8px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.kb-editor.visible { display: flex; }
.kb-card { background: linear-gradient(180deg, #1a1828 0%, #1f1d31 100%); border: 2px solid #b89a30; border-radius: 14px; padding: 22px 26px; max-width: 720px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 72px rgba(0,0,0,0.75); }
.kb-card h3 { color: #fef08a; margin: 0 0 6px; font-size: 1.3rem; }
.kb-card .sub { color: #aaa; font-size: 0.85rem; margin-bottom: 16px; }
.kb-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed #2c2a3a; }
.kb-row .label { color: #fff; font-size: 0.95rem; }
.kb-row .chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 220px; }
.kb-chip { background: #2c2840; border: 1px solid #3a3a44; color: #fde047; padding: 3px 8px; border-radius: 6px; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; cursor: pointer; transition: background 0.15s; }
.kb-chip:hover { background: #3a3458; }
.kb-chip .x { color: #f87171; margin-left: 4px; opacity: 0.6; }
.kb-chip:hover .x { opacity: 1; }
.kb-add { background: rgba(184,154,48,0.15); border: 1px dashed #b89a30; color: #fde047; padding: 3px 10px; border-radius: 6px; font-family: inherit; font-size: 0.78rem; cursor: pointer; min-height: 28px; }
.kb-add:hover { background: rgba(184,154,48,0.3); }
.kb-add.recording { background: #b91c1c; color: #fff; border-color: #b91c1c; animation: kbRecord 0.6s infinite alternate; }
@keyframes kbRecord { from { box-shadow: 0 0 0 0 rgba(220,38,38,0.6); } to { box-shadow: 0 0 14px 4px rgba(220,38,38,0.3); } }
.kb-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 18px; }
.kb-actions button { padding: 9px 18px; border-radius: 8px; border: 1px solid #3a3a44; background: #2a2840; color: #e2d9c3; cursor: pointer; font-family: inherit; font-weight: 600; }
.kb-actions button.primary { background: #b89a30; color: #1a1828; border-color: #b89a30; }
.kb-actions button:hover { filter: brightness(1.1); }
.kb-record-help { background: #2a1a0e; color: #fed7aa; padding: 10px 14px; border-radius: 6px; font-size: 0.85rem; margin: 10px 0; }

/* Remote-key indicator — shows the last keystroke received from the Swiftpoint */
.remote-indicator {
  position: fixed; top: 14px; right: 14px; z-index: 200;
  background: rgba(20, 18, 28, 0.92); border: 1.5px solid rgba(184, 154, 48, 0.4);
  color: #fde047; padding: 6px 12px; border-radius: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  pointer-events: none; opacity: 0;
  transition: opacity 0.18s ease, transform 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.remote-indicator.visible { opacity: 1; transform: scale(1.08); animation: remotePop 0.5s ease-out; }
@keyframes remotePop {
  0%   { transform: scale(0.7); opacity: 0; }
  30%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.remote-indicator .label { color: #aaa; margin-right: 6px; }
.remote-indicator .key { color: #fef08a; font-weight: 700; }
.remote-indicator .action { color: #4ade80; margin-left: 6px; font-weight: 600; }

/* Larger toast for treadmill mode */
body.treadmill .rating-toast {
  font-size: 3rem !important; padding: 30px 60px !important; border-width: 4px !important;
}

/* Body needs to be focusable so keystrokes register without click */
body:focus { outline: none; }

/* Help hint shown briefly on mobile load */
.fc-mobile-hint {
  position: fixed; bottom: 90px; left: 12px; right: 12px;
  background: rgba(184, 154, 48, 0.95); color: #1a1828;
  padding: 12px 16px; border-radius: 10px; font-size: 0.88rem;
  font-weight: 500; text-align: center; z-index: 99;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  animation: fc-hint-fade 5s ease forwards;
}
@keyframes fc-hint-fade {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); pointer-events: none; }
}
