:root {
  color-scheme: dark;
  --bg: #181522; --panel: #242031; --line: #443b55; --text: #f7f1fa; --soft: #c6b9d2;
  --action: #f5ba95; --internet: #c5adfb; --transfer: #94dfc6;
  font: 500 16px/1.5 "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--text) }
button,input { font: inherit }
button { cursor: pointer; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; padding: .68rem 1rem }
button:disabled { opacity: .55; cursor: default }
a { color: inherit }
[hidden] { display: none !important }
:focus-visible, body.pad :focus { outline: 3px solid var(--action); outline-offset: 4px }
.top {
  position: sticky; z-index: 5; top: 0; min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: .65rem max(5vw, 1rem); gap: 1rem; border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: inline-flex; width: fit-content; align-items: center; gap: .6rem; text-decoration: none; font-weight: 760; font-size: 1.22rem }
.mark { width: 1.3rem; height: 1.05rem; border: 2px solid var(--action); border-radius: 3px; position: relative }
.mark::after { content: ''; position: absolute; left: .28rem; right: .28rem; bottom: -.32rem; height: 2px; background: var(--action) }
nav { display: flex; gap: .3rem }
nav button { background: transparent; border-color: transparent; white-space: nowrap; color: var(--soft); font-size: .93rem }
nav button[aria-current="page"] { border-color: var(--line); color: var(--text); background: var(--panel) }
#queue-count { margin-left: .2rem; color: var(--action) }
.device { justify-self: end; color: var(--soft); font-size: .88rem }
.connection { justify-self: end; display: flex; flex-wrap: wrap; justify-content: end; align-items: center; gap: .4rem .65rem }
.connection button { padding: .35rem .65rem; font-size: .86rem }
.device.online { color: var(--transfer) }
main { max-width: 1540px; margin-inline: auto; padding: clamp(1.6rem, 4vw, 3.6rem) max(5vw, 1rem) 4rem }
h1,h2,h3,p { margin-block-start: 0 }
h1 { font-size: clamp(2.45rem, 6vw, 4.8rem); letter-spacing: -.07em; line-height: .99; font-weight: 720; margin-bottom: 1.3rem }
h2 { font-size: 1.23rem; letter-spacing: -.025em; margin: 0 0 .85rem }
h3 { font-size: 1.12rem; margin: 0 }
.search-area { border-bottom: 1px solid var(--line); padding-bottom: 1.65rem; margin-bottom: 1.6rem }
#search { max-width: 760px; display: flex; align-items: stretch; gap: .65rem }
input { width: 100%; min-width: 0; padding: .8rem 1rem; border-radius: .7rem; background: var(--panel); border: 1px solid var(--line); color: var(--text) }
input::placeholder { color: var(--soft) }
.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(.6rem, 1.65vw, 1.4rem) }
.game { text-align: left; min-width: 0; padding: 0; overflow: hidden; border-radius: .58rem; background: var(--panel); display: flex; flex-direction: column }
.game .art { display: grid; place-items: center; width: 100%; aspect-ratio: 2 / 3; position: relative; overflow: hidden; background: #342b49; padding: .6rem }
.art img { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: cover }
.art .initials { font-weight: 730; font-size: clamp(1.8rem, 4vw, 4rem); color: #b9a8df }
.meta { padding: .6rem .72rem .7rem; width: 100%; display: grid; gap: .25rem }
.game-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650 }
.game-state { font-size: .82rem; color: var(--transfer) }
.message,.subtle { color: var(--soft); margin-bottom: .55rem }
.message:empty { margin: 0 }
.login { max-width: 420px; margin: 8vh auto 0 }
.login form { display: grid; gap: .8rem }
.primary { background: var(--action); color: #241b21; border-color: var(--action); font-weight: 740 }
.jobs { display: grid; gap: .9rem; max-width: 870px }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: .8rem; padding: 1.15rem 1.3rem }
.job-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; gap: .6rem }
.job-head .subtle { margin: 0; text-align: right; font-size: .86rem }
.progress-row { margin-top: .75rem }
.progress-text { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem .8rem; font-size: .92rem }
.progress-text span { color: var(--soft); font-variant-numeric: tabular-nums }
.progress-row progress { display: block; width: 100%; height: .52rem; margin-top: .38rem; margin-bottom: .22rem; border: 0; background: #402f52; border-radius: 1rem; overflow: hidden; accent-color: var(--internet) }
.progress-row progress::-webkit-progress-bar { background: #402f52; border-radius: 1rem }
.progress-row progress::-webkit-progress-value { background: var(--internet); border-radius: 1rem }
.progress-row.local progress { accent-color: var(--transfer) }
.progress-row.local progress::-webkit-progress-value { background: var(--transfer) }
.sources { display: block; color: var(--soft); font-size: .88rem }
dialog { width: min(540px, calc(100% - 2rem)); background: var(--panel); color: inherit; border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem }
dialog::backdrop { background: #0b0814b8 }
.detail-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem }
.detail-head img { width: 88px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: .5rem }
.detail-head h2 { font-size: 1.9rem; line-height: 1.1 }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem }
#typed { display: block; background: var(--bg); border-radius: .5rem; padding: .75rem; min-height: 2.9rem; margin-bottom: .75rem }
#keys { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: .32rem }
#keys button { padding-inline: .25rem }
.status { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: 90vw; z-index: 20; padding: .65rem .9rem; background: var(--text); color: var(--bg); border-radius: .55rem }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
@media (max-width: 1020px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)) } }
@media (max-width: 620px) {
  .top { grid-template-columns: 1fr 1fr; gap: .35rem; min-height: 0 }
  .top nav { grid-column: 1 / -1; grid-row: 2; justify-content: stretch }
  .top nav button { flex: 1; padding: .55rem .34rem }
  .connection { grid-column: 2; grid-row: 1 }
  h1 { font-size: 2.8rem }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)) }
  .meta { font-size: .82rem; padding: .45rem }
  .job { padding: .8rem }
}
@media (max-width: 365px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
