/* Lifeinvader Live (lifeinvader.one-star.cc): the lives of the game server in the browser.
 * Laid out like a streaming site (channels on the left by viewers, tiles, player with chat), in
 * the OneStar look of the main site: navy, coal panels, signal red, yellow for the join button,
 * Bebas Neue for headlines. Streams are portrait (9:16), so tiles and the player are too. */

@font-face { font-family: 'Bebas Neue'; src: url('/fonts/bebas-neue.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('/fonts/roboto.woff2') format('woff2'); font-weight: 100 900; font-stretch: 75% 100%; font-display: swap; }

:root {
    --navy: #161a25; --navy-2: #1d2231; --coal: #262626; --coal-2: #1f1f1f; --page: #0c0e14;
    --red: #dc143c; --red-2: #ff2d55; --yellow: #ffc400; --ink: #14161d;
    --text: #fff; --dim: #b9bdc9; --line: rgba(255, 255, 255, .13);
    --head: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
    --body: 'Roboto', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    --top: 60px; --side: 250px; --skew: -8deg;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 400 15px/1.5 var(--body); overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
h1, h2, h3 { margin: 0; font-family: var(--head); font-weight: 400; letter-spacing: .03em; text-transform: uppercase; line-height: 1; }

/* ------------------------------------------------------------ top bar */
.top { position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 18px; background: var(--navy); border-bottom: 2px solid var(--red); }
.top__brand { display: flex; align-items: center; gap: 14px; }
.top__brand img { height: 34px; width: auto; }
.top__name { display: flex; align-items: baseline; gap: 7px; padding-left: 14px; border-left: 1px solid var(--line); font-family: var(--head); font-size: 26px; letter-spacing: .04em; text-transform: uppercase; line-height: 1; transform: skewX(var(--skew)); }
.top__name b { font-weight: 400; }
.top__name i { font-style: normal; padding: 3px 8px 1px; border-radius: 5px; background: var(--red); }
.top__count { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 99px; background: rgba(255, 255, 255, .07); color: var(--dim); font-size: 13px; font-weight: 500; }
.top__count::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red-2); animation: pulse 1.6s ease-in-out infinite; }
.top__nav { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 14px; color: var(--dim); }
.top__nav a:hover { color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 18px; border-radius: 8px; font-family: var(--head); font-size: 19px; letter-spacing: .05em; text-transform: uppercase; }
.btn--join { background: var(--yellow); color: var(--ink) !important; transform: skewX(var(--skew)); }
.btn--join:hover { filter: brightness(1.08); }
.btn--red { background: var(--red); color: #fff; }
.btn--ghost { background: rgba(255, 255, 255, .1); color: #fff; }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------ frame: channels left, content right */
.shell { position: fixed; inset: var(--top) 0 0 0; display: flex; }
.side { width: var(--side); flex: none; display: flex; flex-direction: column; background: var(--navy-2); border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4054 transparent; }
.side h2 { padding: 16px 16px 10px; font-size: 19px; color: var(--dim); }
.side__note { margin: auto 0 0; padding: 14px 16px 16px; color: #7f8597; font-size: 12px; line-height: 1.45; }
.side__empty { padding: 4px 16px 12px; color: #7f8597; font-size: 13px; }
.chan { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 16px; text-align: left; }
.chan:hover, .chan.is-on { background: rgba(255, 255, 255, .06); }
.chan.is-on { box-shadow: inset 3px 0 0 var(--red); }
.chan__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chan__who b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan__who i { font-style: normal; color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan__n { display: flex; align-items: center; gap: 5px; font-size: 13px; font-variant-numeric: tabular-nums; }
.chan__n::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red-2); }
.av { flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ff5f7a, var(--red)); color: #fff; font-weight: 700; box-shadow: 0 0 0 2px var(--navy-2), 0 0 0 4px var(--red); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av--plain { box-shadow: none; }

.main { flex: 1; min-width: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4054 transparent; }

/* ------------------------------------------------------------ browse */
.browse { padding: 26px 30px 50px; max-width: 1500px; }
.browse__head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.browse__head h1 { font-size: 46px; transform: skewX(var(--skew)); transform-origin: left bottom; }
.browse__head h1 em { font-style: normal; color: var(--red-2); }
.browse__head p { margin: 0 0 4px; color: var(--dim); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.card { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.card__pic { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: linear-gradient(160deg, #3b1020, #14161d); transition: transform .15s, box-shadow .15s; }
.card:hover .card__pic { transform: translate(4px, -4px); box-shadow: -4px 4px 0 var(--red); }
.card__pic img { width: 100%; height: 100%; object-fit: cover; }
.card__ph { position: absolute; inset: 0; display: grid; place-items: center; }
.badge { display: inline-flex; align-items: center; height: 21px; padding: 1px 7px 0; border-radius: 4px; background: var(--red); font-family: var(--head); font-size: 15px; letter-spacing: .06em; line-height: 1; }
.card__pic .badge { position: absolute; left: 9px; top: 9px; }
.card__eye, .card__tag { position: absolute; bottom: 9px; left: 9px; padding: 1px 7px; border-radius: 5px; background: rgba(0, 0, 0, .65); font-size: 12.5px; font-weight: 500; }
.card__tag { left: auto; right: 9px; top: 9px; bottom: auto; background: var(--yellow); color: var(--ink); font-weight: 700; }
.card__meta { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.card__meta > div { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.card__meta b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__meta i { font-style: normal; color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card--top { grid-column: span 2; grid-row: span 2; }
.card--top .card__meta b { font-size: 17px; }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 620px; margin-top: 10px; padding: 30px; border-radius: 16px; background: var(--coal-2); border: 1px solid var(--line); }
.empty h2 { font-size: 34px; }
.empty p { margin: 0; color: var(--dim); }
.empty ol { margin: 0; padding-left: 20px; color: var(--dim); }
.empty ol b { color: #fff; font-weight: 600; }

/* ------------------------------------------------------------ watch: stage, info, chat */
.watch { display: flex; height: 100%; }
.watch__left { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4054 transparent; }
.stage { position: relative; flex: none; height: min(78vh, calc(100vh - var(--top) - 96px)); min-height: 380px; display: flex; align-items: stretch; justify-content: center; gap: 4px; padding: 0; background: #05060a; overflow: hidden; }
.stage__bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(34px) brightness(.35); }
.tile { position: relative; flex: none; height: 100%; aspect-ratio: 9 / 16; max-width: calc((100% - 12px) / var(--n, 1)); background: radial-gradient(circle at 50% 40%, #22222a, #0b0b0d); overflow: hidden; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile__name { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; background: rgba(0, 0, 0, .55); font-size: 13px; font-weight: 600; }
.tile__name em { font-style: normal; padding: 1px 6px 0; border-radius: 4px; background: var(--red); font-family: var(--head); font-size: 13px; letter-spacing: .05em; }
.stage[style*="--n: 1"] .tile__name { display: none; }
.tile__state { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(0, 0, 0, .45); color: var(--dim); font-size: 14px; text-align: center; padding: 16px; }
.tile.is-wait .tile__state, .tile.is-pause .tile__state { display: flex; }
.tile.is-pause .tile__state b { font-family: var(--head); font-size: 30px; font-weight: 400; color: #fff; letter-spacing: .04em; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite; }
.tile.is-pause .spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage__sound { position: absolute; right: 16px; top: 12px; transform: skewX(var(--skew)); z-index: 4; }
.stage__live { position: absolute; left: 14px; top: 14px; z-index: 3; display: flex; align-items: center; gap: 8px; }
.stage__live span:not(.badge) { padding: 2px 8px; border-radius: 5px; background: rgba(0, 0, 0, .6); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.battle { position: absolute; left: 50%; top: 14px; z-index: 3; width: min(520px, 70%); transform: translateX(-50%); }
.battle__bar { display: flex; height: 26px; border-radius: 13px; overflow: hidden; background: #222; box-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.battle__bar i { display: flex; align-items: center; padding: 0 12px; font-style: normal; font-weight: 700; font-size: 13px; transition: width .6s cubic-bezier(.2, .8, .3, 1); white-space: nowrap; }
.battle__bar i:first-child { background: linear-gradient(90deg, var(--red), #ff4f81); }
.battle__bar i:last-child { background: linear-gradient(90deg, #339af0, #1971c2); justify-content: flex-end; }
.battle__meta { display: flex; justify-content: space-between; margin-top: 5px; font-size: 12.5px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.battle.is-end .battle__meta span:first-child { color: var(--yellow); }

.info { display: flex; align-items: center; gap: 14px; padding: 16px 22px 22px; }
.info__who { flex: 1; min-width: 0; }
.info__who h1 { font-size: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info__who p { margin: 3px 0 0; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info__who p b { color: #fff; font-weight: 600; }
.info__stats { display: flex; gap: 18px; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
.info__stats b { display: block; font-family: var(--head); font-weight: 400; font-size: 24px; color: #fff; line-height: 1.1; }
.info__stats .is-red b { color: var(--red-2); }

.chat { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--navy-2); border-left: 1px solid var(--line); }
.chat h2 { padding: 15px 16px 13px; font-size: 19px; color: var(--dim); border-bottom: 1px solid var(--line); }
.chat__pin { margin: 10px 12px 0; padding: 9px 11px; border-radius: 9px; background: rgba(255, 196, 0, .1); box-shadow: inset 3px 0 0 var(--yellow); font-size: 13.5px; }
.chat__pin span { display: block; color: var(--yellow); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.chat__list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 9px; scrollbar-width: thin; scrollbar-color: #3a4054 transparent; }
.msg { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; line-height: 1.4; word-break: break-word; animation: in .25s ease-out; }
.msg b { font-weight: 600; color: #c7cbe0; }
.msg em { font-style: normal; margin-left: 5px; padding: 0 5px; border-radius: 3px; background: var(--red); font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.msg.is-mod em { background: #1c7ed6; }
.chat__none { color: #7f8597; font-size: 13.5px; }
.chat__foot { padding: 13px 16px 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; line-height: 1.45; }
.chat__foot b { color: #fff; font-weight: 600; }
.chat__foot .btn { width: 100%; margin-top: 10px; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.over { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100%; padding: 30px; text-align: center; }
.over h1 { font-size: 44px; transform: skewX(var(--skew)); }
.over p { margin: 0; color: var(--dim); max-width: 420px; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 1100px) { .chat { width: 290px; } .top__nav a:not(.btn) { display: none; } }
@media (max-width: 860px) {
    body { overflow: auto; }
    .shell { position: static; display: block; padding-top: var(--top); }
    .side { width: auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
    .side h2, .side__note { display: none; }
    .side__list { display: flex; }
    .chan { width: auto; padding: 10px 12px; }
    .chan__who i { display: none; }
    .main { overflow: visible; }
    .browse { padding: 18px 14px 40px; }
    .browse__head { flex-direction: column; align-items: flex-start; gap: 4px; }
    .browse__head h1 { font-size: 36px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
    .card--top { grid-column: auto; grid-row: auto; }
    .watch { display: block; height: auto; }
    .watch__left { overflow: visible; }
    .stage { height: auto; min-height: 0; aspect-ratio: 9 / 14; }
    .info { flex-wrap: wrap; padding: 14px; }
    .battle { top: 48px; width: calc(100% - 28px); }
    .chat { width: auto; border-left: 0; border-top: 1px solid var(--line); }
    .chat__list { max-height: 320px; }
    .top { gap: 10px; padding: 0 12px; }
    .top__brand img { display: none; }
    .top__name { border: 0; padding: 0; font-size: 22px; }
    .top__count { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
