/* circleranks.com/try: the app's DVD shelf (lib/ratings/rating_deck/dvd/),
   from James's mock (dev/active/dvd-browse-onboarding-mock.html). Every class
   is tr- prefixed or scoped under .tr so site.css never reaches the shelf and
   the shelf never reaches the rest of the site. Rating colors are the app's
   (CRColors.forRating). */
.tr {
  --tr-card: #171C23; --tr-line: #3A424D; --tr-muted: #9AA3AE; --tr-red: #E34234;
  /* Case size before the script measures the screen (try.js fit() then makes
   the cases as big as the room left above the slider allows). */
  --w: clamp(128px, min(62vw, calc((100svh - 470px) / 1.42)), 250px);
  --h: calc(var(--w) * 1.42);
  --t: 18px; /* case thickness: thinner than the app's 26 (kDvdThickness), James 11-18 */
  line-height: normal;
}
.tr [hidden] { display: none !important; }
.tr :focus-visible { outline: 2px solid var(--tr-red); outline-offset: 3px; }
.tr button { font-family: inherit; color: inherit; cursor: pointer; }

.tr-app {
  min-height: calc(100dvh - 64px); max-width: 430px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px; overflow: hidden;
  padding: 14px max(18px, env(safe-area-inset-right, 0px)) 22px max(18px, env(safe-area-inset-left, 0px));
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.tr-head { text-align: center; }
.tr-h1 { margin: 0; font-size: clamp(19px, 5.4vw, 24px); font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }

/* ---------- The shelf ---------- */
.tr-stage { position: relative; height: calc(var(--h) + 22px); perspective: 1100px; touch-action: pan-y; outline: none; }
.tr-stage:focus-visible { outline: 2px solid var(--tr-red); outline-offset: 2px; border-radius: 8px; }
.tr-case {
  position: absolute; left: 50%; top: 4px; width: var(--w); height: var(--h); margin-left: calc(var(--w) / -2);
  transform-style: preserve-3d; transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .3s; will-change: transform; cursor: pointer;
}
.tr-stage.dragging .tr-case, .tr-stage.dragging .tr-floor, .tr-stage.dragging .tr-gloss { transition: none; }
.tr-stage.fast .tr-case { transition-duration: .19s; }
.tr-floor {
  position: absolute; left: 2%; right: 2%; bottom: -18px; height: 22px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,0,.8), transparent);
  transform: translateZ(calc(var(--t) / -2 - 1px)) translateX(var(--sx, 0)) scaleX(var(--ss, 1));
  opacity: var(--so, .9); transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .38s;
}
.tr-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3,.9,.3,1); }
.tr-case.flipped .tr-inner { transform: rotateY(180deg); }

/* The plastic case: front, back, spine (left) and the three other edges. */
.tr-edge { position: absolute; border-radius: 6px; }
.tr-spine {
  left: 0; top: 0; width: var(--t); height: 100%;
  transform: translateX(calc(var(--t) / -2)) rotateY(-90deg);
  background: linear-gradient(#3a4049, #0b0d10);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.tr-spine i { flex: none; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--tr-red); }
.tr-spine span { flex: 1; min-height: 0; overflow: hidden; writing-mode: vertical-rl; font-size: 8.5px; letter-spacing: 1.3px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; color: #E8EAED; }
.tr-spine em { flex: none; writing-mode: vertical-rl; font-style: normal; font-size: 7.5px; letter-spacing: 1px; font-weight: 600; color: rgba(255,255,255,.6); }
.tr-edge.r { right: 0; top: 0; width: var(--t); height: 100%; transform: translateX(calc(var(--t) / 2)) rotateY(90deg); background: linear-gradient(90deg, #2b323c 0 40%, #07090b 40% 60%, #2b323c 60%); }
.tr-edge.t { left: 0; top: 0; width: 100%; height: var(--t); transform: translateY(calc(var(--t) / -2)) rotateX(90deg); background: #1b2027; }
.tr-edge.b { left: 0; bottom: 0; width: 100%; height: var(--t); transform: translateY(calc(var(--t) / 2)) rotateX(-90deg); background: #07090b; }
.tr-face {
  position: absolute; inset: 0; border-radius: 6px; overflow: hidden; background: #050607;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* The black plastic edge around the art: 4px, 7px on the spine side. */
.tr-face::after { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none; box-shadow: inset 0 0 0 4px #050607, inset 0 0 0 5px rgba(255,255,255,.1); }
.tr-front { transform: translateZ(calc(var(--t) / 2)); }
.tr-front::before { content: ""; position: absolute; inset: 0; z-index: 3; background: #000; opacity: var(--dim, 0); transition: opacity .3s; pointer-events: none; }
.tr-case.skipped .tr-front::before { opacity: .55; }
.tr-poster { position: absolute; top: 4px; bottom: 4px; left: 7px; right: 4px; width: calc(100% - 11px); height: calc(100% - 8px); object-fit: cover; pointer-events: none; border-radius: 2px; }
.tr-front-text { position: absolute; left: 14px; right: 12px; bottom: 16px; }
.tr-front-text b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.tr-front-text span { display: block; margin-top: 6px; font-size: 11px; letter-spacing: 2px; font-weight: 600; color: rgba(255,255,255,.7); }
.tr-hinge { position: absolute; z-index: 1; top: 0; bottom: 0; left: 6px; width: 2px; background: linear-gradient(90deg, rgba(0,0,0,.5), rgba(255,255,255,.14) 50%, rgba(0,0,0,.4)); pointer-events: none; }
.tr-gloss {
  position: absolute; z-index: 1; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(112deg, transparent 30%, rgba(255,255,255,.04) 38%, rgba(255,255,255,.2) 46%, rgba(255,255,255,.05) 52%, transparent 60%),
              linear-gradient(112deg, transparent 58%, rgba(255,255,255,.07) 63%, transparent 68%);
  background-size: 260% 100%; background-position: var(--gx, 50%) 0; opacity: var(--go, .8);
  transition: background-position .38s cubic-bezier(.2,.8,.2,1), opacity .38s;
}
/* Your rating, stuck on like a price tag: just the number, flat, in the rating's color. */
.tr-sticker {
  position: absolute; z-index: 2; top: 12px; right: 12px; min-width: 52px; padding: 6px 8px;
  border-radius: 4px; background: var(--mine, var(--tr-red)); color: #fff; text-align: center;
  font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  transform: rotate(6deg) scale(.4); opacity: 0; transition: transform .35s cubic-bezier(.3,1.6,.4,1), opacity .2s;
}
.tr-case.rated .tr-sticker { transform: rotate(6deg) scale(1); opacity: 1; }

/* The back, laid out like a real DVD back. Rows hide when the data has none. */
.tr-back { transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); display: flex; flex-direction: column; background: #0b0e12; }
.tr-bbg { position: absolute; inset: -12px; background-size: cover; background-position: center; filter: blur(10px) brightness(.3) saturate(1.2); transform: scale(1.1); }
.tr-back > *:not(.tr-bbg) { position: relative; }
/* The back's contents at a fixed 240 x 341 (a case's shape), scaled to the
   case by --bs (set by try.js), so nothing on it is ever cut off. */
.tr-back .tr-bk { position: absolute; left: 0; top: 0; width: 240px; height: 341px; display: flex; flex-direction: column; transform-origin: 0 0; transform: scale(var(--bs, 1)); }
.tr-bart {
  flex: none; height: 30%; margin: 4px 4px 0 4px; border-radius: 3px 3px 0 0; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1px;
  background-color: #1b2027; background-size: cover; background-position: center;
}
.tr-bart b { font-size: 16px; font-weight: 800; line-height: 1.1; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.tr-bart span { font-size: 10px; letter-spacing: 2px; font-weight: 600; color: rgba(255,255,255,.85); text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.tr-bbody { flex: 1; min-height: 0; padding: 10px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.tr-sum { margin: 0; font-size: 10.5px; line-height: 1.4; color: rgba(255,255,255,.85); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tr-credits { font-size: 7.5px; line-height: 1.55; letter-spacing: 1.1px; color: rgba(255,255,255,.62); text-align: center; font-weight: 500; text-transform: uppercase; }
.tr-credits b { color: #fff; font-weight: 800; }
.tr-bfoot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.tr-rbox { display: flex; align-items: stretch; border: 1.5px solid #fff; border-radius: 2px; background: rgba(0,0,0,.5); }
.tr-rbox strong { display: flex; align-items: center; padding: 0 7px; font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; background: var(--tier); color: #fff; }
.tr-rbox div { padding: 4px 6px; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.tr-rbox div b { font-size: 7.5px; letter-spacing: 1.2px; font-weight: 800; }
.tr-rbox div span { font-size: 8px; color: rgba(255,255,255,.75); }
.tr-barcode { flex: none; width: 46px; height: 28px; background: #fff; padding: 3px 3px 7px; }
.tr-barcode i { display: block; height: 100%; background: repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 2px, #000 2px 4px, transparent 4px 5px, #000 5px 6px, transparent 6px 8px); }
.tr-fine { font-size: 6.5px; letter-spacing: .6px; color: rgba(255,255,255,.45); text-align: center; }

/* First-open hint labels, over the middle case. */
.tr-label {
  position: absolute; left: 50%; top: calc(4px + var(--h) / 2); z-index: 500; transform: translate(-50%, -50%);
  padding: 7px 12px; border-radius: 16px; background: rgba(0,0,0,.72); color: #fff; font-size: 13px; font-weight: 700;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .25s;
}
.tr-label.on { opacity: 1; }

/* ---------- Under the cases (the onboarding deck's own pieces) ---------- */
.tr-rate { display: flex; flex-direction: column; gap: 2px; --rc: #5b6470; --rcg: transparent; }
.tr-info { display: flex; align-items: center; gap: 14px; }
.tr-info-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tr-avg { font-size: 13px; color: var(--tr-muted); margin-bottom: 3px; min-height: 16px; }
.tr-avg b { color: var(--tier); font-weight: 800; font-variant-numeric: tabular-nums; }
.tr-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -.2px; min-height: 2.2em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-meta { font-size: 13px; font-weight: 500; color: var(--tr-muted); margin-top: 4px; min-height: 16px; }
.tr-tier { font-size: 15px; font-weight: 600; color: var(--tr-muted); margin-top: 6px; min-height: 19px; transition: color .15s; }
.tr-rate.touched .tr-tier { color: var(--rc); font-weight: 800; }
.tr-ring { flex: none; position: relative; width: 72px; height: 72px; }
.tr-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(90deg); overflow: visible; }
.tr-ring .disc { fill: #0A0D11; }
.tr-ring .trk { fill: none; stroke: #3A4350; stroke-width: 7; }
.tr-rate.touched .tr-ring .trk { stroke: #2A313B; }
.tr-ring .arc { fill: none; stroke: var(--rc); stroke-width: 7; stroke-dasharray: 0 999; filter: drop-shadow(0 0 5px var(--rcg)); }
.tr-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 900; letter-spacing: -.5px; color: var(--tr-muted); font-variant-numeric: tabular-nums; }
.tr-rate.touched .tr-ring span { color: var(--rc); }

.tr-slider { position: relative; padding: 6px 0; margin: -6px 0; touch-action: none; cursor: pointer; }
.tr-slider input { width: 100%; margin: 6px 0 0; -webkit-appearance: none; appearance: none; background: transparent; height: 44px; --fill: 50%; --tc: #5b6470; touch-action: none; }
.tr-slider input::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--tc) var(--fill), #2a313a var(--fill)); }
.tr-slider input::-moz-range-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--tc) var(--fill), #2a313a var(--fill)); }
.tr-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; margin-top: -11px; border: 5px solid var(--tc); box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.tr-slider input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 5px solid var(--tc); }
.tr-rate-here { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-size: 13px; font-weight: 800; color: var(--tr-red); opacity: 0; transition: opacity .25s; pointer-events: none; }
.tr-slider.cue .tr-rate-here, .tr-slider.glow .tr-rate-here { opacity: 1; }
.tr-slider.glow input::-webkit-slider-runnable-track { animation: tr-breathe 1.6s ease-in-out infinite; }
.tr-slider.glow input::-moz-range-track { animation: tr-breathe 1.6s ease-in-out infinite; }
@keyframes tr-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(227,66,52,.0); } 50% { box-shadow: 0 0 12px 3px rgba(227,66,52,.75); } }
.tr-ticks { display: flex; justify-content: space-between; padding: 0 10px; font-size: 10px; color: var(--tr-muted); font-weight: 600; }
.tr-btns { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; margin-top: 10px; }
.tr-btn { height: 48px; border-radius: 24px; font-size: 15px; font-weight: 700; border: 1px solid var(--tr-line); background: transparent; transition: transform .1s; }
.tr-btn:active:not(:disabled) { transform: scale(.97); }
.tr-btn.primary { background: var(--tr-red); border-color: var(--tr-red); color: #fff; }
.tr-btn:disabled { opacity: .4; cursor: default; }
.tr-foot { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.tr-hint { font-size: 12px; color: var(--tr-muted); text-align: center; margin: 0; }

/* ---------- After rating ---------- */
.tr-bar { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--tr-muted); }
.tr-get { flex: none; height: 44px; padding: 0 18px; border-radius: 22px; background: var(--tr-red); color: #fff; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; }
.tr-sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.6); animation: tr-fade .25s; }
@keyframes tr-fade { from { opacity: 0; } }
.tr-sheet-card {
  width: min(430px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--tr-card); border-radius: 18px 18px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; text-align: center;
  animation: tr-up .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes tr-up { from { transform: translateY(40px); } }
.tr-sheet-h { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; text-wrap: balance; }
.tr-sheet-p { margin: 0; font-size: 14px; color: var(--tr-muted); line-height: 1.45; }
.tr-stores { justify-content: center; }
.tr-stores .store { flex: 1 1 100%; justify-content: center; }
.tr-keep { height: 44px; border: 0; background: transparent; font-size: 14px; font-weight: 600; color: var(--tr-muted); text-decoration: underline; text-underline-offset: 3px; }
.tr-fallback { display: none; text-align: center; color: var(--tr-muted); font-size: 14px; }
.tr-fallback p { margin: 0 0 10px; }
.tr-fallback .stores { justify-content: center; }
.tr.nojs .tr-fallback { display: block; }

/* Short screens (iPhone SE, Instagram's in-app browser): tighter, so Rate stays on screen. */
@media (max-height: 720px) {
  .tr-app { gap: 6px; padding-top: 8px; }
  .tr-title { font-size: 19px; }
  .tr-btns { margin-top: 4px; }
}
}

@media (prefers-reduced-motion: reduce) {
  .tr-case, .tr-inner, .tr-floor, .tr-gloss, .tr-front::before, .tr-sticker, .tr-label { transition-duration: .01s !important; }
  .tr-slider.glow input::-webkit-slider-runnable-track, .tr-slider.glow input::-moz-range-track { animation: none; box-shadow: 0 0 10px 2px rgba(227,66,52,.6); }
  .tr-sheet, .tr-sheet-card { animation: none; }
}
