.page-container:has(.stumble) {
  justify-content: flex-start;
  min-height: 0;
}

.stumble {
  --sb-bg: #0b74bf;
  --sb-ink: #fff;
  --sb-soft: rgba(255, 255, 255, 0.14);
  --sb-soft-hover: rgba(255, 255, 255, 0.24);
  --sb-lime: #bada55;
  --sb-love: #ff5d8f;
  --sb-nope: #ff8a5c;
  width: 100%;
  font-family: 'Nunito', sans-serif;
}

html.dark-mode .stumble {
  --sb-bg: #1f3b57;
  --sb-soft: rgba(186, 218, 85, 0.1);
  --sb-soft-hover: rgba(186, 218, 85, 0.2);
}

.stumble button,
.stumble a,
.sb-sheet button,
.sb-sheet a {
  margin: 0;
  box-shadow: none;
  text-transform: none;
}

.stumble a:hover,
.sb-sheet button:hover { text-decoration: none; }

.sb-sheet h2,
.sb-sheet h3 { text-transform: none; letter-spacing: 0; }

.sb-sheet p { margin: 0; overflow: visible; }

.sb-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "prev info next"
    "acts acts acts";
  align-items: center;
  gap: 6px 8px;
  padding: 6px 8px 8px;
  background: var(--sb-bg);
  color: var(--sb-ink);
  border-bottom: 3px solid var(--sb-lime);
}

.sb-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: var(--sb-lime);
  color: #0b5285;
  font: 700 1rem 'Original Surfer', cursive;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.sb-nav:hover { background: #a6c947; }
.sb-nav:active { transform: scale(0.94); }
.sb-prev { grid-area: prev; }
.sb-next { grid-area: next; }
.sb-next-label { display: none; }

.sb-info {
  grid-area: info;
  min-width: 0;
  text-align: center;
  line-height: 1.2;
}

.sb-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--sb-ink);
  font: 400 1.05rem 'Original Surfer', cursive;
  text-decoration: none;
}

.sb-title:hover { text-decoration: underline; }

.sb-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 2px;
  font-size: 0.78rem;
  opacity: 0.88;
}

.sb-meta span:empty { display: none; }

.sb-actions {
  grid-area: acts;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.sb-act {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  border-radius: 10px;
  background: var(--sb-soft);
  color: var(--sb-ink);
  font: 700 0.72rem 'Nunito', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.sb-act:hover { background: var(--sb-soft-hover); }
.sb-act:active { transform: scale(0.94); }
.sb-act svg { flex: none; }
.sb-act:disabled { opacity: 0.45; cursor: default; }

.sb-like[aria-pressed="true"] { color: var(--sb-love); background: #fff; }
.sb-like[aria-pressed="true"] svg { fill: currentColor; }
.sb-dislike[aria-pressed="true"] { color: var(--sb-nope); background: #fff; }
html.dark-mode .sb-like[aria-pressed="true"],
html.dark-mode .sb-dislike[aria-pressed="true"] { background: #13263a; }

.sb-pop svg { animation: sb-pop 0.45s ease; }
@keyframes sb-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.sb-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sb-love);
  color: #fff;
  font-size: 0.68rem;
  line-height: 18px;
}

.sb-badge[hidden] { display: none; }

.sb-act:focus-visible,
.sb-nav:focus-visible,
.sb-title:focus-visible {
  outline: 3px solid var(--sb-lime);
  outline-offset: 2px;
}

.sb-stage {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height, 0px) - var(--sb-h, 120px) - var(--bottom-nav-height, 0px));
  height: calc(100dvh - var(--header-height, 0px) - var(--sb-h, 120px) - var(--bottom-nav-height, 0px));
  min-height: 320px;
  background: #fff;
  overflow: hidden;
}

#weird-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.sb-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 2;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.sb-loading::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--sb-lime);
  animation: sb-load 1s ease-in-out infinite;
}

.stumble.is-loading .sb-loading { opacity: 1; }

@keyframes sb-load {
  from { left: -40%; }
  to { left: 100%; }
}

.sb-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(20, 30, 40, 0.92);
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  animation: sb-toast-in 0.2s ease;
}

.sb-toast[hidden] { display: none; }

.sb-toast button {
  flex: none;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--sb-lime);
  color: #0b5285;
  font-weight: 800;
  cursor: pointer;
}

.sb-toast button[hidden] { display: none; }

@keyframes sb-toast-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.sb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 24px;
  text-align: center;
  color: #333;
}

.sb-sheet {
  width: min(460px, calc(100% - 24px));
  max-height: min(640px, calc(100dvh - 40px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #1d2a36;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: 'Nunito', sans-serif;
}

html.dark-mode .sb-sheet {
  background: #22313f;
  color: #d3d3d3;
}

.sb-sheet[open] {
  display: flex;
  flex-direction: column;
}

.sb-sheet > .sb-report-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sb-sheet::backdrop { background: rgba(8, 14, 20, 0.6); }

.sb-sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px 18px;
  border-bottom: 3px solid #bada55;
}

.sb-sheet-head h2 {
  flex: 1;
  margin: 0;
  font: 400 1.3rem 'Original Surfer', cursive;
  color: #0b74bf;
}

html.dark-mode .sb-sheet-head h2 { color: #bada55; }

.sb-close {
  display: inline-grid;
  place-items: center;
  padding: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.sb-close:hover { background: rgba(11, 116, 191, 0.1); }

.sb-sheet-body {
  overflow-y: auto;
  padding: 6px 18px 18px;
  overscroll-behavior: contain;
}

.sb-sec { padding: 12px 0; border-bottom: 1px solid rgba(11, 116, 191, 0.15); }
html.dark-mode .sb-sec { border-color: rgba(186, 218, 85, 0.15); }
.sb-sec[hidden] { display: none; }

.sb-sec h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
}

.sb-muted { opacity: 0.65; font-weight: 600; }

.sb-hint {
  margin: 6px 0 0;
  font-size: 0.88rem;
  opacity: 0.85;
}

.sb-hint[hidden] { display: none; }

.sb-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sb-progress {
  height: 10px;
  margin-top: 8px;
  border-radius: 5px;
  background: rgba(11, 116, 191, 0.12);
  overflow: hidden;
}

.sb-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0b74bf, #bada55);
  transition: width 0.4s ease;
}

.sb-link {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: #0b74bf;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

html.dark-mode .sb-link { color: #bada55; }

.sb-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(11, 116, 191, 0.1);
}

.sb-seg label { position: relative; cursor: pointer; }
.sb-seg input { position: absolute; opacity: 0; pointer-events: none; }

.sb-seg span {
  display: block;
  padding: 9px 6px;
  border-radius: 9px;
  text-align: center;
  font-weight: 800;
}

.sb-seg input:checked + span { background: #0b74bf; color: #fff; }
html.dark-mode .sb-seg input:checked + span { background: #bada55; color: #1f3b57; }
.sb-seg input:focus-visible + span { outline: 3px solid #bada55; }

.sb-favs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sb-favs li {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
}

.sb-favs li + li { margin-top: 2px; }

.sb-fav-go {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.sb-fav-go:hover { background: rgba(11, 116, 191, 0.08); }
.sb-fav-go strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-fav-go small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: 0.65; }

.sb-fav-x {
  flex: none;
  display: inline-grid;
  place-items: center;
  padding: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #ff5d8f;
  cursor: pointer;
}

.sb-fav-x:hover { background: rgba(255, 93, 143, 0.12); }
.sb-fav-x svg { fill: currentColor; }

.sb-submit { margin: 14px 0 0; font-size: 0.9rem; text-align: center; }

.sb-report-site { margin-top: 10px; font-weight: 700; overflow-wrap: anywhere; }

.sb-reasons {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.sb-reasons label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid rgba(11, 116, 191, 0.18);
  border-radius: 12px;
  cursor: pointer;
}

.sb-reasons label:has(input:checked) { border-color: #0b74bf; background: rgba(11, 116, 191, 0.07); }
html.dark-mode .sb-reasons label { border-color: rgba(186, 218, 85, 0.2); }
html.dark-mode .sb-reasons label:has(input:checked) { border-color: #bada55; background: rgba(186, 218, 85, 0.08); }
.sb-reasons input { margin-top: 3px; accent-color: #0b74bf; }

.sb-note-label { display: block; margin-bottom: 4px; font-weight: 700; font-size: 0.9rem; }

.sb-report textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 2px solid rgba(11, 116, 191, 0.25);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  resize: vertical;
}

.sb-report-error { min-height: 1.2em; margin: 8px 0 0; color: #d33; font-size: 0.88rem; }

.sb-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.sb-btn,
.sb-btn-ghost {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  font: 800 0.95rem 'Nunito', sans-serif;
  cursor: pointer;
}

.sb-btn { background: #0b74bf; color: #fff; }
.sb-btn:disabled { opacity: 0.6; cursor: default; }
.sb-btn-ghost { background: transparent; color: inherit; }
.sb-btn-ghost:hover { background: rgba(11, 116, 191, 0.08); }

html.dark-mode .stumble .sb-nav,
html.dark-mode .stumble .sb-nav:hover { background: #bada55 !important; color: #1f3b57 !important; }
html.dark-mode .stumble .sb-act { background: var(--sb-soft) !important; color: #fff !important; }
html.dark-mode .stumble .sb-act:hover { background: var(--sb-soft-hover) !important; }
html.dark-mode .stumble .sb-like[aria-pressed="true"] { background: #13263a !important; color: var(--sb-love) !important; }
html.dark-mode .stumble .sb-dislike[aria-pressed="true"] { background: #13263a !important; color: var(--sb-nope) !important; }
html.dark-mode .stumble .sb-title { color: #fff !important; }
html.dark-mode .stumble .sb-toast button { background: #bada55 !important; color: #1f3b57 !important; }
html.dark-mode .sb-sheet .sb-close,
html.dark-mode .sb-sheet .sb-fav-go,
html.dark-mode .sb-sheet .sb-btn-ghost,
html.dark-mode .sb-sheet .sb-link { background: transparent !important; color: inherit !important; }
html.dark-mode .sb-sheet .sb-link { color: #bada55 !important; }
html.dark-mode .sb-sheet .sb-fav-x { background: transparent !important; color: #ff5d8f !important; }
html.dark-mode .sb-sheet .sb-btn { background: #bada55 !important; color: #1f3b57 !important; }
html.dark-mode .sb-sheet .sb-submit a { color: #bada55 !important; }
html.dark-mode .sb-sheet textarea { background: #1b2733 !important; color: #e8e8e8 !important; border: 2px solid rgba(186, 218, 85, 0.3) !important; }
html.dark-mode .sb-sheet p { color: inherit !important; }

@media (max-width: 600px) {
  .sb-sheet {
    width: 100%;
    max-width: none;
    max-height: 85dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sb-sheet[open] { animation: sb-sheet-up 0.22s ease; }

  @keyframes sb-sheet-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

@media (min-width: 900px) {
  .sb-bar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "prev info acts next";
    gap: 10px;
    padding: 6px 10px;
  }

  .sb-actions {
    display: flex;
    gap: 6px;
  }

  .sb-act {
    flex-direction: row;
    gap: 6px;
    padding: 0 12px;
    font-size: 0.85rem;
  }

  .sb-badge { position: static; }

  .sb-info { text-align: left; }
  .sb-meta { justify-content: flex-start; }
  .sb-title { font-size: 1.2rem; }

  .sb-next { padding: 0 14px 0 18px; }
  .sb-next-label { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-pop svg,
  .sb-sheet[open],
  .sb-toast { animation: none; }
  .sb-loading::before { animation-duration: 3s; }
}
