/* Peak feed: one Peak per screen, swipe up/down. The angles fill the whole
   screen (1 or 2 upright, 1 to 4 sideways) and the controls float on top. */
html, body.feed-body { height: 100%; overflow: hidden; background: #000; }
.feed { height: 100vh; height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }

.slide { position: relative; height: 100vh; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000; }

/* Angle grid: the whole screen, 2px between angles */
.stage { position: absolute; inset: 0; display: grid; gap: 2px; grid-template: 1fr / 1fr; }
.stage.n2 { grid-template: 1fr 1fr / 1fr; }
@media (orientation: landscape) {
  .stage.n2 { grid-template: 1fr / 1fr 1fr; }
  .stage.n3 { grid-template: 1fr 1fr / 2fr 1fr; }
  .stage.n3 .ang:first-child { grid-row: 1 / 3; }
  .stage.n4 { grid-template: 1fr 1fr / 1fr 1fr; }
}
.ang { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0b0f0d; touch-action: pan-y; }
/* Fill (default) crops to use every pixel; Fit shows the whole picture */
.ang video, .ang img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
body.fit .ang video, body.fit .ang img { object-fit: contain; }
.ang img { transition: opacity .2s; }
.ang.playing img { opacity: 0; }
/* The angle you hear, when more than one is on screen */
.ang.lead::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--mint); pointer-events: none; }
.ang .tag { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 8px; background: rgba(0,0,0,.55); color: var(--ink); font-size: 11px; font-weight: 700; pointer-events: none; }
.ang.top .tag { top: calc(max(8px, env(safe-area-inset-top)) + 46px); }

/* Bottom left: name buttons, then the caption */
.foot { position: absolute; left: 10px; right: 60px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.names { display: flex; gap: 6px; flex-wrap: wrap; }
.names button { height: 30px; padding: 0 11px; border-radius: 15px; border: 0; background: rgba(0,0,0,.5); color: var(--ink); font-size: 12px; font-weight: 700; }
.names button[aria-pressed="true"] { background: rgba(244,241,232,.85); color: #0A120E; }
.names button.lead { box-shadow: 0 0 0 2px var(--mint); }
.cap { color: var(--ink); font-size: 13px; line-height: 1.35; text-shadow: 0 1px 3px rgba(0,0,0,.85); pointer-events: none; }
.cap b { font-size: 14px; }
.cap span { display: block; color: #d6e2db; font-size: 12px; }

/* Small rail, right side */
.rail { position: absolute; right: 6px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rail button, .rail a { width: 40px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; font-weight: 700; text-decoration: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.9)); }
.rail svg { width: 22px; height: 22px; }
.rail .moment[aria-pressed="true"] { color: #FFB238; }
.rail .moment[aria-pressed="true"] svg { fill: currentColor; }
.rail .sound { width: 34px; height: 34px; min-height: 34px; border-radius: 50%; background: rgba(0,0,0,.4) url(/static/monkey-hear.png) center / 26px auto no-repeat; }
.rail .sound.off { background-image: url(/static/monkey-speak.png); }
.rail .save[aria-pressed="true"] svg { color: var(--mint); fill: var(--mint); }
@media (orientation: landscape) and (max-height: 500px) { .rail { gap: 2px; } .rail button, .rail a { min-height: 36px; } }

/* Top bar: home (same spot and icon as everywhere), Random / Sessions, 1-4 */
.f-top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 8px; pointer-events: none; }
.f-top > * { pointer-events: auto; }
.f-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(0,0,0,.45); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.f-icon svg { width: 18px; height: 18px; }
.f-tabs { display: flex; gap: 14px; }
.f-tabs a { color: #d6e2db; font-size: 14px; font-weight: 700; text-decoration: none; padding: 6px 2px; text-shadow: 0 1px 3px rgba(0,0,0,.85); }
.f-tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--mint); }
.f-layout { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(0,0,0,.45); }
.f-layout button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--ink); font-size: 13px; font-weight: 700; }
.f-layout button[aria-pressed="true"] { background: var(--ink); color: #0A120E; }
@media (orientation: portrait) { .f-layout .wide-only { display: none; } }
body.picking .f-layout { visibility: hidden; }

/* Everything on top of the video fades after a few seconds without a touch */
.fade { transition: opacity .35s; }
body.idle .fade { opacity: 0; pointer-events: none; }
body.idle .f-top > * { pointer-events: none; }

/* Double-tap Peak Moment burst */
.burst { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #FFB238; pointer-events: none; animation: burst .7s ease-out forwards; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.burst svg { width: 100%; height: 100%; fill: currentColor; }
@keyframes burst { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.paused-mark { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; padding: 0; border: 2px solid rgba(244,241,232,.35); border-radius: 50%; background: rgba(0,0,0,.55); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; -webkit-tap-highlight-color: transparent; }
.paused-mark svg { width: 34px; height: 34px; margin-left: 4px; }
.paused-mark:active { transform: scale(.94); }
/* Paused: a hand presses, then slides one way and back (hold-then-slide to scrub). */
.scrub-hint { position: absolute; left: 50%; top: calc(50% + 56px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 3; animation: sh-fade 4.2s ease forwards; }
.sh-track { position: relative; width: 132px; height: 46px; }
.sh-track::before { content: ""; position: absolute; left: 10px; right: 10px; top: 12px; height: 3px; border-radius: 2px; background: rgba(244,241,232,.35); }
.sh-hand { position: absolute; left: 50%; top: 0; width: 38px; height: 38px; margin-left: -12px; animation: sh-move 2s ease-in-out 2; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.sh-hand svg { width: 100%; height: 100%; }
.sh-hand::before { content: ""; position: absolute; left: 9px; top: -4px; width: 18px; height: 18px; margin: 0; border-radius: 50%; background: rgba(52,211,153,.55); transform: scale(0); animation: sh-press 2s ease-out 2; }
.sh-text { padding: 5px 11px; border-radius: 10px; background: rgba(0,0,0,.6); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
@media (orientation: landscape) { .scrub-hint { top: auto; bottom: calc(50% + 50px); flex-direction: column-reverse; } }
@keyframes sh-move { 0%, 18% { transform: translateX(0) scale(1); } 10% { transform: translateX(0) scale(.9); } 45% { transform: translateX(42px) scale(.9); } 75% { transform: translateX(-42px) scale(.9); } 92%, 100% { transform: translateX(0) scale(1); } }
@keyframes sh-press { 0% { transform: scale(0); opacity: 1; } 18% { transform: scale(1.6); opacity: .9; } 30%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes sh-fade { 0% { opacity: 0; } 8%, 85% { opacity: 1; } 100% { opacity: 0; } }
.buf { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 3px solid rgba(244,241,232,.25); border-top-color: var(--mint); animation: spin .9s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .burst { animation-duration: .01s; } .sh-hand, .sh-hand::before { animation: none; } }

/* End of the feed */
.end { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: var(--ink); background: var(--bg); }
.end .btn { min-width: 200px; }

/* Session picker */
.f-list { position: fixed; inset: 0; overflow-y: auto; background: var(--bg); padding: calc(max(8px, env(safe-area-inset-top)) + 56px) 14px 32px; }
.f-list h1 { font-size: 20px; margin: 0 0 12px; }
.f-sessions { display: flex; flex-direction: column; gap: 8px; }
.f-sess { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.f-sess .th { width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; background: var(--bg); }
.f-sess b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-sess span { display: block; font-size: 12px; color: var(--muted); }
.f-sess .live { color: var(--live); font-weight: 700; }
body.picking .f-top { background: var(--bg); }
.f-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.f-search { flex: 1 1 200px; height: 44px; border-radius: 22px; }
.f-sort { flex: none; background: var(--panel); border: 1px solid var(--line); }

/* In the app, the tab bar does Home, Random and Sessions. */
.in-shell .f-tabs { display: none; }
.in-shell body:not(.one) #homeBtn { display: none; }
.in-shell .f-top { justify-content: flex-end; }
.in-shell body.one .f-top { justify-content: space-between; }
.in-shell body.picking .f-top { display: none; }
.in-shell .f-list { padding-top: 16px; }

.f-msg { position: fixed; left: 16px; right: 16px; top: 40%; z-index: 4; text-align: center; color: var(--muted); font-size: 14px; }

/* Report sheet */
.f-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.f-sheet-in { width: 100%; background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.f-sheet-in p { margin: 0; }
.f-reasons { display: flex; flex-direction: column; gap: 6px; }
.f-reasons button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; }
.toast-wrap { z-index: 40; }

/* Mic: the angle whose sound you hear (name button and name tag) */
.names button { display: inline-flex; align-items: center; gap: 5px; }
.mic { width: 13px; height: 13px; flex: none; vertical-align: -2px; }
.ang .tag .mic { margin-right: 4px; color: var(--mint); }
/* 1-4: numbers this Peak can't fill (it has fewer angles) */
.f-layout button.na { opacity: .35; }

/* Thin progress bar; thicker with a time bubble while you hold and slide */
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(244,241,232,.18); pointer-events: none; }
.prog i { display: block; height: 100%; width: 0; background: var(--mint); }
.slide.scrubbing .prog { height: 6px; }
.scrub-time { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 8px 14px; border-radius: 12px; background: rgba(0,0,0,.7); color: var(--ink); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; z-index: 3; }
.slide { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
