@layer base, components, screen, motion;

@layer components {
  .panel.raffle-card {
    border-color: var(--glass-edge);
    background: linear-gradient(128deg,#f9e6bd12,transparent 48%), var(--glass);
  }
  .raffle-card h2 { color: var(--gold-light); overflow-wrap: anywhere; }
  .raffle-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .35rem .7rem; color: var(--muted); }
  .raffle-balance { justify-self: start; color: var(--gold-light); font-variant-numeric: tabular-nums; }
  .raffle-tiles, .raffle-award-list { list-style: none; margin: 0; padding: 0; min-width: 0; }
  .raffle-tiles { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .42rem; }
  .raffle-tile {
    position: relative; display: grid; align-content: center; gap: .14rem; min-height: 3.4rem;
    padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .55rem;
    background: linear-gradient(145deg,#353944b5,#16181fd9 70%); overflow-wrap: anywhere; line-height: 1.3;
  }
  .raffle-tile small { color: var(--muted); }
  .raffle-tile.sold-out { border-color: var(--line); color: var(--muted); background: var(--bar); }
  .raffle-tile.tracking, .raffle-tile.selected {
    border-color: var(--gold-edge); background: var(--gold-metal); color: var(--metal-ink);
  }
  .raffle-tile:is(.tracking,.selected) small { color: var(--metal-ink); }
  .raffle-result {
    display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem .65rem;
    border-block-start: 1px solid var(--glass-edge); padding-block-start: .65rem; color: var(--gold-light);
    overflow-wrap: anywhere;
  }
  .raffle-award-list { display: grid; }
  .raffle-award-list li {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .42rem .85rem;
    padding-block: .58rem; overflow-wrap: anywhere;
  }
  .raffle-award-list li + li { border-block-start: 1px solid var(--line); }
  .raffle-award-list .muted { margin-top: .15rem; }
  .raffle-prize-editor {
    display: grid; gap: .58rem; min-width: 0; margin: 0; padding: .68rem;
    border: 1px solid var(--line); border-radius: .6rem;
  }
  .raffle-prize-editor legend { padding-inline: .35rem; color: var(--gold-light); }
  .raffle-prize-editor [hidden] { display: none; }
  .raffle-editor-numbers { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; align-items: start; }
  .raffle-editor-numbers input { min-width: 0; }
  @media (min-width: 34rem) {
    .raffle-tiles { grid-template-columns: repeat(3,minmax(0,1fr)); }
  }
}

@layer components {
  .announcement {
    position: relative;
    display: grid;
    align-content: space-between;
    gap: .45rem;
    min-height: 6.4rem;
    padding: .9rem 1rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(90deg,#101217 12%,#101217f0 56%,#10121755 100%),
      url("/assets/standings.jpg") center right / cover #101217;
  }
  .announcement[data-theme=amber] {
    background: linear-gradient(123deg,#15171d 48%,#201b17 73%,#53331f 89%,#262730);
  }
  .announcement[data-theme=smoke] {
    background: linear-gradient(95deg,#101217 24%,#10121766), url("/assets/facets.svg") right center / cover #14161d;
  }
  .announcement-copy { max-inline-size: 32ch; min-width: 0; }
  .announcement-copy h2 { font-size: clamp(1.05rem,4.4vw,1.28rem); color: var(--ink); overflow-wrap: anywhere; }
  .announcement-copy p { margin-top: .25rem; color: var(--ink); font-size: .92rem; }
  .announcement-controls { display: flex; gap: .32rem; align-items: center; }
  .button.announcement-dot { min-width: 44px; flex: none; padding-inline: .35rem; }
  .button.announcement-dot[aria-pressed=true] { background: var(--gold-metal); color: var(--metal-ink); }
  .member-card {
    display: grid;
    grid-template-columns: minmax(0,1.25fr) minmax(0,.85fr);
    align-items: center;
    gap: 1.05rem .9rem;
    padding: 1.15rem 1rem 1rem;
    border: 1px solid var(--glass-edge);
    border-radius: 6px 22px 6px 22px;
    position: relative;
    background:
      linear-gradient(127deg,transparent 52%,#ead6af1f 69%,#fff0c72e 71%,#d59a6217 76%,transparent 89%),
      linear-gradient(151deg,#30343ee0,#101116ed 53%,#211d26c9);
    background-clip: padding-box;
    box-shadow: inset 0 1px #fff5e044, inset 0 -1px #ffffff0d, var(--glass-shadow);
  }
  .member-card::before {
    content: ""; position: absolute; inset: -1px; padding: 1px;
    border-radius: inherit; pointer-events: none; background: var(--gold-rim);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
  }
  .member-card .panel-heading, .member-card .detail { display: grid; gap: .42rem; }
  .member-card .panel-heading { justify-items: start; }
  .member-card h2 { color: var(--ink); font-size: clamp(1.42rem,6.3vw,2rem); line-height: 1.15; }
  .member-card .detail { justify-content: end; justify-items: end; text-align: right; }
  .member-card .detail strong { color: var(--gold-light); font-size: clamp(1.15rem,5.4vw,1.75rem); line-height: 1.16; }
  .member-card .actions { grid-column: 1 / -1; }
  .member-card + .stack:empty { display: none; }
  .qr-preview { display: grid; justify-items: center; gap: .65rem; padding: .4rem 0; }
  .member-qr { width: min(100%, 198px); height: auto; border-radius: 6px; background: #fff; }
  .qr-countdown { min-block-size: 1.25rem; text-align: center; }
  .stat-periods { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-block: 1px solid var(--line); }
  .stat-period { display: grid; align-content: start; gap: .25rem; padding: .6rem .34rem; text-align: center; min-width: 0; }
  .stat-period + .stat-period { border-inline-start: 1px solid var(--line); }
  .stat-period > span { color: var(--muted); font-size: .84rem; }
  .stat-period strong { color: var(--gold); overflow-wrap: anywhere; }
  .stat-period .muted { font-size: .78rem; }
  .coupon-list { display: grid; gap: .65rem; list-style: none; padding: 0; margin: 0; }
  .coupon-item, .scan-coupon { display: grid; gap: .45rem; border-block-start: 1px solid var(--line); padding-block: .65rem .3rem; }
  .ranks.podium {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    align-items: end;
    gap: .4rem;
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }
  .podium .rank-row {
    display: flex;
    flex-flow: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 8rem;
    padding: .68rem .32rem;
    gap: .38rem;
    border: 1px solid var(--line);
    border-radius: 14px 14px 4px 4px;
    text-align: center;
  }
  .podium .rank-row[value="1"] {
    grid-area: 1/2;
    min-height: 9.65rem;
    border-color: transparent;
    background:
      linear-gradient(154deg,#8b5735 0%,#62452f 10%,#30282b 24%,#171921 56%,#251919 100%) padding-box,
      var(--gold-rim) border-box;
    box-shadow: inset 0 2px #ffe9bb55, 0 .75rem 1.4rem #0007;
  }
  .podium .rank-row[value="2"] { grid-area: 1/1; }
  .podium .rank-row[value="3"] { grid-area: 1/3; min-height: 7.45rem; }
  .ranks.podium.podium-count-1 { grid-template-columns: 1fr; }
  .podium-count-1 .rank-row[value="1"] { grid-area: 1/1; min-height: 7.5rem; }
  .ranks.podium.podium-count-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .podium .rank { width: 2.7rem; height: 2.7rem; }
  .podium .rank-person { max-width: 100%; justify-content: center; font-size: .87rem; }
  .podium .rank-amount, .podium .rank-count { max-inline-size: 100%; text-align: center; font-size: .86rem; }
  .rank-count { font-weight: 750; color: var(--gold); }
  @supports (background-clip: text) {
    :is(.member-card .detail strong, .stat-period strong, .rank-count, .rank-amount, .raffle-balance, .verification strong) {
      background: var(--gold-type);
      background-clip: text;
      color: transparent;
    }
  }
}
@layer base {
  :root {
    color-scheme: dark;
    font: 16px/1.5 "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    --ground: #090a0d;
    --ink: #f6f3ef;
    --muted: #bfc1c9;
    --gold: #f1cd8d;
    --gold-light: #ffebc4;
    --gold-metal: linear-gradient(131deg,#ba783b 0%,#eab34e 28%,#ffe1a1 43%,#fff3d4 49%,#f6ca6f 57%,#dea44a 75%,#b5743b 100%);
    --gold-rim: linear-gradient(131deg,#77462c 0%,#c8924d 30%,#ffe8bc 48%,#edc57e 52%,#925332 78%,#51312a 100%);
    --gold-type: linear-gradient(122deg,#e4ad58 0%,#ffe7b0 42%,#fff7e4 48%,#f4cb81 60%,#ddb075 100%);
    --gold-edge: #ffd89a;
    --metal-ink: #140d08;
    --brass: #8f7758;
    --line: #393944;
    --glass-edge: #666372;
    --rim: inset 0 1px #fff2d823;
    --glass: linear-gradient(155deg,#303541aa 0%,#181b23d6 35%,#111218eb 100%);
    --glass-shadow: 0 .5rem 1.4rem #0006;
    --paper: #181a22;
    --bar: #111218;
    --well: #0e1015;
    --selected: #272934;
    --focus: #ffe2a5;
    --danger: #ffc0b4;
    --radius: 14px;
    background: var(--ground);
    color: var(--ink);
  }
  * { box-sizing: border-box; }
  body {
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    background:
      radial-gradient(ellipse at 52% -2%, #1d2029 0%, transparent 38rem),
      linear-gradient(148deg,var(--ground) 44%,#111319 100%);
  }
  h1, h2, p, ol { margin: 0; }
  h1 { font-size: 1.75rem; line-height: 1.22; font-weight: 780; text-wrap: balance; }
  h2 { font-size: 1.06rem; line-height: 1.35; }
  p { overflow-wrap: anywhere; }
  button, input, select { font: inherit; color: inherit; }
  input:not([type=checkbox]), select {
    width: 100%; min-width: 0; min-height: 44px; padding: .63rem .72rem;
    background: var(--well); border: 1px solid var(--brass); border-radius: 8px;
  }
  input { caret-color: var(--gold); }
  input::placeholder { color: var(--muted); opacity: 1; }
  :is(button, a, input, select, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
  button:disabled { cursor: wait; background: #35302a; border-color: #675a46; color: #bfb19b; }
  fieldset { margin: 0; padding: .35rem .65rem .55rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
  legend { padding: 0 .2rem; font-size: .85rem; }
  a { color: var(--gold); text-underline-offset: .2em; }
  ::selection { background: var(--gold); color: var(--ground); }
  .visually-hidden { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@layer components {
  .shell { width: min(100%, 40rem); margin-inline: auto; }
  .masthead { background: var(--bar); border-bottom: 1px solid var(--line); box-shadow: var(--rim); }
  .mast-row { display: flex; align-items: center; gap: .66rem; padding: .66rem 1rem; min-height: 60px; }
  .brand-mark { display: block; flex: none; width: 2rem; height: 2rem; }
  .brand-name { color: var(--gold); font-weight: 750; white-space: nowrap; letter-spacing: .035em; }
  .header-user { margin-left: auto; color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-shell { padding: .95rem 1rem calc(5.25rem + env(safe-area-inset-bottom)); }
  .stack, .form { display: grid; gap: .75rem; min-width: 0; }
  .section-heading { margin: .42rem 0 .18rem; display: grid; gap: .35rem; }
  .section-heading.art-heading {
    align-items: end; min-height: 5.15rem; margin: 0; padding: .92rem 32% .88rem .95rem;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--rim);
    background: linear-gradient(90deg, #0e1015 0%, #0e1015ee 40%, #0e101555 86%), url("/assets/standings.jpg") right center / cover no-repeat #0e1015;
  }
  .panel, .store-details {
    background: var(--glass) var(--paper); border: 1px solid var(--glass-edge); border-radius: var(--radius);
    box-shadow: var(--rim), var(--glass-shadow);
  }
  .panel { padding: 1rem; display: grid; gap: .75rem; min-width: 0; }
  .panel-heading, .detail, .demo-bar, .board-status { display: flex; align-items: center; gap: .55rem; min-width: 0; }
  .panel-heading, .detail { justify-content: space-between; }
  .panel-heading h2, .detail strong { overflow-wrap: anywhere; }
  .detail { font-size: .92rem; align-items: baseline; }
  .detail > span, .muted { color: var(--muted); font-size: .88rem; }
  .detail strong { text-align: right; min-width: 0; }
  .demo-bar {
    padding: .22rem .5rem .22rem .73rem; margin-bottom: .9rem; border: 1px solid var(--line); border-radius: 10px;
    background: var(--bar); justify-content: space-between; color: var(--muted); font-size: .84rem;
  }
  .demo-bar > span { font-weight: 700; white-space: nowrap; }
  .demo-bar select { width: auto; max-width: 66%; padding: .36rem .54rem; font-size: .88rem; }
  .field { display: grid; gap: .31rem; font-size: .9rem; font-weight: 650; min-width: 0; }
  .field small { color: var(--muted); font-weight: 400; }
  .check { display: flex; align-items: center; gap: .55rem; min-height: 44px; font-size: .93rem; cursor: pointer; }
  .check input { accent-color: var(--gold); width: 1.18rem; height: 1.18rem; flex: none; }
  .button {
    display: inline-flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; padding: .54rem .75rem;
    min-height: 44px; background: var(--well); border: 1px solid var(--brass); border-radius: 8px;
    font-size: .91rem; font-weight: 700; line-height: 1.35; text-decoration: none; color: var(--gold);
  }
  .button:hover:not(:disabled) { background: var(--selected); }
  .button.primary:not(:disabled) {
    background: var(--gold-metal);
    color: var(--metal-ink);
    border-color: var(--gold-edge);
    box-shadow: inset 0 1px #fff6df97, 0 .2rem .55rem #0006;
  }
  .button.primary:hover:not(:disabled) { filter: brightness(1.09); }
  .button.danger:not(:disabled) { color: var(--danger); border-color: #ad786f; }
  .button.danger:hover:not(:disabled) { background: #462b25; }
  .button:disabled { cursor: wait; background: #35302a; border-color: #675a46; color: #bfb19b; }
  .actions { display: flex; flex-wrap: wrap; gap: .55rem; min-width: 0; }
  .actions > .button { flex: 1 1 8rem; }
  .badge {
    display: inline-flex; align-items: center; flex: none; border: 1px solid var(--glass-edge); border-radius: 5px; padding: .12rem .44rem;
    font-size: .78rem; font-weight: 750; line-height: 1.45; background: #23242d; color: var(--ink);
  }
  .badge.ok { background: #25362c; color: #c1e7cf; border-color: #4a6855; }
  .badge.warn { background: #44301b; color: #ffe0aa; border-color: #84613c; }
  .badge.bad { background: #462b25; color: var(--danger); border-color: #80554c; }
  .badge.neutral { background: #34302a; color: #e3d4bd; border-color: #655842; }
  .store-details { min-width: 0; }
  .store-details > summary {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; gap: .24rem .5rem; min-height: 44px; padding: .65rem .75rem .65rem 1.8rem;
    list-style: none; border-radius: inherit; cursor: pointer;
  }
  .store-details > summary::-webkit-details-marker { display: none; }
  .store-details > summary::before {
    content: ""; position: absolute; left: .75rem; top: 1.15rem; width: .44rem; height: .44rem;
    border: solid var(--gold); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg);
  }
  .store-details[open] > summary::before { transform: rotate(45deg); }
  .store-title { overflow-wrap: anywhere; }
  .store-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem; }
  .store-summary { grid-column: 1 / -1; }
  .store-detail-content { border-top: 1px solid var(--line); padding: .85rem; }
  .board-status { flex-wrap: wrap; color: var(--muted); font-size: .87rem; }
  .board-status.board-empty {
    min-height: 7.2rem; padding: .75rem; align-content: flex-end; justify-content: center; text-align: center;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--rim);
    background: url("/assets/empty-board.svg") center .62rem / auto 4.3rem no-repeat var(--paper);
  }
  .empty-board {
    min-height: 7.2rem; padding-top: 5.15rem; justify-items: center;
    background: url("/assets/empty-board.svg") center .62rem / auto 4.3rem no-repeat var(--paper);
  }
  .tabs { display: flex; flex-wrap: wrap; padding: .2rem; background: var(--well); border: 1px solid var(--line); border-radius: 10px; gap: .18rem; }
  .button.tab { flex: 1 0 auto; padding: .45rem .48rem; border-color: transparent; background: transparent; color: var(--muted); }
  .button.tab[aria-pressed=true] {
    background: var(--gold-metal); color: var(--metal-ink); border-color: var(--gold-edge);
    box-shadow: inset 0 1px #fff6df97;
  }
  .ranks { padding: 0; list-style: none; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--rim); }
  .rank-row { display: grid; grid-template-columns: 2.42rem minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .49rem .77rem; border-bottom: 1px solid var(--line); min-height: 49px; }
  .rank-row:last-child { border-bottom: 0; }
  .rank-person { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .42rem; min-width: 0; }
  .rank-name { overflow-wrap: anywhere; }
  .rank-caption { display: flex; justify-content: space-between; gap: .7rem; padding-inline-end: .77rem; }
  .rank-amount { max-inline-size: min(32vw, 14rem); overflow-wrap: anywhere; text-align: right; color: var(--gold); font-weight: 740; }
  .rank-row:has(.rank-1) { background: linear-gradient(119deg,#413127,#1b1a23 48%,#211a19); }
  .rank-row:has(.rank-2) { background: linear-gradient(135deg,#343947,#1a1c25 72%); }
  .rank-row:has(.rank-3) { background: linear-gradient(135deg,#352823,#1c1b23 74%); }
  .rank-row.mine { background-color: #242630; font-weight: 750; }
  .rank {
    display: grid; place-items: center; min-width: 2rem; height: 2.15rem;
    background: #272a35; border-radius: .45rem; color: var(--ink);
    font: 750 .91rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums;
  }
  .rank:is(.rank-1, .rank-2, .rank-3) {
    height: 2.34rem; background-color: transparent; background-position: center;
    background-repeat: no-repeat; background-size: contain; font-weight: 850;
  }
  .rank-1 { background-image: url("/assets/medal-gold.svg"); color: var(--metal-ink); }
  .rank-2 { background-image: url("/assets/medal-silver.svg"); color: #faf1e7; }
  .rank-3 { background-image: url("/assets/medal-bronze.svg"); color: #ffdac3; }
  .verification { text-align: center; background: var(--well); padding: .85rem; border: 1px solid var(--line); border-radius: 8px; }
  .verification strong { display: block; color: var(--gold); font-size: 2.25rem; letter-spacing: .16em; }
  .bottom-nav {
    position: fixed; z-index: 1; bottom: 0; left: 0; right: 0; background: var(--bar);
    border-top: 1px solid var(--line); box-shadow: var(--rim); padding-bottom: env(safe-area-inset-bottom);
  }
  .nav-inner { display: flex; padding: .28rem .55rem; gap: .15rem; }
  .button.nav-item { flex: 1; min-width: 0; min-height: 49px; padding-inline: .15rem; white-space: nowrap; border-color: transparent; border-radius: 7px; background: none; color: var(--muted); }
  .button.nav-item[aria-current=page] {
    color: var(--metal-ink); background: var(--gold-metal); border-color: var(--gold-edge);
    box-shadow: inset 0 1px #fff6df97;
  }
  .feedback { padding: .64rem .75rem; border: 1px solid #705735; border-radius: 8px; background: #25232c; color: #ffe8ba; font-size: .9rem; }
  .feedback.error { background: #412720; border-color: #946052; color: var(--danger); }
  .feedback.success { background: #23352a; border-color: #4f705a; color: #c1e7cf; }
  .initial { padding: 2rem 1rem; color: var(--muted); }
  .feedback.offline-notice {
    display: flex; align-items: center; min-height: 3rem; padding-inline-start: 3.2rem;
    background: url("/assets/offline.svg") .65rem center / 1.95rem no-repeat #412720;
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .masthead, .bottom-nav, .panel:not(.empty-board), .store-details {
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
    }
    .masthead, .bottom-nav { background-color: #101117ee; }
    .panel:not(.empty-board), .store-details { background-color: #10111635; }
  }
}

@layer screen {
  .screen-mode {
    background: url("/assets/facets.svg") right top / min(72%, 72rem) auto no-repeat,
      radial-gradient(ellipse at 84% -5%, #232630, var(--ground) 62%);
    color: var(--ink);
  }
  .screen-mode #app { min-height: 100vh; }
  .screen-mode #app > .screen-empty { min-height: 100vh; align-content: center; }
  .screen {
    width: min(100%, 132rem); min-height: 100vh; padding: clamp(1rem, 3.2vw, 4.5rem); margin-inline: auto; display: grid;
    gap: clamp(.7rem, 1.65vw, 2rem); grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .screen-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--brass); }
  .screen-top > .feedback { margin-top: .65rem; }
  .screen-store { color: var(--gold); font-size: clamp(1rem, 2vw, 2.15rem); margin-bottom: .25rem; }
  .screen h1 { font-size: clamp(1.65rem, 4.3vw, 5rem); }
  .screen .board-status, .screen-footer { color: #dbccb4; font-size: clamp(.95rem, 1.32vw, 1.6rem); }
  .screen .board-status.board-empty { min-height: 0; padding: 0; align-content: initial; justify-content: flex-start; background: none; border: 0; box-shadow: none; }
  .screen .badge { font-size: .85em; }
  .screen .feedback { font-size: clamp(.92rem, 1.32vw, 1.6rem); }
  .screen .ranks {
    grid-row: 2; display: grid; align-content: stretch; grid-auto-flow: column; grid-template-rows: repeat(5, minmax(0, 1fr));
    grid-auto-columns: minmax(0, 1fr); gap: clamp(.2rem, .56vh, .72rem) 3%; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .screen .rank-row {
    border: 1px solid var(--line); border-radius: .22em; background-color: var(--bar); box-shadow: var(--rim);
    gap: .52em; padding: .19em .40em; font-size: clamp(1rem, min(2.8vw, 5.8vh), 3.4rem);
    grid-template-columns: 1.75em minmax(0, 1fr); min-height: 1.65em; line-height: 1.13; font-weight: 660;
  }
  .screen .rank { min-width: 0; width: 100%; height: 1.83em; font-size: .83em; }
  .screen .rank:is(.rank-1, .rank-2, .rank-3) { height: 1.98em; }
  .screen .rank-4 { background: #272a35; color: var(--ink); }
  .screen-empty {
    display: grid; align-self: center; margin: auto; text-align: center; padding: 7rem 1rem .75rem; color: var(--muted);
    background: url("/assets/empty-board.svg") center top / 8.4rem auto no-repeat;
    font-size: clamp(1rem, 2vw, 2rem);
  }
  .screen-mode #app > .screen-empty { padding: 0; background: none; }
  .screen-mode #app > .screen-empty::before {
    content: ""; display: block; width: 9rem; height: 7rem; margin: 0 auto .5rem;
    background: url("/assets/empty-board.svg") center / contain no-repeat;
  }
  .screen-mode #app > .screen-empty.is-offline::before { background-image: url("/assets/offline.svg"); }
  .screen-footer { grid-row: 3; display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: .6rem; }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .screen .rank-row { background-color: #171923e5; }
  }
  @media (orientation: portrait) {
    .screen .ranks { grid-auto-flow: row; grid-template-rows: repeat(8, minmax(0, 1fr)); grid-template-columns: minmax(0, 1fr); }
    .screen .rank-row { font-size: clamp(1.45rem, min(4.7vw, 5.6vh), 3.75rem); }
    .screen-header { display: grid; align-items: start; }
  }
}
@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .ranks-changed { animation: rank-fade 175ms ease-out; }
  }
  @keyframes rank-fade { from { opacity: .78; } }
}
