/* A game's trial-stream page: controls on the left (bots, game, settings),
   the stream screen on the right with our own live-stream layer over the game. */

/* head ------------------------------------------------------------------------------ */
.tryout-head { padding: 22px 0 0; }
.tryout-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 0; }
.tryout-title h1 { font-size: clamp(28px, 3.4vw, 40px); margin: 0; }
.onair { display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px 4px 9px; border-radius: 8px;
  background: color-mix(in srgb, var(--g-red) 16%, transparent); color: var(--g-red);
  font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.onair i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: onair 1.6s ease-in-out infinite; }
@keyframes onair { 50% { opacity: .35; } }

/* layout ---------------------------------------------------------------------------- */
.tryout { padding: 20px 0 40px; overflow-x: clip; }
.tryout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.tryout-panel { display: grid; gap: 16px; min-width: 0; }
.tryout-panel.is-off { opacity: .5; pointer-events: none; }
/* The phone takes its width from the window height, so on first load it fits
   whole below the page header (270px: site header, title, switch, margins). */
.tryout-stage { --phone-w: min(340px, max(240px, calc((100vh - 270px) * 9 / 16 + 14px)));
  position: sticky; top: 80px; display: grid; gap: 12px; justify-items: center; }
@supports (height: 100svh) {
  .tryout-stage { --phone-w: min(340px, max(240px, calc((100svh - 270px) * 9 / 16 + 14px))); }
}

/* bots card */
.tryout-label { margin: 0 0 10px; font-size: 15px; font-weight: 600; }

.crowd { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.crowd-card { display: grid; justify-items: start; gap: 2px; padding: 12px 12px 11px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--bg-alt); border: 1.5px solid var(--border); color: var(--text); font: inherit; transition: border-color .15s, background .15s; }
.crowd-card:hover { border-color: var(--border-strong); }
.crowd-card[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.crowd-card b { font-size: 15px; }
.crowd-card small { color: var(--muted); font-size: 12.5px; }
.crowd-bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; margin-bottom: 6px; }
.crowd-bars i { width: 5px; border-radius: 2px; background: var(--border-strong); }
.crowd-bars i:nth-child(1) { height: 25%; } .crowd-bars i:nth-child(2) { height: 50%; }
.crowd-bars i:nth-child(3) { height: 75%; } .crowd-bars i:nth-child(4) { height: 100%; }
.crowd-bars[data-level="1"] i:nth-child(-n+1), .crowd-bars[data-level="2"] i:nth-child(-n+2),
.crowd-bars[data-level="3"] i:nth-child(-n+3), .crowd-bars[data-level="4"] i { background: var(--primary); }

.tune { display: grid; gap: 14px; }
.tune-row { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 4px; }
.tune-name { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; }
.tune-row output { padding: 2px 9px; border-radius: 7px; background: var(--bg-alt); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tune-row input[type="range"] { grid-column: 1 / -1; width: 100%; margin: 4px 0 0; }

.tryout-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tryout-buttons svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tryout-buttons #chat-toggle-ico { fill: currentColor; stroke: none; }
.btn.quiet { background: none; border-color: var(--border); color: var(--muted); }
.btn.quiet:hover { color: var(--text); border-color: var(--border-strong); }
.tryout-note .dnote { margin: 0; }

/* stream screen ------------------------------------------------------------------------ */
.screenframe { position: relative; width: 100%; max-width: var(--phone-w); padding: 7px; border-radius: 34px;
  background: linear-gradient(160deg, var(--surface-2), var(--bg-alt)); border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 10%, transparent), 0 30px 60px -30px rgba(0, 0, 0, .55); }
.screenframe-glass { position: relative; aspect-ratio: 9 / 16; border-radius: 28px; overflow: hidden; background: #0e1014; isolation: isolate; }
/* The game renders at 540×960 (half a 1080×1920 stream) and is scaled to fit. */
.screenframe-glass iframe { position: absolute; top: 0; left: 0; width: 540px; height: 960px; border: 0;
  transform: scale(var(--k, .617)); transform-origin: 0 0; pointer-events: none; }
.screen-msg { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; margin: 0; padding: 28px; text-align: center; color: #c9ccd4; font-size: 15px; }
.screen-msg.bad { color: #ff9a9a; }
.screen-msg[hidden] { display: none; }

.stage-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; max-width: var(--phone-w);
  padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-size: 15px; font-weight: 500; cursor: pointer; }
.stage-switch > span:first-child { display: inline-flex; align-items: center; gap: 6px; }

/* TikTok LIVE as a viewer sees it on a phone, drawn over the game */
.live { position: absolute; inset: 0; z-index: 2; color: #fff; font: 500 12px/1.3 var(--font); pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45); transition: opacity .25s; }
.screenframe[data-view="game"] .live { opacity: 0; }
.live svg { display: block; flex: none; }

.tt-top { position: absolute; top: 6px; left: 7px; right: 7px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tt-host { display: flex; align-items: center; gap: 5px; min-width: 0; height: 30px; padding: 2px 4px 2px 2px; border-radius: 999px; background: rgba(0, 0, 0, .32); }
.tt-host-ava { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 12px;
  background: linear-gradient(135deg, #ffb36b, #ff5e8a); text-shadow: none; }
.tt-host-who { display: grid; min-width: 0; overflow: hidden; line-height: 1.2; }
.tt-host-who b { font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-host-who small { display: flex; align-items: center; gap: 3px; font-size: 9px; opacity: .85; white-space: nowrap; }
.tt-host-who small svg { width: 9px; height: 9px; fill: currentColor; }
.tt-follow { flex: none; padding: 3px 7px; border-radius: 999px; background: #fe2c55; font-size: 10px; font-weight: 700; text-shadow: none; }
.tt-right { display: flex; align-items: center; gap: 5px; flex: none; }
.tt-faces { display: flex; }
.tt-face { position: relative; display: grid; place-items: center; width: 20px; height: 20px; margin-left: -6px; border-radius: 50%;
  font-size: 10px; font-weight: 800; background: hsl(var(--h, 210) 55% 46%); box-shadow: 0 0 0 1.5px var(--ring, rgba(255, 255, 255, .8)); text-shadow: none; }
.tt-face:first-child { margin-left: 0; }
.tt-face:nth-child(1) { --ring: #ffcf3f; } .tt-face:nth-child(2) { --ring: #d6dbe4; } .tt-face:nth-child(3) { --ring: #e09a5a; }
.tt-count { min-width: 26px; padding: 3px 6px; border-radius: 999px; background: rgba(0, 0, 0, .32); text-align: center; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tt-close { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }

.tt-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 8px 9px; background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .38) 55%); }
.tt-chat { display: grid; gap: 4px; width: 74%; margin: 0 0 6px; padding: 0; list-style: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%); mask-image: linear-gradient(to bottom, transparent, #000 30%); }
.tt-chat li { display: flex; align-items: flex-start; gap: 6px; }
.tt-chat li.in { animation: tt-in .25s ease-out; }
.tt-ava { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 9px; font-weight: 800;
  line-height: 1; background: hsl(var(--h, 210) 55% 46%); text-shadow: none; }
.tt-line { min-width: 0; padding-top: 2px; font-size: 11px; overflow-wrap: anywhere; }
.tt-line b { margin-right: 5px; font-weight: 600; color: rgba(255, 255, 255, .62); }
.tt-line img { display: inline-block; width: 16px; height: 16px; margin: -3px 2px; object-fit: contain; vertical-align: middle; }
.tt-chat li.is-gift .tt-line { color: #ffe08a; }
.screenframe.is-paused .tt-chat { opacity: .55; }

.tt-gift { position: relative; display: flex; align-items: center; gap: 6px; width: max-content; max-width: 82%; height: 38px; margin: 0 0 8px;
  padding: 3px 50px 3px 3px; border-radius: 999px; background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .25)); }
.tt-gift[hidden] { display: none; }
.tt-gift.in { animation: tt-gift-in .35s cubic-bezier(.2, 1.3, .4, 1); }
.tt-gift .tt-ava { width: 32px; height: 32px; font-size: 13px; }
.tt-gift-who { display: grid; min-width: 0; line-height: 1.2; }
.tt-gift-who b { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-gift-who small { font-size: 10px; opacity: .8; white-space: nowrap; }
.tt-gift img { position: absolute; right: 2px; top: 50%; width: 46px; height: 46px; margin-top: -25px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.tt-gift-combo { position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%); font-size: 22px; font-style: italic; font-weight: 900;
  color: #fff; -webkit-text-stroke: 1px rgba(0, 0, 0, .25); text-shadow: 0 2px 0 rgba(0, 0, 0, .3); white-space: nowrap; }
.tt-gift-combo.bump { animation: tt-bump .3s ease-out; }

.tt-bar { display: flex; align-items: center; gap: 9px; }
.tt-input { flex: 1; min-width: 0; height: 34px; padding: 0 13px; display: flex; align-items: center; border-radius: 999px;
  background: rgba(0, 0, 0, .32); color: rgba(255, 255, 255, .75); font-size: 12px; white-space: nowrap; overflow: hidden; }
.tt-icon { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.tt-icon.tt-gift-icon { width: 28px; height: 28px; stroke: none; }
.tt-icon.tt-share { fill: #fff; stroke: none; }

.tt-hearts { position: absolute; right: 12px; bottom: 46px; width: 34px; height: 230px; }
.tt-heart { position: absolute; bottom: 0; left: 50%; width: 20px; height: 20px; background: var(--c, #fe2c55);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 21s-8.5-5.2-8.5-11.2A4.8 4.8 0 0 1 12 6.9a4.8 4.8 0 0 1 8.5 2.9C20.5 15.8 12 21 12 21Z"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 21s-8.5-5.2-8.5-11.2A4.8 4.8 0 0 1 12 6.9a4.8 4.8 0 0 1 8.5 2.9C20.5 15.8 12 21 12 21Z"/></svg>') center / contain no-repeat;
  animation: tt-heart 2.4s ease-out forwards; }

@keyframes tt-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes tt-gift-in { from { opacity: 0; transform: translateX(-40px); } }
@keyframes tt-bump { 40% { transform: translateY(-50%) scale(1.35); } }
@keyframes tt-heart {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -210px) scale(.85); }
}
@media (prefers-reduced-motion: reduce) {
  .tt-chat li.in, .tt-gift.in, .tt-gift-combo.bump, .onair i { animation: none; }
}

/* call to action */
.tryout-cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.cta-band .btn.on-band { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.cta-band .btn.on-band:hover { border-color: #fff; }

@media (max-width: 1000px) {
  .tryout-grid { grid-template-columns: minmax(0, 1fr); }
  .tryout-stage { position: static; order: -1; }
  .crowd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tryout-head { padding-top: 16px; }
  .tryout-title { gap: 12px; }
  .tryout-title .dgame-ico { width: 40px; height: 40px; }
  .tryout-buttons .btn { flex: 1; }
}
