/* «Сюжет по кругу» (0.41, story-game.js): its entry in «Игры», the start dialog and what the card adds to the hall game's
   (hall-game.css gives the card, the countdown, the board and the podium; write-games.css the «Играю / Смотрю» row). */
.sj-entry { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.sj-entry[hidden], .sj-entry-btn[hidden] { display: none; }
.sj-entry-btn { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; text-align: left; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); font: inherit; cursor: pointer; }
.sj-entry-btn:hover { border-color: rgba(229, 160, 13, .6); }
.sj-entry-ico { font-size: 26px; line-height: 1; }
.sj-entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sj-entry-text small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.sj-entry-go { font-size: 22px; color: var(--muted); }

body.sj-on.lobby-on .video-wrap { overflow: hidden; } /* the lobby does not scroll away under the game */
.sj-card { background: #101218; } /* opaque over the lobby (game-cards.test.js) */
.sj-card .hg-body { gap: 12px; min-width: 0; }
.sj-genre { display: inline-block; padding: 2px 9px; border-radius: 999px; background: rgba(229, 160, 13, .14); color: var(--accent); font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sj-ask { font-size: 15px; font-weight: 700; }
.sj-ask small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.sj-rules ol { margin: 8px 0 4px; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.4; }
.sj-soon { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sj-lead-end { font-size: 14px; font-weight: 700; color: var(--accent); }
.sj-wait { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.4; }

/* The writing: the line before (and only it), the field (the ending's round: and the title). */
.sj-prev { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; border-radius: 11px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); }
.sj-plabel { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sj-prev p { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.sj-prev.stand p { font-style: italic; color: var(--muted); }
.sj-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text send" "left left"; gap: 6px 8px; align-items: end; }
.sj-form.ending { grid-template-areas: "text text" "left left" "head send"; }
.sj-input { min-width: 0; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .35); color: var(--text); font: inherit; font-size: 16px; } /* 16 px: no zoom on a phone */
.sj-text { grid-area: text; min-height: 56px; max-height: 30vh; padding: 10px 14px; resize: none; line-height: 1.35; }
.sj-hlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sj-hinput { grid-area: head; min-height: 46px; padding: 0 14px; }
.sj-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229, 160, 13, .2); }
.sj-send { grid-area: send; min-height: 48px; padding: 0 18px; border-radius: 11px; border: 0; background: var(--accent); color: #111; font: inherit; font-weight: 700; cursor: pointer; }
.sj-left { grid-area: left; justify-self: end; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sj-left.low { color: var(--bad); }
.sj-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A story: the title, the genre, the opening and the lines one under another (one by one while it is read). */
.sj-story { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sj-heading { font-size: 20px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.sj-heading small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.sj-heading.stand { color: var(--muted); }
.sj-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: sj; }
.sj-line { position: relative; padding: 9px 12px 9px 14px; border-radius: 10px; background: rgba(255, 255, 255, .04); border-left: 3px solid rgba(255, 255, 255, .12); font-size: 15.5px; line-height: 1.45; overflow-wrap: anywhere; }
.sj-line.opening { border-left-color: var(--accent); background: rgba(229, 160, 13, .08); font-weight: 600; }
.sj-line.stand { font-style: italic; color: var(--muted); }
.sj-line.ending { border-left-color: var(--ok); }
.sj-anim .sj-line, .sj-anim .sj-heading { animation: sj-in .5s ease-out both; animation-delay: calc(var(--i, 0) * var(--step, 2600ms) - var(--past, 0ms)); }
@keyframes sj-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* The vote: the lines people wrote are the buttons; the opening and the stand-ins are not. */
.sj-line.votable { padding: 0; border-left: 0; background: transparent; }
.sj-pick { width: 100%; display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 9px 12px; text-align: left; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.4; cursor: pointer; }
.sj-pick:hover:not(:disabled) { border-color: var(--accent); }
.sj-pick:disabled { cursor: default; }
.sj-pick.mine { border-color: var(--accent); background: rgba(229, 160, 13, .14); }
.sj-pick.own { opacity: .62; border-style: dashed; }
.sj-ptext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sj-own, .sj-x2 { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sj-x2 { color: var(--ok); }
.sj-fans { margin-top: 2px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sj-fans-podium { margin-top: 10px; font-size: 13.5px; color: inherit; }
.sj-fans-podium b { color: var(--accent); }
.sj-fans-podium .me { font-weight: 700; }

/* The reveal: who wrote each line, its votes and points. */
.sj-mine { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sj-rline { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text pts" "who pts" "votes pts" "fans pts"; column-gap: 10px; animation: sj-in .45s ease-out both; animation-delay: calc(var(--i, 0) * .35s); }
.sj-rtext { grid-area: text; }
.sj-rwho { grid-area: who; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.sj-line.stand .sj-rwho { color: var(--muted); font-weight: 500; }
.sj-rvotes { grid-area: votes; font-size: 12.5px; color: var(--muted); font-style: normal; }
.sj-rfans { grid-area: fans; font-size: 12.5px; color: var(--muted); font-style: normal; }
.sj-rfans b { color: var(--accent); }
.sj-pts { grid-area: pts; align-self: center; font-size: 17px; color: var(--ok); font-style: normal; font-variant-numeric: tabular-nums; }
.sj-rline.own { box-shadow: inset 3px 0 0 var(--accent); }
.sj-rline.picked { box-shadow: inset -3px 0 0 var(--accent); }
.sj-rline.prize { background: rgba(229, 160, 13, .1); }
/* «Лучшая история вечера»: a button a story (its title and genre); the one you started is locked. */
.sj-stories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sj-sbtn { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; text-align: left; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); color: var(--text); font: inherit; cursor: pointer; }
.sj-sbtn:hover:not(:disabled) { border-color: var(--accent); }
.sj-sbtn:disabled { cursor: default; }
.sj-sbtn.mine { border-color: var(--accent); background: rgba(229, 160, 13, .14); }
.sj-sbtn.own { opacity: .62; border-style: dashed; }
.sj-stext { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; overflow-wrap: anywhere; }
.sj-stext b { font-size: 15.5px; line-height: 1.3; }
.sj-best { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--accent); background: rgba(229, 160, 13, .07); }
.sj-bwho { font-size: 13px; color: var(--muted); }
.sj-night { margin-top: 10px; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.sj-night small { font-weight: 500; color: var(--muted); }

@media (min-width: 1100px) { .sj-card[data-phase="read"], .sj-card[data-phase="vote"], .sj-card[data-phase="reveal"], .sj-card[data-phase="best"] { width: min(820px, calc(100% - 20px)); } }
@media (max-width: 760px) {
  .sj-card .hg-min { width: 44px; height: 44px; }
  .sj-card .hg-btn { min-height: 44px; }
  .sj-prev p { font-size: 16px; }
  .sj-line { font-size: 15px; }
  .sj-heading { font-size: 18px; }
  .sj-form, .sj-form.ending { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "left" "head" "send"; }
  .sj-send { width: 100%; }
  .sj-stories { grid-template-columns: 1fr; }
  /* The phone's keyboard is open: the sheet sits on it and fits what is left of the screen. */
  .sj-card.sj-kb { bottom: var(--sj-kb, 0px); max-height: calc(var(--sj-vh, 60vh) - 8px); padding-bottom: 10px; }
  .sj-card.sj-kb .sj-ask, .sj-card.sj-kb .sj-plabel, .sj-card.sj-kb .gseat { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sj-anim .sj-line, .sj-anim .sj-heading, .sj-rline { animation: none; } }
