:root {
  --bg: #0f0b1e;
  --bg2: #171230;
  --card: #1d173a;
  --line: #34295f;
  --text: #ece7ff;
  --muted: #a99fd0;
  --gold: #e9b949;
  --gold2: #ffd978;
  --red: #e0525f;
  --green: #5bd08a;
  --blue: #6aa8ff;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #2a1d5a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100vh;
}
a { color: var(--gold2); }
[hidden] { display: none !important; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: rgba(15, 11, 30, .85);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 18px; }
.brand b { color: var(--gold); }
.eye {
  width: 26px; height: 16px; border-radius: 50%; border: 2px solid var(--gold);
  background: radial-gradient(circle, var(--gold2) 0 3px, #2a1d5a 4px 100%);
}
.online { color: var(--muted); font-size: 13px; }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
.hero h1 { font-size: clamp(22px, 4vw, 34px); line-height: 1.2; margin: 18px 0 8px; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero p { color: var(--muted); max-width: 760px; margin: 0 0 16px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin: 14px 0;
}
.card h2 { margin: 0 0 14px; font-size: 19px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h3 { margin: 14px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.step {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #1b1300; font-size: 14px; font-weight: 700;
}
.row { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; align-items: start; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, .05); }
.row:first-of-type { border-top: 0; }
.row > label { padding-top: 8px; color: var(--muted); }
.row small { opacity: .8; }
.pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.state { color: var(--muted); font-size: 13.5px; flex: 1 1 260px; }
.state.ok { color: var(--green); }
.state.bad { color: var(--red); }
input, select {
  background: #120e26; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font: inherit; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.row input, .row select { width: min(100%, 320px); }
.btn {
  background: #2b2252; color: var(--text); border: 1px solid #4a3d85; border-radius: 8px;
  padding: 9px 14px; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1b1300; border-color: var(--gold); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { background: #4a1621; border-color: var(--red); color: #ffd9de; font-weight: 700; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.hint { color: var(--muted); font-size: 13.5px; }
.saves { grid-column: 2; display: grid; gap: 6px; }
.saves label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.saves label:has(input:checked) { border-color: var(--gold); background: rgba(233, 185, 73, .08); }
.lobby, .room { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.create, .join { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.join input { flex: 1; text-transform: uppercase; }
.rooms { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rooms li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #150f2c; }
.rooms li .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rooms li .who { color: var(--muted); font-size: 13px; }
.rooms li.empty { color: var(--muted); justify-content: center; border-style: dashed; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.code { font-family: ui-monospace, Consolas, monospace; color: var(--gold2); letter-spacing: 2px; }
.chat { display: flex; flex-direction: column; min-height: 260px; }
.lines { list-style: none; margin: 0; padding: 8px; flex: 1; overflow-y: auto; max-height: 300px; min-height: 180px; background: #120e26; border: 1px solid var(--line); border-radius: 10px; }
.lines li { padding: 2px 0; word-wrap: break-word; }
.lines b { color: var(--gold2); font-weight: 600; }
.lines .sys { color: var(--muted); font-style: italic; }
/* the day's check-in and win quests (app.js dailyHtml), on the Hành trình's Đối thủ tab; its tab dotted while one waits */
.jdaily { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(233, 185, 73, .05); }
.jdaily > summary { padding: 9px 12px; cursor: pointer; }
.jdaily .jq-wait { color: var(--gold2); font-weight: 600; }
.jq-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 0 10px 10px; }
.jq { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #120e26; }
.jq.ready { border-color: var(--gold2); box-shadow: 0 0 0 1px rgba(233, 185, 73, .35) inset; }
.jq.got { opacity: .65; }
.jq-name { font-weight: 600; }
.jq-stars { color: var(--gold2); font-weight: 700; }
.jq-bar { display: block; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.jq-bar i { display: block; height: 100%; background: var(--gold2); }
.jq-n { color: var(--muted); }
.jq-got { color: var(--muted); font-size: 13px; }
.jq .btn { align-self: flex-start; }
#jhub-tabs .tab.dot::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--red); vertical-align: 2px; }
@media (max-width: 520px) { .jq-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the decks kept (two at most): which one duels, on the Hành trình's Bộ bài and Đối thủ tabs (app.js decksBar) */
.jdecks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.jdecks .lbl { color: var(--muted); }
.jdecks .seg { margin: 0; max-width: 100%; }
.jdecks .seg button { max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jdecks input { width: 14em; max-width: 100%; }
.jdecks-hint { margin: -4px 0 10px; }
/* a chat's text can be selected and copied, its links pressed (long-pressed on a phone to copy), also over the game
   (.game takes selection away for the stage's sake) */
.lines li { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.lines a.chat-link { color: #8ec5ff; text-decoration: underline; overflow-wrap: anywhere; }
.lines a.chat-link:hover { color: #b9dcff; }
.say { display: flex; gap: 8px; margin-top: 8px; }
.say input { flex: 1; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #150f2c; }
.seat .label { font-size: 12px; color: var(--muted); }
.seat .name { font-size: 17px; font-weight: 600; margin: 2px 0; }
.seat.p1 { border-left: 4px solid var(--red); }
.seat.p2 { border-left: 4px solid var(--blue); }
.seat .ready { color: var(--green); font-size: 13px; }
.seat .wait { color: var(--muted); font-size: 13px; }
.help ul { margin: 0; padding-left: 20px; color: var(--muted); }
.help li { margin: 4px 0; }
kbd { background: #2b2252; border: 1px solid #4a3d85; border-radius: 5px; padding: 0 5px; font-size: 12px; font-family: inherit; color: var(--text); }
.foot { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 0 30px; }

/* the game */
.game { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; z-index: 10; }
.bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #0d0a1a; border-bottom: 1px solid var(--line); font-size: 14px; }
.bar .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .score { color: var(--gold2); font-weight: 700; }
.bar .net { color: var(--muted); font-size: 12px; }
.stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
/* The canvas covers the stage exactly, whatever SDL puts in its style (at a device pixel ratio other than 1 it
   writes the window's size there, which overflowed the stage): SDL takes this size for the window (duel.js
   sends it a resize) and the game fits its 4:3 picture inside. */
#game-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: contain; display: block;
               outline: none; background: #000; }
/* the game's menus, its title and its debug menu, between duels (veil.js): the stage's black instead (not hidden: the
   canvas keeps the keyboard) */
#game-canvas.veiled { opacity: 0; }
/* the game area: clear of a phone's notch and corners, no text selection or callout on long presses */
.game { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* pointer play (pointer.js). The column of buttons at the stage's right edge, over the black beside the 4:3 picture on
   a wide screen, over the picture's edge otherwise; to the left while the chat or the duel's log is open there */
.pbar { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 3; display: flex; flex-direction: column;
        gap: 8px; min-width: 150px; }
.pbar[hidden] { display: none; }
.stage:has(.drawer:not([hidden])) .pbar { right: auto; left: 12px; }
.pbtn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 12px; cursor: pointer;
        border: 1px solid rgba(233, 185, 73, .35); background: rgba(16, 12, 34, .78); color: var(--text); font: inherit;
        font-size: 14px; font-weight: 600; text-align: left; touch-action: none; backdrop-filter: blur(6px); white-space: nowrap;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .35); transition: background .12s, border-color .12s, transform .06s; }
.pbtn:hover { border-color: var(--gold); background: rgba(40, 30, 84, .9); }
.pbtn:active { transform: scale(.97); }
.pbtn.primary { border-color: var(--gold2); background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1b1230; }
.pbtn.primary:hover { filter: brightness(1.06); }
.pbtn .pp-label { flex: 1; }
.pico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* the pad's buttons as the PlayStation draws them, beside what they do */
kbd.ps { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 700 11px/1 system-ui;
         background: #0b0918; border: 1px solid rgba(255, 255, 255, .25); }
.ps-cross { color: #7cb6ff; } .ps-circle { color: #ff7a85; } .ps-triangle { color: #5fd9a8; } .ps-square { color: #f49bd3; }
.pbtn.primary kbd.ps { background: rgba(27, 18, 48, .85); border-color: transparent; }
/* over the picture: the outlines, the line saying what to do, the card pointed at, a card's choices */
.pp { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.pp-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pp-marks polygon { fill: rgba(255, 217, 120, .10); stroke: var(--gold2); stroke-width: 3; stroke-linejoin: round; }
.pp-marks .pp-act { filter: drop-shadow(0 0 6px rgba(255, 217, 120, .9)); }
.pp-marks .pp-see { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .8); stroke-width: 2; }
.pp-marks .pp-off { fill: rgba(0, 0, 0, .25); stroke: rgba(255, 255, 255, .25); stroke-width: 1.5; stroke-dasharray: 4 4; }
.pp-marks .pp-can { fill: rgba(91, 208, 138, .18); stroke: var(--green); stroke-width: 3; stroke-dasharray: 8 6; animation: pp-pulse 1.4s ease-in-out infinite; }
.pp-marks .pp-foe { fill: rgba(224, 82, 95, .18); stroke: var(--red); stroke-width: 3; stroke-dasharray: 8 6; animation: pp-pulse 1.4s ease-in-out infinite; }
@keyframes pp-pulse { 50% { stroke-opacity: .45; } }
.pp-hint.pp-hint-side { left: auto; right: 8px; transform: none; } /* (off the duel's rank: pointer.js rankHint) */
.pp-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: min(560px, calc(100% - 24px)); padding: 7px 16px;
           border-radius: 999px; background: rgba(12, 9, 26, .82); border: 1px solid rgba(233, 185, 73, .45); color: var(--text);
           font-size: 14px; font-weight: 600; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); backdrop-filter: blur(6px); }
.pp-card { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 168px; padding: 10px; border-radius: 14px;
           background: rgba(16, 12, 34, .86); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.pp-art { display: block; width: 100%; height: auto; aspect-ratio: 102 / 96; border-radius: 8px; background: #0b0918; image-rendering: pixelated; margin-bottom: 8px; }
.pp-name { display: block; font-size: 15px; line-height: 1.25; color: var(--gold2); }
.pp-line { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.pp-stats { margin: 6px 0 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-menu { position: absolute; min-width: 190px; padding: 6px; border-radius: 14px; pointer-events: auto; background: rgba(20, 15, 42, .96);
           border: 1px solid rgba(233, 185, 73, .55); box-shadow: 0 12px 32px rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: 2px;
           animation: pp-in .12s ease-out; }
@keyframes pp-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.pp-item { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 10px;
           background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.pp-item:hover:not(:disabled), .pp-item:focus-visible { background: rgba(233, 185, 73, .16); outline: none; }
.pp-item:first-child:not(:disabled) { color: var(--gold2); }
.pp-item:disabled { cursor: default; color: rgba(236, 231, 255, .4); }
.pp-item .pp-label { flex: 1; }
.pp-why { flex-basis: 100%; padding-left: 30px; margin-top: -4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.pp-card.pp-gone { display: none; }
/* the hand's fusions (pointer.js showWays): folded under the line (a narrow screen), open in the black at the right
   where the picture leaves room (.pp-fuse-side); the cards of the one pointed at outlined and numbered over the hand */
.pp-fuse { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); width: max-content; max-width: min(420px, calc(100% - 24px));
           pointer-events: auto; border-radius: 14px; background: rgba(16, 12, 34, .9); border: 1px solid rgba(124, 182, 255, .45);
           box-shadow: 0 8px 24px rgba(0, 0, 0, .45); backdrop-filter: blur(6px); overflow: hidden; }
.pp-fuse-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px; border: 0; background: transparent;
                color: #a9cdff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pp-fuse-head::after { content: "▾"; margin-left: 2px; transition: transform .15s; }
.pp-fuse.open .pp-fuse-head::after { transform: rotate(180deg); }
.pp-fuse-list { display: none; flex-direction: column; gap: 2px; padding: 0 6px 6px; max-height: 48vh; overflow: auto; }
.pp-fuse.open .pp-fuse-list { display: flex; }
.pp-fuse-item { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border: 0; border-radius: 10px; background: transparent;
                color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.pp-fuse-item:hover, .pp-fuse-item:focus-visible { background: rgba(124, 182, 255, .16); outline: none; }
.pp-fuse-res { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; font-size: 14px; }
.pp-fuse-res b { color: var(--gold2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-fuse-ad { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-fuse-from { font-size: 12px; line-height: 1.3; color: var(--muted); }
.pp-fuse.pp-fuse-side { left: auto; right: 12px; top: 12px; transform: none; max-width: none; max-height: calc(100% - 24px);
                        display: flex; flex-direction: column; }
.pp-fuse.pp-fuse-side .pp-fuse-head { cursor: default; }
.pp-fuse.pp-fuse-side .pp-fuse-head::after { content: none; }
.pp-fuse.pp-fuse-side .pp-fuse-list { display: flex; max-height: none; overflow: auto; }
.pp-fuse.pp-fuse-side .pp-fuse-res { flex-direction: column; align-items: flex-start; gap: 1px; }
.pp-fuse.pp-fuse-side .pp-fuse-res b { white-space: normal; line-height: 1.25; }
.pp-fuse.pp-fuse-side .pp-fuse-head { white-space: normal; text-align: left; }
.pp-fuse-item.pp-fuse-weak { opacity: .55; }
.pp-fuse-item.pp-fuse-weak:hover { opacity: .85; }
.pbar-hint { display: none; }
.pp-marks .pp-mat { fill: rgba(124, 182, 255, .16); stroke: #7cb6ff; stroke-width: 3; filter: drop-shadow(0 0 6px rgba(124, 182, 255, .8)); }
.pp-marks .pp-num { fill: #7cb6ff; stroke: #0b0918; stroke-width: 2; }
.pp-marks .pp-num-t { fill: #0b0918; font: 800 14px/1 system-ui, sans-serif; text-anchor: middle; }
/* a wide screen: the buttons in a strip of their own under the picture, in a row at its middle, near the cards; the
   canvas the smaller by it (pointer.js style) */
@media (min-width: 901px) and (min-height: 521px) {
  .stage.pp-dock #game-canvas { height: calc(100% - 62px) !important; }
  .stage.pp-dock .pbar, .stage.pp-dock:has(.drawer:not([hidden])) .pbar { top: auto; bottom: 9px; right: auto; left: 50%;
    transform: translateX(-50%); flex-direction: row; min-width: 0; gap: 10px; max-width: calc(100% - 24px); }
  .stage.pp-dock .pbtn { flex: none; }
  .stage.pp-dock .pbtn { min-height: 44px; }
  .stage.pp-dock .pbar-hint:not([hidden]) { display: block; flex: 0 1 auto; min-width: 0; align-self: center; max-width: 44vw; padding: 0 6px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--text); }
  .stage.pp-dock .pp-fuse:not(.pp-fuse-side) { top: 10px; }
}
/* a narrow window, a phone: the buttons smaller */
@media (max-width: 900px) {
  .pbar { min-width: 0; right: 8px; }
  .pbtn { padding: 8px 10px; }
}
@media (max-height: 460px) {
  /* a phone on its side: the duel's bar thin, the picture as large as it goes */
  .game .bar { padding: 2px 8px; gap: 6px; font-size: 13px; }
  .game .bar .btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .pp-hint { top: 6px; font-size: 13px; padding: 5px 12px; }
  .pp-fuse { top: 42px; }
  .pp-fuse-head { padding: 4px 10px; }
  .pp-fuse-list { max-height: 60vh; }
  .pbar { gap: 6px; }
  .pbtn { min-height: 40px; font-size: 13px; }
}
#pointer[aria-pressed="false"], #fuse-hints[aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
/* a journey's restart: away from the buttons that play, plainly what it is */
.actions .reset-link { margin-left: auto; color: var(--muted); border-color: transparent; }
.actions .reset-link:hover { color: #ffd9de; border-color: var(--red); }
.rotate { display: none; position: absolute; left: 50%; top: 8px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px;
          background: rgba(19, 14, 38, .9); border: 1px solid var(--gold); font-size: 13px; pointer-events: none; white-space: nowrap; }
.touch-only { display: none; }
/* a phone's way of playing named on the bar's button (app.js wayButton), not struck through */
#pointer.way[aria-pressed="false"] { opacity: 1; text-decoration: none; }
.play-way { margin: 0 0 4px; }
@media (pointer: coarse) and (hover: none) {
  .keyboard-only { display: none !important; }
  .row.touch-only { display: grid; } /* (folded away with the setup: #setup.folded .row) */
  .btn.small { min-height: 40px; padding: 8px 12px; }
  input, select { font-size: 16px; } /* iOS zooms into a smaller one */
  .bar .net { display: none; }
  .drawer .lines { max-height: 90px; min-height: 60px; }
  .drawer { top: 8px; bottom: auto; }
}
@media (pointer: coarse) and (hover: none) and (orientation: portrait) {
  /* upright works too (the pad goes below the picture): the hint only says landscape is roomier, then goes */
  .game:not([hidden]) .rotate { display: block; animation: hint-out 1s 3s forwards; }
}
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }
/* the other player's card view (duel.js conceal): opaque, over the picture only */
.cover { position: absolute; inset: 0; display: grid; place-items: center; background: #0d0a1a;
         background-image: radial-gradient(600px 300px at 50% 45%, #2a1d5a 0%, transparent 70%); }
.cover p { margin: 0; padding: 12px 20px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 15px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 3, 12, .55); }
.overlay .box { background: var(--card); border: 1px solid var(--gold); border-radius: var(--radius); padding: 18px 22px; max-width: 420px; text-align: center; }
.overlay p { margin: 0; font-size: 16px; }
/* while the game starts and goes to the duel (its debug menu, the save screens): nothing of it shows */
.overlay.solid { background: #05030c; }
.overlay.solid .box { border-color: var(--line); }
.overlay.solid .box::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
                              border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(29, 23, 58, .92); border: 1px solid var(--line); border-radius: 99px; padding: 6px 16px; font-size: 14px; pointer-events: none; }
.toast.bad { border-color: var(--red); }
.drawer { position: absolute; right: 10px; bottom: 10px; width: min(340px, calc(100% - 20px)); background: rgba(19, 14, 38, .94); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; }
.drawer .lines { max-height: 220px; min-height: 120px; }
/* the chat everyone sees (app.js siteChat): the home page's card, the Hành trình's drawer over its hub and game */
#site-chat .lines { max-height: 260px; min-height: 120px; }
.site-drawer { z-index: 4; }
.site-drawer h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-size: 14px; color: var(--muted); }
#jchat-toggle .unread { margin-left: 5px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }
.drawer.keys { top: 10px; bottom: auto; font-size: 14px; }
.drawer.keys p { margin: 4px 0; }

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr; }
  .row > label { padding-top: 0; }
  .saves { grid-column: 1; }
  .lobby, .room, .seats { grid-template-columns: 1fr; }
  main { padding: 10px; }
  .card { padding: 14px; }
  .bar { font-size: 13px; gap: 6px; }
}



/* the key layout (keys.js) */
.keys { margin-top: 10px; }
.top #open-keys { margin-left: 10px; }
.dialog { background: var(--card); color: inherit; border: 1px solid var(--gold); border-radius: var(--radius); padding: 18px 20px;
          width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.dialog::backdrop { background: rgba(5, 3, 12, .7); }
.dialog h2 { margin: 0 0 6px; font-size: 18px; }
.dialog > .hint { margin: 0 0 12px; }
.dialog .actions { margin-top: 12px; }
.keygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.keycap { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
.keycap kbd { min-width: 34px; text-align: center; }
.keycap.listening { border-color: var(--gold); background: rgba(233, 185, 73, .12); }
#keys-summary kbd { margin: 0 1px; }

/* watching a room: the board, the room's chat beside it (below on phones) */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.watch .chat .lines { max-height: 420px; }
.rooms li .room-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 980px) { .watch { grid-template-columns: minmax(0, 1fr); } }

/* spectator board (js/view.js) */
.bd-p1 { --bd-pc: var(--red); --bd-pt: #ff8d97; }
.bd-p2 { --bd-pc: var(--blue); --bd-pt: #9cc5ff; }
.bd-pn { color: var(--bd-pt); font-weight: 700; }
.bd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 920px; margin: 0 auto; min-width: 0; }
.bd-mat {
  min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: radial-gradient(520px 280px at 50% 50%, #251b4c 0%, transparent 70%), linear-gradient(180deg, #161131, #120e26);
}

/* a player's bar: name and wins, LP on the right, deck and hand below */
.bd-info {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who lp" "counts lp";
  align-items: center; column-gap: 10px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line); border-left: 4px solid var(--bd-pc);
  background: #150f2c; background: linear-gradient(90deg, color-mix(in srgb, var(--bd-pc) 14%, #150f2c), #150f2c 65%);
}
.bd-info.bd-turn { border-color: var(--gold); border-left-color: var(--bd-pc); box-shadow: 0 0 0 1px rgba(233, 185, 73, .35), 0 0 18px rgba(233, 185, 73, .3); }
.bd-info.bd-win { border-color: var(--gold2); border-left-color: var(--bd-pc); box-shadow: 0 0 0 2px rgba(255, 217, 120, .5), 0 0 26px rgba(233, 185, 73, .45); }
.bd-who { grid-area: who; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bd-info .bd-name { font-size: 16px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-wins { flex: none; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.bd-counts { grid-area: counts; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.bd-hand { display: inline-flex; align-items: center; gap: 6px; }
.bd-backs { display: inline-flex; gap: 2px; }
.bd-mini { display: inline-block; width: 9px; height: 13px; border-radius: 2px; border: 1px solid #8a76d0;
           background: repeating-linear-gradient(45deg, #3a2a6c 0 2px, #281d4e 2px 4px); }
.bd-lp { grid-area: lp; text-align: right; line-height: 1; }
.bd-lp small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; margin-bottom: 2px; }
.bd-lp b { display: inline-block; font-size: clamp(22px, 6.5vw, 30px); font-weight: 800; color: var(--gold2); font-variant-numeric: tabular-nums; transform-origin: right center; }
.bd-zero b { color: var(--red); }
.bd-hit b { animation: bd-hit .9s ease-out; }
.bd-heal b { animation: bd-heal .9s ease-out; }
.bd-delta { margin-left: 6px; font-weight: 700; letter-spacing: 0; animation: bd-fade 2.6s ease-in forwards; }
.bd-hit .bd-delta { color: var(--red); }
.bd-heal .bd-delta { color: var(--green); }
@keyframes bd-hit { from { color: var(--red); transform: scale(1.15); } }
@keyframes bd-heal { from { color: var(--green); transform: scale(1.1); } }
@keyframes bd-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* rows of five zones; each zone is a size container, so a tile's text follows its own width */
.bd-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(4px, 1.4vw, 10px); width: 100%; max-width: 540px; margin: 0 auto; }
.bd-zone {
  position: relative; aspect-ratio: 5 / 7; min-width: 0; container-type: inline-size; border-radius: 6px;
  border: 1px dashed rgba(169, 159, 208, .2); border-color: color-mix(in srgb, var(--bd-pc) 28%, transparent);
}
.bd-empty::after {
  content: "Quái thú"; position: absolute; inset: 0; display: grid; place-items: center; padding: 2px; text-align: center;
  font-size: 8px; font-size: clamp(7px, 10cqw, 10px); line-height: 1.2; color: rgba(169, 159, 208, .3);
}
.bd-mag .bd-empty::after { content: "Phép · Bẫy"; }
.bd-tile {
  position: absolute; inset: -1px; display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  padding: 3px 4px; padding: 6cqw 7cqw; border-radius: 6px; line-height: 1.15;
  border: 1px solid var(--bd-kc, #6d5bb0); background: var(--bd-kbg, #2a1f50); color: var(--bd-kt, var(--text));
  font-size: 8px; font-size: clamp(8px, 12cqw, 12.5px); box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.bd-tile > * { flex: none; min-width: 0; }
/* defense: the card lies sideways in its zone, with THỦ above it */
.bd-tile.bd-def { inset: auto -1px; top: 50%; transform: translateY(-50%); aspect-ratio: 7 / 5; }
.bd-tag {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%); z-index: 1; padding: 0 5px; border-radius: 99px;
  font-size: 8px; font-size: clamp(7px, 10cqw, 11px); font-weight: 800; line-height: 1.45; letter-spacing: .5px;
  color: #0f0b1e; background: var(--blue);
}
.bd-tile .bd-name {
  font-weight: 600; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.bd-meta { font-size: .78em; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-lv { color: var(--gold2); opacity: 1; }
.bd-stars { display: none; font-size: .85em; letter-spacing: -1px; }
.bd-stats { margin-top: auto; white-space: nowrap; overflow: hidden; font-size: 1.3em; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bd-stats b { color: var(--gold2); }
.bd-stats span { font-size: .72em; font-weight: 600; opacity: .7; }
.bd-def .bd-name { -webkit-line-clamp: 1; line-clamp: 1; }
@container (min-width: 90px) {
  .bd-stars { display: inline; }
  .bd-lvn { display: none; }
}
@container (max-width: 89px) {
  .bd-def .bd-meta { display: none; }
  .bd-def .bd-name { -webkit-line-clamp: 2; line-clamp: 2; }
}
.bd-spell { text-align: center; }
.bd-spell .bd-name { margin: auto 0; -webkit-line-clamp: 4; line-clamp: 4; }
.bd-kind { font-size: .78em; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--bd-kl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the card colors (monster tan, magic green, trap purple, as on the real cards) */
.bd-k-monster { --bd-kc: #b48a3c; --bd-kbg: linear-gradient(165deg, #4a3616, #261b0b); --bd-kt: #f6ead0; --bd-kl: #f0c873; }
.bd-k-magic { --bd-kc: #33b98d; --bd-kbg: linear-gradient(165deg, #14503d, #0a2a21); --bd-kt: #e0f7ee; --bd-kl: #7fe3bf; }
.bd-k-equip { --bd-kc: #86c04a; --bd-kbg: linear-gradient(165deg, #2f4e15, #17280b); --bd-kt: #eaf6dc; --bd-kl: #b8e47e; }
.bd-k-ritual { --bd-kc: #4fa0e0; --bd-kbg: linear-gradient(165deg, #173c5e, #0c2034); --bd-kt: #e2f0fc; --bd-kl: #8cc8ff; }
.bd-k-trap { --bd-kc: #c860b4; --bd-kbg: linear-gradient(165deg, #4d1a49, #290e29); --bd-kt: #fae3f5; --bd-kl: #f29ae0; }
.bd-back {
  border: 1px solid #7a68c0;
  background: radial-gradient(ellipse 30% 22% at 50% 50%, #1b1338 0 70%, var(--gold) 74% 84%, transparent 88%),
              repeating-linear-gradient(45deg, #3a2a6c 0 3px, #281d4e 3px 6px);
}
.bd-tile.bd-back { align-items: center; justify-content: center; }
.bd-up { font-size: .85em; font-weight: 700; color: var(--gold2); }

/* the middle strip: duel, turn, field; the winner's banner once it is over */
.bd-mid {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; padding: 5px 8px; margin: 2px 0;
  text-align: center; font-size: 13.5px; color: var(--muted);
  border-top: 1px solid rgba(233, 185, 73, .25); border-bottom: 1px solid rgba(233, 185, 73, .25);
  background: linear-gradient(90deg, transparent, rgba(233, 185, 73, .08), transparent);
}
.bd-mid > * { min-width: 0; overflow-wrap: anywhere; }
.bd-field { font-size: 12px; color: var(--gold2); border: 1px solid rgba(233, 185, 73, .4); border-radius: 99px; padding: 0 8px; white-space: nowrap; }
.bd-mid.bd-won { padding: 8px; background: linear-gradient(90deg, transparent, rgba(233, 185, 73, .2), transparent); border-color: rgba(233, 185, 73, .6); }
.bd-banner { flex: 0 1 100%; min-width: 0; overflow-wrap: anywhere; font-size: clamp(19px, 5.5vw, 26px); font-weight: 800; line-height: 1.2; color: var(--gold2); text-shadow: 0 0 14px rgba(233, 185, 73, .5); }

/* the cards used: below the mat on phones (a column per player), beside it on wider screens */
.bd-used { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--card), var(--bg2)); }
.bd-used h3 { margin: 0 0 8px; font-size: 14px; color: var(--gold2); }
.bd-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bd-group { min-width: 0; }
.bd-group h4 { margin: 0 0 5px; padding-left: 6px; border-left: 3px solid var(--bd-pc); font-size: 12.5px; color: var(--bd-pt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-group h4 span { color: var(--muted); font-weight: 500; }
.bd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.bd-u { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 2px 6px; font-size: 12.5px; line-height: 1.3;
        border-left: 3px solid var(--bd-kc); border-radius: 0 6px 6px 0; background: rgba(255, 255, 255, .035); }
.bd-un { flex: 1; min-width: 0; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.bd-us { flex: none; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.bd-none { margin: 0; color: var(--muted); font-size: 12.5px; font-style: italic; }

/* no duel running */
.bd-wait {
  display: grid; justify-items: center; gap: 10px; max-width: 920px; margin: 0 auto; padding: 40px 16px; text-align: center;
  color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(21, 15, 44, .6);
}
.bd-wait p { margin: 0; }
.bd-wait-card { width: 56px; aspect-ratio: 5 / 7; border-radius: 6px; box-shadow: 0 0 18px rgba(233, 185, 73, .18); animation: bd-breathe 3.2s ease-in-out infinite; }
.bd-score { font-size: 13px; overflow-wrap: anywhere; }
@keyframes bd-breathe { 50% { opacity: .55; transform: translateY(-3px); } }

@media (min-width: 760px) {
  .bd { grid-template-columns: minmax(0, 1fr) 250px; align-items: start; }
  .bd-mat { gap: 8px; padding: 12px; }
  .bd-info { padding: 7px 12px; }
  .bd-info .bd-name { font-size: 17px; }
  .bd-groups { grid-template-columns: 1fr; }
  .bd-list { max-height: 300px; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-hit b, .bd-heal b, .bd-wait-card { animation: none; }
}

/* accounts (account.js): the header's chip, the marks after names (the same ★ as on Chocobo Racing Online) */
.top .acct { margin-left: 10px; max-width: 46vw; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.acct-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top .acct.in { border-color: var(--gold); }
.top { gap: 8px; }
.top .online { margin-left: auto; }
.mstr { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .3em; border-radius: 999px;
        font-size: .78em; font-weight: 900; line-height: 1; color: #3b2400;
        background: linear-gradient(135deg, #fff3b0 0%, #ffd54f 35%, #ffb300 65%, #ff8f00 100%);
        box-shadow: 0 0 0 1px rgba(255, 214, 79, .9), 0 0 8px rgba(255, 179, 0, .75); vertical-align: .08em;
        text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.vrf { color: var(--green); font-weight: 700; font-size: .9em; }
.link { background: none; border: 0; padding: 0; color: var(--gold2); text-decoration: underline; cursor: pointer; font: inherit; }
#name:disabled { opacity: 1; color: var(--muted); border-color: var(--line); background: transparent; cursor: default; } /* the account's name: shown, not typed */
.dialog h2 { display: flex; align-items: center; gap: 8px; }
.dialog h2 .close { margin-left: auto; }
.dialog.wide { width: min(820px, calc(100vw - 24px)); }
.tabs { display: flex; gap: 4px; margin: 8px 0 12px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; font: inherit; cursor: pointer; }
.tab.on { color: var(--gold2); border-bottom-color: var(--gold); }
.acct-form { display: grid; gap: 10px; }
.acct-form label { display: grid; gap: 4px; color: var(--muted); font-size: 13.5px; }
.acct-form input, .acct-form textarea { width: 100%; }
textarea { background: #120e26; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; resize: vertical; }
.btn.bad { border-color: rgba(224, 82, 95, .6); color: #ffb3ba; }
.btn.bad:hover:not(:disabled) { border-color: var(--red); }
select.small { padding: 4px 8px; font-size: 13px; }
/* Hành trình's 🏅 (the duel's rank, 10/11): a button's look with the native list under it (its select over the whole
   button, unseen): a phone's own picker opens, the keys and a screen reader have a real select; the medal alone on a bar
   with no room for the words (667-900 px wide: the bar's other buttons fill it) */
/* the deck's Ghép với (10/11): its select a width of its own (sized by its names instead, every drawing measured them all),
   the note over the lists, each row's line of what it makes */
.deckfind select.into { flex: 1 1 260px; width: 260px; max-width: 100%; }
.deckhint.into { color: var(--gold2); border: 1px solid rgba(233, 185, 73, .35); border-radius: 8px; padding: 6px 10px; background: rgba(233, 185, 73, .05); }
.deckhint.into .btn { margin-left: 6px; vertical-align: middle; }
.deckedit .clist li { flex-wrap: wrap; }
.clist li .fz { order: 1; flex-basis: 100%; padding-left: 48px; margin-top: -2px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.clist li .fz b { color: var(--text); font-weight: 600; }
/* a deploy's progress (app.js showProgress, 10/11): the players still in a duel it waits for, as a bar */
.upbar { position: relative; display: block; flex: none; width: 90px; height: 8px; border-radius: 4px; overflow: hidden;
  background: rgba(255, 255, 255, .14); }
.upbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .5s ease; }
.upbar.big { width: auto; height: 18px; border-radius: 9px; margin: 6px 0 10px; }
.upbar.big b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px;
  color: var(--text); text-shadow: 0 1px 2px #000; }
.jrank { position: relative; display: inline-flex; align-items: center; gap: 5px; }
.jrank select { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); min-width: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
  font-size: 16px; /* (iOS zooms into a smaller one, even unseen) */ }
.jrank:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; }
.jrank.on { border-color: var(--gold); }
@media (max-width: 900px) { .jrank-now { display: none; } }

/* a master's tools (master.js): the menu on a name, ✕ on a chat line, the panel */
.who-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; border-bottom: 1px dotted rgba(255, 217, 120, .5); }
.who-btn:hover { color: var(--gold2); }
.lines li { position: relative; padding-right: 44px; }
/* a line's own buttons (app.js addLine): answer it, a master's take it down */
.line-acts { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.line-del { background: none; border: 0; color: var(--muted); cursor: pointer; opacity: .35; font-size: 12px; }
.lines li:hover .line-del, .line-del:focus { opacity: 1; color: var(--red); }
.menu { position: fixed; z-index: 30; min-width: 220px; max-width: calc(100vw - 16px); background: var(--card); border: 1px solid var(--gold);
        border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); display: grid; }
.menu-head { margin: 4px 8px 6px; font-weight: 700; }
.menu-item { background: none; border: 0; color: var(--text); text-align: left; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer; }
.menu-item:hover:not(:disabled) { background: rgba(233, 185, 73, .12); }
.menu-item.bad { color: #ffb3ba; }
.menu-item:disabled { color: var(--muted); cursor: default; }
.m-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; max-height: 55vh; overflow-y: auto; }
.m-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #150f2c; display: grid; gap: 6px; }
.m-list li.empty { color: var(--muted); text-align: center; border-style: dashed; }
.u-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.u-meta { color: var(--muted); font-size: 13px; }
.u-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.pill.bad { color: #ffb3ba; border-color: rgba(224, 82, 95, .6); }
.pill.ok { color: var(--green); border-color: rgba(91, 208, 138, .5); }
.m-password { border: 1px solid var(--gold); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: rgba(233, 185, 73, .08); }
.m-password code { font-size: 16px; color: var(--gold2); user-select: all; }
.code { font-family: ui-monospace, Consolas, monospace; }

/* a master's announcement: a band under the header for everybody */
.announce { position: sticky; top: 57px; z-index: 4; display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 16px;
            background: linear-gradient(90deg, rgba(255, 179, 0, .22), rgba(233, 185, 73, .08)); border-bottom: 1px solid var(--gold); }
.announce p { margin: 0; flex: 1; color: var(--gold2); font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .announce { top: 53px; padding: 8px 10px; }
  .top .acct { max-width: 38vw; }
}
.acct-form .state { flex: none; margin: 0; }
.acct-form .state:empty { display: none; }
.acct-form .hint { margin: 0; }
#m-q { text-transform: none; }

/* ranked duels (ranks.js): the boards, the duels just played, a player's card */
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; cursor: pointer; white-space: nowrap; }
.check input { width: auto; flex: none; accent-color: var(--gold); }
.check:has(input:disabled) { opacity: .55; cursor: default; }
.tag.ranked { color: var(--gold2); border-color: rgba(233, 185, 73, .6); }
/* the online Elo board, a trial for now (index.html #ranks) */
.tag.beta { color: var(--gold2); border-color: rgba(233, 185, 73, .6); vertical-align: middle; }
.beta-note { margin: 4px 0 10px; padding: 6px 10px; border-left: 3px solid var(--gold); background: rgba(233, 185, 73, .07); border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--text, inherit); }
.rank-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rank-tools .tabs { margin: 0; border-bottom: 0; flex-wrap: wrap; }
.ranks { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; margin-top: 10px; }
.ranks h3 { margin-top: 0; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 460px; overflow-y: auto; }
.board li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 64px; align-items: center; gap: 8px; padding: 7px 10px;
            border: 1px solid var(--line); border-radius: 9px; background: #150f2c; }
.board li.empty { display: block; color: var(--muted); text-align: center; border-style: dashed; }
.board .rk { text-align: center; color: var(--muted); font-weight: 700; }
.board .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .val { font-weight: 800; color: var(--gold2); font-variant-numeric: tabular-nums; }
.board .wl { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.board li.top { border-color: rgba(233, 185, 73, .45); background: linear-gradient(90deg, rgba(233, 185, 73, .12), #150f2c 60%); }
.recent { max-height: 460px; margin: 0; }
.recent li { padding: 8px 10px; }
.pc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.pc-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #150f2c; display: grid; gap: 2px; text-align: center; }
.pc-stats b { font-size: 22px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.pc-stats span { color: var(--muted); font-size: 12.5px; }
.pc-vs { margin: 0 0 10px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--gold); background: rgba(233, 185, 73, .08); }
.pc-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
.pc-list li { padding: 5px 10px; border-left: 3px solid var(--line); background: #150f2c; border-radius: 6px; }
.pc-list li.won { border-left-color: var(--green); }
.pc-list li.lost { border-left-color: var(--red); }
#player-dialog h3 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
#player-dialog h3 small { font-weight: 400; font-size: 12px; }
.pc-tabs { margin: 0 0 8px; }
.pc-sum { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.pc-opps { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.pc-opps li { display: grid; justify-items: center; gap: 2px; opacity: .55; }
.pc-opps li.won { opacity: 1; }
.pc-opps .face { width: 40px; height: 40px; border-radius: 6px; image-rendering: pixelated; background: #0c0820; object-fit: cover; }
.pc-opps .face:not([src]) { visibility: hidden; } /* no disc in this browser: no face, the line under it still there */
.pc-opps .w { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-opps .rk { color: var(--gold2); }
.pc-rarity { margin: 0 0 8px; line-height: 1.9; }
.pc-rarity b { font-variant-numeric: tabular-nums; }
.pc-rarity small { color: var(--muted); }
@media (max-width: 760px) {
  .ranks { grid-template-columns: 1fr; }
  .board li { grid-template-columns: 28px minmax(0, 1fr) auto 52px; padding: 7px 8px; }
  .pc-stats b { font-size: 18px; }
}

/* the duel's log (duellog.js): in the game (a drawer on the left, beside the chat's) and beside the spectators' board */
.log-drawer { left: 10px; right: auto; }
.log-drawer h3, .dlog-panel h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.dlog-panel { margin-top: 12px; }
.dlog-panel .lines { max-height: 260px; min-height: 120px; }
.dlog li { padding: 2px 0 2px 8px; border-left: 2px solid transparent; font-size: 13.5px; padding-right: 0; }
.dlog li.turn, .dlog li.head { margin-top: 6px; color: var(--gold2); font-weight: 700; border-left-color: var(--gold); }
.dlog li.head { text-transform: uppercase; letter-spacing: .04em; }
.dlog li.attack { color: #ffd0a0; }
.dlog li.hit { color: #ffb3ba; }
.dlog li.heal { color: var(--green); }
.dlog li.summon, .dlog li.flip { color: var(--text); }
.dlog li.spell { color: #c9b8ff; }
.dlog li.set, .dlog li.pos, .dlog li.stat, .dlog li.field, .dlog li.gone { color: var(--muted); }
.dlog li.win { color: var(--gold2); font-weight: 800; border-left-color: var(--gold); }
.dlog li .tm { display: inline-block; min-width: 3.2em; margin-right: 6px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; }
.dlog li.sub { padding-left: 22px; }
.dlog li.sub::before { content: "↳ "; color: var(--muted); }
.dlog li.fuse { color: #9fe0ff; }
.dlog li.draw { color: var(--muted); font-size: 12.5px; }
/* chat lines not read yet in a duel (app.js unread) */
#toggle-chat.unread { border-color: var(--gold); background: rgba(233, 185, 73, .2); color: var(--gold2); font-weight: 700; }
/* an icon on the Home Screen (app.js install) */
.top .install { margin-left: 6px; }
#install-dialog .steps { padding-left: 18px; margin: 8px 0 4px; display: grid; gap: 8px; }
@media (max-width: 760px) { .top .install .lbl { display: none; } }

/* people on the site (app.js showOnline): a badge that never wraps; narrow screens keep the dot and the number */
.top .online { display: inline-flex; align-items: center; gap: 5px; flex: none; white-space: nowrap; padding: 3px 9px;
               border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12.5px; }
.top .online[hidden] { display: none; }
.top .online b { color: var(--text); font-weight: 700; }
.top .online .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px rgba(91, 208, 138, .7); }
.top .brand { min-width: 0; }
@media (max-width: 420px) {
  .top .online .lbl { display: none; }
  .top .online { padding: 3px 7px; }
}

/* "Hành trình" (journey.js): the account's journey on the front page, its save state in the game's bar */
#journey > .hint, #versus > .hint { margin: 0 0 12px; max-width: 820px; }
#journey .hint.small { font-size: 12.5px; margin: 6px 0 0; }
.journey-lang { margin-top: 10px; }
.j-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.j-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; background: #150f2c; display: grid; gap: 2px; text-align: center; }
.j-stats b { font-size: 20px; color: var(--gold2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.j-stats span { color: var(--muted); font-size: 12.5px; }
.bar .jsave.ok { color: var(--green); }
.bar .jsave.bad { color: var(--red); }
/* the master panel's Hành trình: an account's duels */
/* Quản trị's Hành trình: the day at a glance, the stars given (master.js journeyOverview, setupGift) */
.m-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin: 6px 0; }
.m-stat { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #150f2c; }
.m-stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.m-stat span { font-size: 12px; color: var(--muted); }
.m-stat.bad b { color: #ffb3ba; }
.m-gift { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.m-gift summary { cursor: pointer; font-weight: 600; }
.m-gift-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.m-gift-form input[type="number"] { width: 80px; }
.m-gift-form #m-gift-why { flex: 1; min-width: 160px; }
.pill .link { padding: 0 2px; color: inherit; }
.m-table { overflow-x: auto; margin: 8px 0; }
.m-table table { border-collapse: collapse; width: 100%; font-size: 13px; }
.m-table th, .m-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.m-table th { color: var(--muted); font-weight: 600; }
#master-dialog h3.sub { margin: 14px 0 6px; font-size: 15px; color: var(--muted); }
/* the journey's own screen over the game, paused between two duels: the opponents, the deck, the packs */
.jhub { position: absolute; inset: 0; overflow-y: auto; background: radial-gradient(900px 500px at 70% -10%, #2a1d5a 0%, transparent 60%), var(--bg);
        z-index: 2; }
.jhub-in { max-width: 980px; margin: 0 auto; padding: 16px; }
.jhub .tabs { position: sticky; top: -16px; background: var(--bg); z-index: 1; padding-top: 4px; }
.jhub-note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 4px 0 8px; background: #150f2c; }
.jhub-note.win { border-color: #3d7a55; background: #11261b; }
.jhub-note.bad { border-color: #7a3d45; background: #2a1219; }
.jhub-note b { color: var(--gold2); }
.jhub-panel .hint { margin: 4px 0 10px; }
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 8px; }
.opp { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #150f2c; display: grid; gap: 6px; }
.opp .nm { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.opp .nm small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.opp .meta { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; }
.opp .meta .w { color: var(--gold2); }
.opp .meta .share { white-space: nowrap; }
.opp .meta .share.full { color: var(--gold2); }
.opp .meta .today { white-space: nowrap; }
.opp .meta .today.full, .opp .meta .today.edge { color: var(--gold2); }
.star-rules ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.star-rules summary { line-height: 1.45; }
.opp.locked { opacity: .5; }
.opp.next { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(233, 185, 73, .35); }
/* its face beside its name, its record and Đấu (the game's 48 x 48 portrait, its pixels kept square) */
.opp { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; }
.opp > :not(.face) { grid-column: 2; }
.opp .face { grid-column: 1; grid-row: 1 / span 3; width: 72px; height: 72px; border-radius: 6px; image-rendering: pixelated;
             background: #0b0818; border: 1px solid var(--line); align-self: start; }
.opp.next .face { border-color: var(--gold); }
.opp.locked .face { filter: grayscale(1) brightness(.5); }
.clist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 10px; }
.clist li { display: flex; gap: 8px; align-items: baseline; padding: 4px 6px; border-bottom: 1px solid rgba(52, 41, 95, .6); font-size: 14px; }
.clist .cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist .ad { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clist .x { color: var(--gold2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.clist .pic { width: 40px; height: 32px; border-radius: 3px; background: #0b0818; flex: none; image-rendering: pixelated; align-self: center; }
.clist li[data-in], .clist li[data-out] { cursor: pointer; }
.clist li[data-in]:hover, .clist li[data-out]:hover { background: rgba(233, 185, 73, .08); }
.clist li { align-items: center; }
.deckbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.deckbar .actions { margin: 0; }
.deckbar .bad, .jhub .state.bad { color: var(--red); }
.deckfind { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.deckfind input { flex: 1; min-width: 160px; }
.deckedit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.deckedit .clist { grid-template-columns: 1fr; }
.cdetail { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #150f2c;
           margin: 0 0 6px; min-height: 60px; font-size: 14px; line-height: 1.5; }
.cdetail .art { width: 102px; height: 96px; border-radius: 4px; image-rendering: pixelated; background: #0b0818; flex: none; }
@media (max-width: 700px) {
  .deckedit { grid-template-columns: 1fr; }
}
.tier { font-size: 11px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tier.rare { color: #8fd0ff; border-color: #2f5f86; }
.tier.super { color: #d6a8ff; border-color: #6a3f96; }
.tier.ultra { color: var(--gold2); border-color: var(--gold); background: rgba(233, 185, 73, .12); }
.new { font-size: 11px; color: #1b1300; background: var(--gold2); border-radius: 6px; padding: 0 5px; font-weight: 700; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.pack { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: linear-gradient(160deg, #2b1f59, #150f2c); display: flex; flex-direction: column; gap: 6px; }
.pack .price small { color: var(--muted); font-weight: 400; }
.pack .hint { margin: 0; font-size: 12.5px; }
.pack .save { color: #9be59b; }
.pack .sure { color: var(--gold2); }
.pack .btn { margin-top: auto; } /* (the buttons of a row of boxes level, at their foot) */
.reveal .tally { margin: 0 0 6px; }
.pack h3 { margin: 0; font-size: 17px; }
.pack .price { color: var(--gold2); font-weight: 700; }
.odds { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.reveal { margin-top: 6px; }
/* the packs tab: what they deal (app.js hubOdds): each tier's share, then every card with its chance in a pack */
.odds-title { margin-top: 18px; }
.ptiers { border-collapse: collapse; font-size: 13.5px; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.ptiers th { color: var(--muted); font-weight: 400; font-size: 12px; text-align: right; padding: 3px 10px; }
.ptiers td { text-align: right; padding: 4px 10px; border-top: 1px solid rgba(52, 41, 95, .6); }
.ptiers th:first-child, .ptiers td:first-child { text-align: left; padding-left: 0; }
.clist.odds .lhead .cn { padding-left: 48px; }
.clist.odds .unlock { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 560px) { .ptiers th, .ptiers td { padding: 3px 6px; } }
.reveal h3 { margin: 6px 0; font-size: 15px; }
.jhub h3.sub { margin: 16px 0 6px; font-size: 15px; color: var(--muted); font-weight: 600; }
.jhub .tabs { overflow-x: auto; scrollbar-width: none; }
.jhub .tab { white-space: nowrap; }
.clink { background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left;
         text-decoration: underline dotted rgba(236, 231, 255, .35); text-underline-offset: 3px; }
.clink:hover { color: var(--gold2); text-decoration-color: var(--gold); }
.clink.have { color: var(--gold2); }
.opp .meta .clink { color: var(--muted); font-size: 12px; white-space: nowrap; }
.clist li[data-card] { cursor: pointer; }
.clist li[data-card]:hover { background: rgba(233, 185, 73, .08); }
.clist.look li.none { opacity: .55; }
.clist .no { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; min-width: 2.1em; text-align: right; }
.clist.look { grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.clist.wide { grid-template-columns: minmax(0, 1fr); }
.clist .pools { display: flex; gap: 4px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--gold2); }
.clist .pools span { width: 4.6em; text-align: right; }
.clist li.lhead { color: var(--muted); font-size: 11.5px; padding-top: 0; }
.clist li.lhead .gap { width: calc(40px + 2.1em + 8px); flex: none; }
.clist li.lhead .pools { color: var(--muted); font-size: 11px; }
.deckfind .check { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13.5px; }
.deckfind .check input { padding: 0; flex: none; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 10px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 7px 14px; font: inherit; cursor: pointer; }
.seg button.on { background: rgba(233, 185, 73, .15); color: var(--gold2); }
.pairs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; margin: 4px 0 8px; }
.pairs.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pairs.found { margin-bottom: 12px; }
.pair small { color: var(--muted); }
details.more { flex-basis: 100%; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; }
/* the opponents not open yet, folded under one line after the ones that are */
details.locked-rest { margin-top: 12px; }
details.locked-rest > summary { padding: 10px 14px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
details.locked-rest[open] > summary { margin-bottom: 10px; }
details.more .pairs { margin: 4px 0 0; }
.fgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.fgroup { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #150f2c; min-width: 0; }
.fres { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fres .pic { width: 40px; height: 32px; image-rendering: pixelated; border-radius: 3px; background: #0b0818; flex: none; }
.fres .ad { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: auto; font-variant-numeric: tabular-nums; }
.fres small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.fgroup .pairs { margin: 6px 0 0; font-size: 13px; }
.cardbox { width: min(660px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line);
           border-radius: 14px; background: #150f2c; color: var(--text); padding: 14px 16px; }
.cardbox::backdrop { background: rgba(5, 3, 14, .72); }
.cbnav { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cbhead { display: flex; gap: 14px; align-items: flex-start; line-height: 1.6; font-size: 14px; }
.cbhead .art { width: 153px; height: 144px; image-rendering: pixelated; border-radius: 6px; background: #0b0818; flex: none; }
.cbname { font-size: 18px; color: var(--gold2); }
.muted { color: var(--muted); }
.cardbox h4 { margin: 16px 0 6px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
/* a card's description and the rules behind it (app.js cardEffects); in the lookup, a magic card's under its name */
/* a card's small picture before its name in the fusions' and the card box's lists (app.js cardLink pic): opens its box */
.cpair { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; max-width: 100%; }
.cpic { padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; flex: none; border-radius: 4px; }
.cpic:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cpic .mini { width: 30px; height: 24px; border-radius: 3px; image-rendering: pixelated; background: #0c0820; object-fit: cover; display: block; }
.pair .cpair + .cpair, .pair .cpair { margin: 1px 0; }
.cardbox .cdesc { margin: 0 0 6px; padding: 8px 12px; border-left: 3px solid var(--gold); background: rgba(233, 185, 73, .06); border-radius: 0 8px 8px 0; font-style: italic; }
.cardbox .crules { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.cardbox .crules + .hint, .cardbox p.hint.small { margin: 6px 0 2px; }
.clist.look li { flex-wrap: wrap; }
.clist.look .cd { flex-basis: 100%; padding-left: calc(40px + 2.1em + 16px); color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: -2px; }
.cardbox p { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.drops { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.drops th, .drops td { padding: 4px 6px; border-bottom: 1px solid rgba(52, 41, 95, .6); text-align: right; white-space: nowrap; }
.drops th:first-child, .drops td:first-child { text-align: left; white-space: normal; }
.drops th { color: var(--muted); font-weight: 600; font-size: 12px; }
.drops tr.locked td { opacity: .55; }
@media (max-width: 560px) {
  .cbhead .art { width: 102px; height: 96px; }
  .clist.wide .ad, .clist.wide .tier { display: none; }
  .jhub .tab { padding: 8px 9px; }
  .fgroups { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .j-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .j-stats b { font-size: 17px; }
  .jhub-in { padding: 12px; }
  /* the hub on a phone upright: its figures in one row, the opponents (what a player came for) sooner in view */
  .jhub .j-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
  .jhub .j-stats div { padding: 6px 2px; }
  .jhub .j-stats b { font-size: 16px; }
  .jhub .j-stats span { font-size: 11px; line-height: 1.2; }
  .jhub-opts .hint { display: none; }
}

/* ---- the UX review's fixes (phones first) ---------------------------------------------------------------------- */
/* over the Journey hub (z-index 2): what tells the player something */
.cover, .drawer { z-index: 3; }
.overlay { z-index: 4; }
.overlay .box { margin: 16px; }
/* the toast over every screen, as wide as its words */
.toast { position: fixed; top: calc(var(--top-h, 57px) + 10px); z-index: 50; width: max-content; max-width: min(92vw, 560px);
         border-radius: 14px; text-align: center; padding: 8px 16px; }
/* the header on one line: the short name on phones, the buttons pushed right by the name */
.top { justify-content: flex-start; }
.top .brand { margin-right: auto; }
.top .online { margin-left: 0; }
.brand > span:last-child { white-space: nowrap; }
@media (max-width: 480px) {
  .top { padding: 8px 12px; gap: 6px; }
  .brand { font-size: 16px; gap: 8px; }
  .brand .long { display: none; }
  .top .acct, .top .install, .top #open-keys { margin-left: 0; }
}
.announce { top: var(--top-h, 57px); }
@media (max-width: 760px) { .announce { top: var(--top-h, 53px); } }
/* (9/11) over the game while Hành trình's hub is shown (the game is fixed over the page: the band was under it, the
   user's "thông báo của Admin không hiện"), under its bar; not over a duel (a toast there) */
body:has(#game:not([hidden])):has(#jhub:not([hidden])) .announce { position: fixed; left: 0; right: 0; z-index: 11;
  background: linear-gradient(90deg, rgba(255, 179, 0, .22), rgba(233, 185, 73, .08)), #1a1430; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
/* checkboxes and radios are not text boxes */
input[type="checkbox"], input[type="radio"] { width: auto; min-width: 0; padding: 0; flex: none; accent-color: var(--gold); }
.check { white-space: normal; }
#room-ranked-label, .create .check { white-space: nowrap; }
.dialog { max-height: calc(100dvh - 32px); }
@media (max-width: 560px) { .dialog { padding: 14px; } }
#acct-sso { white-space: normal; text-align: left; }
/* the Journey's save state stays in the bar on phones */
@media (pointer: coarse) and (hover: none) {
  .bar .net.jsave { display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
  .check { min-height: 40px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .clink { padding: 6px 0; }
  details.more summary { padding: 8px 0; }
  .seg button { min-height: 40px; }
}
/* six hub tabs side by side on phones, the icon over the name */
@media (max-width: 560px) {
  .jhub .tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .jhub .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 12px;
               white-space: normal; line-height: 1.2; min-height: 48px; text-align: center; }
}
/* the drop rates of one opponent: on a line of their own on phones, each named */
@media (max-width: 560px) {
  .clist.wide li { flex-wrap: wrap; row-gap: 2px; }
  .clist.wide .pools { flex-basis: 100%; padding-left: calc(40px + 2.1em + 16px); gap: 10px; }
  .clist.wide .pools span { width: auto; text-align: left; }
  .clist.wide .pools span::before { content: attr(title) " "; color: var(--muted); }
  .clist li.lhead { display: none; }
}
/* the card box: its buttons stay at hand */
.cbnav { position: sticky; top: -14px; background: #150f2c; z-index: 1; padding: 6px 0; margin-top: -6px; }
/* what is not had or not open yet: readable, set apart without fading the words */
.opp.locked { opacity: 1; border-style: dashed; }
.opp.locked .nm span, .opp.locked .meta { color: var(--muted); }
.clist.look li.none { opacity: 1; }
.clist.look li.none .pic { filter: grayscale(1) brightness(.75); }
.clist.look li.none .cn { color: var(--muted); }
.drops tr.locked td { opacity: 1; color: var(--muted); }
.clink.have { font-weight: 600; }
.state.bad, .deckbar .bad, .jhub .state.bad { color: #ff8a94; }
.clist li[role="button"]:focus-visible, .clink:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.back { margin-left: auto; }
.jhub-opts { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 2px 0 6px; }
.jhub-opts .hint { margin: 0; }
#mute.on { border-color: var(--red); }
/* ---- the second UX review ------------------------------------------------------------------------------------------ */
/* the sticky hub tabs: their icons whole on phones (.jhub-in's padding is 12px there) */
@media (max-width: 560px) { .jhub .tabs { top: -12px; } }
/* an invite link's banner, first on the page */
.invite { border-color: var(--gold); }
.invite p { margin: 0 0 10px; font-size: 16px; }
.invite .actions { margin: 0; }
/* the deck being built: its count and Save stay in view as the lists scroll (under the hub's own sticky tabs) */
.jhub .deckbar, #odeck-dialog .deckbar { position: sticky; z-index: 1; background: var(--bg); padding: 6px 0; }
.jhub .deckbar { top: 24px; }
#odeck-dialog .deckbar { top: -18px; background: var(--card); }
@media (max-width: 560px) { .jhub .deckbar { top: 40px; } }
/* the deck's two ways (app.js deckHtml): looking (a card clicked shows what it is) and editing (✎ Sửa bộ bài: a card
   clicked goes in or out). Editing shows on the bar, the line above the lists and every row's − / ＋; the card just
   moved lights up where it went. */
.deckhint { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.deckhint.editing { color: var(--gold2); border: 1px dashed rgba(233, 185, 73, .55); border-radius: 8px; padding: 6px 10px; background: rgba(233, 185, 73, .06); }
.deckhint b { color: inherit; }
.jhub .deckbar.editing, #odeck-dialog .deckbar.editing { box-shadow: 0 2px 0 rgba(233, 185, 73, .45); }
.deckedit h3 small { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.deckedit.editing .clist li[data-in]::after, .deckedit.editing .clist li[data-out]::after {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; line-height: 1; }
.deckedit.editing .clist li[data-out]::after { content: "−"; color: #ff8a94; border: 1px solid rgba(224, 82, 95, .6); }
.deckedit.editing .clist li[data-in]::after { content: "+"; color: var(--green); border: 1px solid rgba(91, 208, 138, .6); }
.deckedit.editing .clist li[data-out]:hover::after { background: rgba(224, 82, 95, .22); }
.deckedit.editing .clist li[data-in]:hover::after { background: rgba(91, 208, 138, .22); }
.clist li.moved { animation: deck-moved 1.1s ease-out; }
@keyframes deck-moved { from { background: rgba(233, 185, 73, .38); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .clist li.moved { animation: none; background: rgba(233, 185, 73, .16); } }
/* the hub on a phone held sideways (some 320–380px tall): the opponents in view, not under the stats and the rules */
.rules { margin: 4px 0 10px; }
.rules summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.rules .hint { margin: 6px 0 0; }
@media (max-height: 500px) {
  .jhub-in { padding-top: 8px; }
  .jhub .j-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
  .jhub .j-stats div { padding: 4px; grid-auto-flow: column; justify-content: center; align-items: baseline; gap: 6px; }
  .jhub .j-stats b { font-size: 15px; }
  .jhub .j-stats span { font-size: 11.5px; }
  .jhub-opts { margin: 0 0 2px; }
  .jhub-opts .hint { display: none; }
  .jhub .tabs { margin: 4px 0 8px; }
}
/* the setup done on an earlier visit: one line, opened again with Sửa */
#setup.folded .row { display: none; }
.setup-done { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.setup-done .state { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#journey, #setup { scroll-margin-top: calc(var(--top-h, 57px) + 8px); } /* scrolled to (leaving the Journey, needDisc): its heading not under the header */
/* the packs' odds on a phone (app.js hubOdds): the rarity kept beside the name, each chance named short */
@media (max-width: 560px) {
  .clist.odds .tier { display: inline-block; }
  .clist.odds .pools { padding-left: 48px; flex-wrap: wrap; }
  .clist.odds .pools span::before { content: attr(data-label) " "; }
  .clist.odds .unlock { flex-basis: 100%; padding-left: 48px; white-space: normal; }
}
/* a phone held upright: the duel's bar (its buttons wider than the screen) on two lines rather than its last buttons
   (Rời trận) off the edge; the score on one line */
.bar .score { white-space: nowrap; }
@media (max-width: 560px) and (orientation: portrait) {
  .game .bar { flex-wrap: wrap; row-gap: 4px; }
  .game .bar .who { flex-basis: 30%; }
}
/* a phone held upright, pointer play on (pointer.js style: .pp-dock): the picture at the top, as wide as the screen; in
   the black under it, the line saying what to do and the duel's buttons in rows, so a card's choices (opening beside the
   card, on the picture) never fall on the buttons; the fusions under them, at the bottom. (Held sideways: the column at
   the right, as before.) */
@media (max-width: 900px) and (orientation: portrait) {
  .stage.pp-dock #game-canvas { bottom: auto; height: min(calc(100% - 170px), 75vw) !important; }
  .stage.pp-dock .pbar, .stage.pp-dock:has(.drawer:not([hidden])) .pbar {
    top: calc(min(100% - 170px, 75vw) + 10px); bottom: auto; left: 8px; right: 8px; transform: none;
    flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-width: 0; max-width: none; }
  .stage.pp-dock .pbar-hint:not([hidden]) { display: block; flex: 1 0 100%; text-align: center; font-size: 15px; font-weight: 600;
    color: var(--text); padding: 0 4px 2px; line-height: 1.35; }
  .stage.pp-dock .pbtn { flex: 0 1 auto; min-height: 44px; padding: 8px 12px; }
  /* (its top set under the bar by pointer.js placeLow; open there always: the room is there) */
  .stage.pp-dock .pp-fuse:not(.pp-fuse-side) { bottom: auto; left: 8px; right: 8px; transform: none; width: auto; max-width: none;
    max-height: calc(100% - min(100% - 170px, 75vw) - 130px); display: flex; flex-direction: column; }
  .stage.pp-dock .pp-fuse:not(.pp-fuse-side) .pp-fuse-list { display: flex; max-height: none; overflow: auto; }
  .stage.pp-dock .pp-fuse:not(.pp-fuse-side) .pp-fuse-head { cursor: default; }
  .stage.pp-dock .pp-fuse:not(.pp-fuse-side) .pp-fuse-head::after { content: none; }
  .stage.pp-dock ~ .rotate, .stage.pp-dock .rotate { display: none; }
}
/* ---- the Hành trình's leaderboards (jranks.js): on the home page (#jranks) and in the hub's 🏆 tab ------------------- */
.jboard li { grid-template-columns: 34px 32px minmax(0, 1fr) auto 64px; }
.jboard .face { width: 32px; height: 32px; border-radius: 5px; image-rendering: pixelated; background: #0c0820; object-fit: cover; }
.jboard .face:not([src]) { visibility: hidden; } /* no disc in this browser: no face, no empty box */
.jboard .nm { display: grid; }
.jboard .nm > span, .jboard .nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jboard .nm .who-btn { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.jboard .nm small { color: var(--muted); font-size: 12px; }
.jboard li.me { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.board.jboard li.gap { display: block; text-align: center; color: var(--muted); border: 0; background: none; padding: 0; line-height: 1; }
.jrank-body { margin-top: 10px; }
.jme { margin: 8px 0 0; }
.jhub .board { max-height: none; overflow: visible; } /* the hub scrolls itself */
.jboard-you { margin: 2px 0 8px; }
.jboard-you b { color: var(--gold2); }
@media (max-width: 760px) {
  .jboard li { grid-template-columns: 26px 28px minmax(0, 1fr) auto 46px; gap: 6px; }
  .jboard .face { width: 28px; height: 28px; }
}

/* a deploy coming (app.js takeUpdate): a band under the header with the wait; the dialog with what is new */
.update-bar { position: sticky; top: var(--top-h, 57px); z-index: 4; display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 16px;
              background: linear-gradient(90deg, rgba(110, 168, 255, .2), rgba(110, 168, 255, .06)); border-bottom: 1px solid #6ea8ff; }
.update-bar p { margin: 0; flex: 1; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 760px) { .update-bar { padding: 8px 10px; font-size: 14px; } }
#update-dialog { width: min(560px, calc(100vw - 24px)); }
#update-dialog .news h3 { margin: 12px 0 4px; font-size: 15px; color: var(--gold2); }
#update-dialog .news .day { margin: 8px 0 2px; color: var(--muted); font-size: 13px; }
#update-dialog .news ul { margin: 4px 0; padding-left: 20px; display: grid; gap: 6px; }
#update-dialog .actions:has(#update-reload[hidden]) { display: none; }
.foot #news-open { margin-top: 8px; }

/* the ultra promised (app.js hubShop, cardList): the shop's line, the card it gave */
.pity-line { border-left: 3px solid #ff6ad5; padding-left: 8px; }
.clist .pity { flex: none; font-size: 11.5px; font-weight: 700; color: #ff9be6; border: 1px solid #ff6ad5; border-radius: 6px; padding: 0 5px; }

/* the field looked at from the hand (pointer.js lookAt): a card's details in the choices' popup */
.pp-menu .pp-look-name { display: block; padding: 6px 10px 2px; color: var(--gold2); font-size: 14px; }
.pp-menu .pp-look-line { margin: 0; padding: 2px 10px; font-size: 12.5px; color: var(--muted); max-width: 260px; }
.pp-menu .pp-look-line:last-child { padding-bottom: 8px; }
/* the fusions on a finger (pointer.js fuseDown): bigger to aim at, a first tap shows the fusion, the second makes it */
@media (pointer: coarse) {
  .pp-fuse-list { gap: 6px; }
  .pp-fuse-item { min-height: 48px; padding: 10px 12px; }
  .pp-fuse-head { min-height: 40px; }
}
.pp-fuse-item.armed { background: rgba(124, 182, 255, .24); box-shadow: inset 0 0 0 2px #7cb6ff; }
.pp-fuse-item.armed .pp-fuse-from::after { content: " · chạm lần nữa để dung hợp"; color: #9fd0ff; font-weight: 700; }

/* answering a line (app.js setReply, addLine): the quote over the answer, the box's "answering" line */
.lines li .re { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 1px;
                padding-left: 6px; border-left: 2px solid var(--gold); font-size: 12px; color: var(--muted); cursor: pointer; }
.lines li .re b { color: var(--muted); font-weight: 700; }
.lines li.flash { background: rgba(233, 185, 73, .18); border-radius: 6px; }
.line-re { background: none; border: 0; color: var(--muted); cursor: pointer; opacity: .35; font-size: 14px; line-height: 1; padding: 1px 4px; }
.lines li:hover .line-re, .line-re:focus-visible { opacity: 1; color: var(--gold2); }
@media (pointer: coarse) { .line-re { opacity: .75; font-size: 16px; padding: 4px 8px; } .lines li { padding-right: 56px; } }
.say-re { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; padding: 4px 6px 4px 8px; border-left: 3px solid var(--gold);
          border-radius: 6px; background: rgba(233, 185, 73, .08); font-size: 12.5px; color: var(--muted); }
.say-re span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.say-re b { color: var(--gold2); }
.say-re-x { flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; }
.say-re-x:hover { color: var(--text, #fff); }

/* the field as a board (pointer.js drawBoard, Xem sân): both sides' cards at once, each with its ATK/DEF now, its
   position and its guardian star in use; a card's details under them */
.pp-board { position: absolute; left: 8px; top: 8px; right: 8px; bottom: 8px; z-index: 1; pointer-events: auto; display: flex;
            flex-direction: column; padding: 10px 12px 12px; border-radius: 14px; border: 1px solid var(--line); background: #0c091a;
            box-shadow: 0 10px 32px rgba(0, 0, 0, .55); }
.pp-board[hidden] { display: none; }
.pp-bbody { flex: 1; min-height: 0; display: flex; gap: 12px; justify-content: center; }
.pp-bbody > .pp-bgrid { flex: 0 1 760px; min-width: 0; overflow: auto; overscroll-behavior: contain; align-content: start; }
.pp-bhead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pp-bhead b { color: var(--gold2); font-size: 15px; }
.pp-bnote { flex: 1; min-width: 0; color: var(--muted); font-size: 12.5px; }
.pp-bsides { display: none; }
.pp-bclose { background: none; border: 1px solid var(--line); border-radius: 8px; color: inherit; cursor: pointer; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
.pp-bclose:hover, .pp-bclose:focus-visible { border-color: var(--gold); outline: none; }
#pbar.pp-under-board { visibility: hidden; }
/* rows as tall as their cards (auto rows in a board of a set height would be its tiles' min-height only, the cards spilling) */
.pp-bgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 6px; }
.pp-brow-label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 2px; }
.pp-brow-label.mine { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.pp-bcard { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; min-height: 104px; padding: 6px 4px;
            border-radius: 10px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .04); color: inherit;
            font: inherit; cursor: pointer; }
.pp-bcard:not(.empty):hover, .pp-bcard:not(.empty):focus-visible { border-color: var(--gold); outline: none; }
.pp-bcard > * { flex: none; }
.pp-bcard.picked { box-shadow: inset 0 0 0 2px var(--gold2); }
.pp-bcard.empty { opacity: .25; cursor: default; }
.pp-bcard.pp-bback { background: repeating-linear-gradient(45deg, rgba(140, 90, 40, .35) 0 6px, rgba(90, 55, 25, .35) 6px 12px); }
.pp-bart { width: 64px; height: 60px; max-width: 100%; object-fit: cover; border-radius: 4px; background: #000; }
.pp-bname { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 12px; font-weight: 700; color: var(--gold2); }
.pp-bstats { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-bstats.up { color: #7ee08a; }
.pp-bstar { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: #ffd978; white-space: nowrap; }
.pp-bline { font-size: 11px; color: var(--muted); }
.pp-bdetail { flex: 0 0 290px; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; overflow: auto;
              background: rgba(255, 255, 255, .06); align-self: flex-start; max-height: 100%; }
.pp-bdetail.none { color: var(--muted); font-size: 13px; }
.pp-bdetail p { margin: 3px 0; font-size: 13px; }
.pp-bdetail b { color: var(--gold2); }
.pp-bdart { flex: none; width: 128px; height: 120px; object-fit: cover; border-radius: 6px; background: #000; }
.pp-bstars .on { color: var(--gold2); }
.pp-bstars .off { color: var(--muted); font-weight: 400; }
/* a tall board (a phone held upright, a narrow window: pointer.js placeBoard): the details in a strip under the rows */
.pp-board.tall .pp-bbody { flex-direction: column; gap: 8px; }
.pp-board.tall .pp-bbody > .pp-bgrid { flex: 1 1 auto; }
.pp-board.tall .pp-bdetail { flex: none; flex-direction: row; align-self: stretch; max-height: 42%; }
.pp-board.tall .pp-bdetail.none { display: none; }
.pp-board.tall .pp-bdart { width: 96px; height: 90px; }
/* a low screen (a phone on its side): smaller cards, a narrower panel */
@media (max-height: 520px) {
  .pp-board { padding: 6px 8px 8px; }
  .pp-bhead { margin-bottom: 2px; }
  .pp-bgrid { gap: 4px; }
  .pp-bsides { display: inline; }
  .pp-brow-label { display: none; }
  .pp-brow-label.mine { display: block; height: 0; margin: 2px 0; padding: 0; overflow: hidden; }
  .pp-bcard { min-height: 44px; padding: 3px 2px; gap: 1px; justify-content: center; }
  .pp-bart { display: none; } /* (all four rows in sight: the picture in the details) */
  .pp-bname { font-size: 10.5px; }
  .pp-bstats { font-size: 11px; }
  .pp-bstar, .pp-bline, .pp-brow-label { font-size: 10px; }
  .pp-bdetail { flex-basis: 220px; padding: 8px; }
  .pp-bdetail p { font-size: 12px; margin: 2px 0; }
  .pp-bdart { width: 80px; height: 75px; }
}
@media (max-width: 560px) {
  .pp-board { padding: 8px; }
  .pp-bgrid { gap: 4px; }
  .pp-bcard { min-height: 84px; padding: 4px 2px; }
  .pp-bart { width: 44px; height: 41px; }
  .pp-bname { font-size: 10.5px; }
  .pp-bstats { font-size: 11px; }
  .pp-bstar, .pp-bline { font-size: 10px; }
  .pp-bdart { width: 72px; height: 68px; }
}

/* Quản trị's live views (live.js, 9/11): "Máy chủ" and "Kiểm tra trận", a control room's look: a dark navy deck, cyan
   lines, glowing gauges and charts, LEDs; the panel wide while they are shown */
#master-dialog.dash { width: min(1180px, calc(100vw - 16px)); max-height: calc(100vh - 16px); }
/* (six tabs: on a phone they scroll sideways in their bar, not the panel) */
#master-dialog .tabs { overflow-x: auto; scrollbar-width: thin; }
#master-dialog .tab { flex: 0 0 auto; white-space: nowrap; }
.mon { --mc: #35e0ff; --mv: #a77bff; --ma: #ffbf3c; --mr: #ff4d6d; --mg: #3dffa2; --ml: rgba(80, 200, 255, .2);
       position: relative; display: grid; gap: 10px; padding: 10px; margin: -4px -6px 0; border-radius: 14px;
       background: radial-gradient(1000px 420px at 85% -10%, rgba(53, 224, 255, .10), transparent 60%),
                   radial-gradient(700px 380px at 0% 110%, rgba(167, 123, 255, .10), transparent 60%),
                   repeating-linear-gradient(0deg, rgba(80, 200, 255, .035) 0 1px, transparent 1px 28px),
                   repeating-linear-gradient(90deg, rgba(80, 200, 255, .035) 0 1px, transparent 1px 28px), #070b18;
       border: 1px solid var(--ml); color: #dcecff; font-variant-numeric: tabular-nums; }
.mon b, .mon time, .mon .fm { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; }
.mon-defs { position: absolute; }
.mon-dim { color: rgba(170, 200, 230, .6); font-size: 12px; }
.mon-right { margin-left: auto; }
.mon-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.mon-status { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 99px; border: 1px solid rgba(61, 255, 162, .45);
              color: var(--mg); letter-spacing: .12em; font-size: 11px; background: rgba(61, 255, 162, .07); }
.mon-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mg); box-shadow: 0 0 8px var(--mg); animation: mon-pulse 1.6s ease-in-out infinite; }
.mon-status.off { color: var(--ma); border-color: rgba(255, 191, 60, .45); background: rgba(255, 191, 60, .07); }
.mon-status.off i { background: var(--ma); box-shadow: 0 0 8px var(--ma); }
@keyframes mon-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.mon-alerts { display: flex; flex-wrap: wrap; gap: 6px; }
.mon-alerts:empty { display: none; }
.mon-alert { font-size: 12.5px; padding: 4px 10px; border-radius: 8px; border: 1px solid; }
.mon-alert.ok { color: var(--mg); border-color: rgba(61, 255, 162, .35); background: rgba(61, 255, 162, .06); }
.mon-alert.warn { color: var(--ma); border-color: rgba(255, 191, 60, .5); background: rgba(255, 191, 60, .08); }
.mon-alert.bad { color: #ffd0d8; border-color: rgba(255, 77, 109, .7); background: rgba(255, 77, 109, .16); box-shadow: 0 0 14px rgba(255, 77, 109, .25);
                 animation: mon-alarm 1.2s ease-in-out infinite; }
@keyframes mon-alarm { 50% { box-shadow: 0 0 2px rgba(255, 77, 109, .1); } }
.mon-panel { position: relative; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ml);
             background: linear-gradient(180deg, rgba(18, 28, 58, .78), rgba(8, 13, 30, .86)); box-shadow: inset 0 1px 0 rgba(160, 230, 255, .06); min-width: 0; }
/* the corners' brackets */
.mon-panel::before, .mon-panel::after { content: ""; position: absolute; width: 10px; height: 10px; border: 1.5px solid var(--mc); opacity: .55; pointer-events: none; }
.mon-panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.mon-panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.mon-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
            color: rgba(160, 225, 255, .85); }
.mon-legend { display: inline-flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 11.5px; color: rgba(190, 215, 240, .75); }
.mon-legend.below { margin: 4px 0 0; }
.mon-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 2px; vertical-align: middle; }
.lg-cyan { background: var(--mc); box-shadow: 0 0 6px var(--mc); }
.lg-cyan.dim { opacity: .4; box-shadow: none; }
.lg-violet { background: var(--mv); }
.lg-amber { background: var(--ma); }
.lg-gold { background: #ffd978; }
.lg-green { background: var(--mg); }
.lg-red { background: var(--mr); }
.lg-grey { background: #7d8bb0; }
.mon-chart { display: block; width: 100%; height: 190px; touch-action: pan-y; }
.mon-chart.tall { height: 230px; }
/* the gauges */
.mon-gauges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mon-gauge { position: relative; aspect-ratio: 1 / .86; max-height: 210px; border-radius: 12px; border: 1px solid var(--ml);
             background: radial-gradient(circle at 50% 46%, rgba(53, 224, 255, .08), transparent 62%), linear-gradient(180deg, rgba(18, 28, 58, .78), rgba(8, 13, 30, .86));
             overflow: hidden; transition: border-color .4s, box-shadow .4s; }
.mon-gauge.hot { border-color: rgba(255, 77, 109, .7); box-shadow: 0 0 18px rgba(255, 77, 109, .3); }
.mon-gsvg { position: absolute; left: 0; top: 4%; width: 100%; height: 100%; }
.mon-gsvg circle { fill: none; stroke-linecap: round; }
.mon-gsvg .g-ticks { stroke: rgba(120, 210, 255, .35); stroke-width: 1; fill: none; }
.mon-gsvg .g-track { stroke: rgba(80, 200, 255, .12); stroke-width: 7; }
.mon-gsvg .g-track.thin { stroke-width: 3; }
.mon-gsvg .g-val { stroke-width: 7; transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1), stroke .4s; }
.mon-gsvg .g-val.lv-ok { stroke: var(--mc); }
.mon-gsvg .g-val.lv-warn { stroke: var(--ma); }
.mon-gsvg .g-val.lv-bad { stroke: var(--mr); }
.mon-gsvg .g-nice { stroke: var(--ma); stroke-width: 3; opacity: .85; transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1); }
.g-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 1px; padding-top: 6%; }
.g-label { font-size: 10.5px; letter-spacing: .2em; color: rgba(160, 225, 255, .75); }
.g-text b { font-size: clamp(20px, 3.2vw, 30px); color: #f0fbff; text-shadow: 0 0 12px rgba(53, 224, 255, .55); }
.g-sub { font-size: 11px; color: rgba(190, 215, 240, .7); }
/* the small figures with their lines */
.mon-minis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mon-mini { display: grid; gap: 2px; padding: 8px 10px 4px; border-radius: 10px; border: 1px solid var(--ml); background: rgba(10, 17, 38, .8); min-width: 0; }
.mm-label { font-size: 11px; color: rgba(160, 225, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-mini b { font-size: 14px; color: #eaf8ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-mini canvas { width: 100%; height: 30px; display: block; }
.mon .lv-ok { color: var(--mg); }
.mon .lv-warn { color: var(--ma); }
.mon .lv-bad { color: var(--mr); }
.mon-mini b.lv-ok { color: #eaf8ff; }
.mon-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* the people */
.mon-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mp { display: grid; padding: 6px 10px; border-left: 2px solid rgba(53, 224, 255, .5); background: rgba(53, 224, 255, .04); border-radius: 0 8px 8px 0; }
.mp b { font-size: 24px; color: #f0fbff; text-shadow: 0 0 10px rgba(53, 224, 255, .5); line-height: 1.1; }
.mp.big b { font-size: 34px; color: #ffe9a8; text-shadow: 0 0 14px rgba(255, 217, 120, .55); }
.mp.big { border-left-color: rgba(255, 217, 120, .7); background: rgba(255, 217, 120, .05); }
.mp span { font-size: 12.5px; color: #cfe6ff; }
.mp small { font-size: 11px; color: rgba(170, 200, 230, .6); }
/* the services */
.mon-services { display: grid; gap: 8px; }
.ms-row { display: flex; gap: 10px; align-items: flex-start; }
.ms-row b { display: block; font-family: inherit; font-size: 13.5px; color: #eaf8ff; }
.ms-row small { font-size: 11.5px; color: rgba(180, 210, 235, .7); word-break: break-word; }
.led { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; }
.led.ok { background: var(--mg); box-shadow: 0 0 10px var(--mg); animation: mon-pulse 2.4s ease-in-out infinite; }
.led.warn { background: var(--ma); box-shadow: 0 0 10px var(--ma); }
.led.bad { background: var(--mr); box-shadow: 0 0 12px var(--mr); animation: mon-pulse .8s ease-in-out infinite; }
/* the peaks */
.mon-peaks { margin-top: 8px; }
.mp-title { font-size: 11.5px; color: rgba(160, 225, 255, .8); margin-bottom: 6px; }
.mp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.pk { display: grid; padding: 5px 8px; border-radius: 8px; border: 1px solid rgba(80, 200, 255, .14); background: rgba(10, 17, 38, .7); }
.pk span { font-size: 11px; color: rgba(170, 200, 230, .7); }
.pk b { font-size: 15px; color: #eaf8ff; }
.pk small { font-size: 10.5px; color: rgba(170, 200, 230, .5); }
.mon-seg { display: inline-flex; margin-left: auto; border: 1px solid var(--ml); border-radius: 8px; overflow: hidden; }
.mon-seg button { background: none; border: 0; color: rgba(190, 215, 240, .75); padding: 3px 10px; font: inherit; font-size: 11.5px; cursor: pointer; letter-spacing: 0; text-transform: none; }
.mon-seg button.on { background: rgba(53, 224, 255, .16); color: #eaffff; }
/* Kiểm tra trận */
.chk-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chk-card { display: flex; gap: 12px; align-items: center; }
.chk-ring { position: relative; flex: 0 0 96px; height: 96px; }
.chk-ring svg { width: 100%; height: 100%; }
.chk-ring circle { fill: none; stroke-width: 9; }
.chk-ring .ring-track { stroke: rgba(80, 200, 255, .1); }
.chk-ring .seg { transition: stroke-dasharray .6s; filter: drop-shadow(0 0 3px rgba(53, 224, 255, .35)); }
.chk-ring-n { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.chk-ring-n b { font-size: 22px; color: #f0fbff; text-shadow: 0 0 10px rgba(53, 224, 255, .5); line-height: 1; }
.chk-ring-n span { font-size: 10.5px; color: rgba(170, 200, 230, .6); }
.chk-body { min-width: 0; display: grid; gap: 3px; flex: 1; }
.chk-title { font-weight: 600; font-size: 14px; color: #eaf8ff; }
.chk-sub { font-size: 11.5px; }
.chk-vs { list-style: none; margin: 2px 0; padding: 0; display: grid; gap: 1px; font-size: 12.5px; }
.chk-vs li { display: flex; align-items: center; gap: 6px; }
.chk-vs b { margin-left: auto; color: #eaf8ff; }
.chk-vs .dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.chk-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.q-item { display: grid; padding: 6px 10px; border-left: 2px solid rgba(167, 123, 255, .6); background: rgba(167, 123, 255, .05); border-radius: 0 8px 8px 0; }
.q-item b { font-size: 18px; color: #f0fbff; }
.q-item span { font-size: 11.5px; color: rgba(180, 210, 235, .72); }
.chk-feed { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; display: grid; align-content: start; gap: 2px; font-size: 12.5px; }
.chk-feed li { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: baseline; gap: 2px 8px; padding: 3px 6px; border-radius: 6px;
               border-left: 2px solid transparent; }
.chk-feed li.empty { display: block; }
.chk-feed time { color: rgba(150, 190, 225, .6); font-size: 11.5px; }
.chk-feed .fk { font-size: 9.5px; letter-spacing: .08em; padding: 1px 6px; border-radius: 4px; border: 1px solid rgba(80, 200, 255, .3); color: var(--mc); }
.chk-feed .fk-night { color: var(--mv); border-color: rgba(167, 123, 255, .4); }
.chk-feed .fk-rules { color: #9fd8ff; }
.chk-feed .link { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk-feed .fm { color: rgba(150, 190, 225, .6); font-size: 11.5px; }
.chk-feed .fw { grid-column: 3 / -1; font-size: 11px; color: rgba(170, 200, 230, .55); }
.chk-feed .fv-ok b { color: var(--mg); }
.chk-feed .fv-warn b { color: var(--ma); }
.chk-feed .fv-dim b { color: #8a98bd; }
.chk-feed .fv-bad { border-left-color: var(--mr); background: rgba(255, 77, 109, .08); }
.chk-feed .fv-bad b { color: #ff8da2; }
.chk-feed li.fresh { animation: chk-in .9s ease-out; }
@keyframes chk-in { from { background: rgba(53, 224, 255, .28); transform: translateX(-6px); } to { transform: none; } }
.chk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 300px; overflow-y: auto; font-size: 13px; }
.chk-list li { padding: 4px 6px; border-bottom: 1px solid rgba(80, 200, 255, .08); }
.chk-more { margin-top: 8px; font-size: 13px; }
.chk-more summary { cursor: pointer; color: rgba(190, 215, 240, .8); }
/* the flags: the serious first, each with its own ✕, a journey's all at once */
.m-flag-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0; font-size: 13px; color: var(--muted); }
.flag-chip { display: inline-flex; align-items: center; gap: 4px; }
.unflag-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 2px; font: inherit; font-size: 11px; opacity: .7; }
.unflag-x:hover, .unflag-x:focus-visible { opacity: 1; color: #fff; }
.m-unflag-all { margin-left: 6px; }
@media (max-width: 900px) {
  .mon-minis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chk-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .mon-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mon-minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mon-grid2 { grid-template-columns: minmax(0, 1fr); }
  .mon-chart { height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .mon-status i, .led, .mon-alert.bad, .chk-feed li.fresh { animation: none; }
  .mon-gsvg .g-val, .mon-gsvg .g-nice { transition: none; }
}

/* a master's event (9/11 evening: every card in the packs): the players' line in the hub, the switch in Quản trị */
.event-note { margin: 4px 0 10px; padding: 9px 12px; border: 1px solid rgba(255, 217, 120, .55); border-radius: 10px;
              background: linear-gradient(90deg, rgba(255, 179, 0, .16), rgba(233, 185, 73, .05)); color: var(--gold2); }
.m-event { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.m-event span { flex: 1 1 260px; }
.m-event.on { border: 1px solid var(--gold); background: rgba(255, 179, 0, .08); }
.event-note.reset { border-color: rgba(106, 168, 255, .55); background: linear-gradient(90deg, rgba(106, 168, 255, .16), rgba(106, 168, 255, .04)); color: #cfe2ff; }
.m-event input[type="datetime-local"] { width: auto; display: inline-block; margin: 4px 0; }
.m-event small { display: block; color: var(--muted); }
/* Hành trình closed until an hour (9/11 evening): the board counting down to it */
.jclosed { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 16px 12px; border: 1px solid var(--gold);
           border-radius: 14px; background: radial-gradient(500px 200px at 50% 0%, rgba(255, 179, 0, .16), transparent 70%), #150f2c; }
.jc-title { font-size: 17px; color: var(--gold2); }
.jc-clock { font: 700 clamp(38px, 9vw, 64px) / 1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; color: #fff3cf;
            text-shadow: 0 0 18px rgba(255, 196, 70, .55); font-variant-numeric: tabular-nums; }
.jclosed .hint { max-width: 520px; }
/* the PoC mode (Power of Chaos' rules, opt-in): its rules line in the hub, the effect marks and texts */
.jhub-poc-rules { font-size: 0.85em; margin: 0 0 6px; padding: 6px 8px; border-radius: 6px; background: rgba(255, 200, 80, 0.08); border: 1px solid rgba(255, 200, 80, 0.3); }
.jhub-poc-rules kbd { font-size: 0.9em; }
[data-card] .poc { color: #ffc850; margin-left: 4px; }
.cdesc.poc { border-left: 3px solid #ffc850; padding-left: 8px; }
/* the PoC mode's pictures (pocview.js): the reserve's cards beside the hand, the target being chosen */
.poc-view { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.poc-reserve { position: absolute; height: var(--poc-h); }
.poc-label { position: absolute; left: 50%; transform: translateX(-50%); top: -24px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1b1300;
             background: linear-gradient(#ffd97a, #e3a93b); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); white-space: nowrap; }
.poc-card { position: absolute; top: 0; width: var(--poc-w); height: var(--poc-h); box-sizing: border-box; padding: 3px; border-radius: 6px;
            display: flex; flex-direction: column; gap: 2px; pointer-events: auto; cursor: default; user-select: none;
            background: linear-gradient(160deg, #e2c27a, #b8873b); border: 2px solid #3a2a12; box-shadow: 0 6px 16px rgba(0, 0, 0, .6);
            transition: transform .12s ease-out; }
.poc-card .poc-name { font-size: max(9px, calc(var(--poc-w) * .085)); font-weight: 700; line-height: 1.1; color: #1d1405; overflow: hidden;
                      white-space: nowrap; text-overflow: ellipsis; padding: 1px 2px; background: rgba(255, 255, 255, .55); border-radius: 3px; }
.poc-card .poc-art { flex: 1; min-height: 0; width: 100%; object-fit: cover; border: 1px solid rgba(0, 0, 0, .55); background: #0b0918;
                     image-rendering: pixelated; }
.poc-card .poc-stats { font-size: max(9px, calc(var(--poc-w) * .09)); font-weight: 800; text-align: center; color: #1d1405;
                       font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .55); border-radius: 3px; }
.poc-card.poc-effect { background: linear-gradient(160deg, #f0a35a, #c4622a); }
.poc-card.poc-magic, .poc-card.poc-equip { background: linear-gradient(160deg, #5fc79a, #23805a); }
.poc-card.poc-trap { background: linear-gradient(160deg, #d27ac6, #8c3486); }
.poc-card.poc-ritual { background: linear-gradient(160deg, #7ea4f0, #3a5fb8); }
.poc-card.poc-back { background: repeating-linear-gradient(45deg, #5a3a1c 0 6px, #3f2812 6px 12px); justify-content: center; align-items: center; }
.poc-card.poc-back .poc-name { background: rgba(0, 0, 0, .55); color: #f3e4c4; }
.poc-reserve.poc-live .poc-first { cursor: pointer; outline: 2px solid rgba(255, 217, 122, .9); outline-offset: 2px; }
.poc-reserve.poc-live .poc-first:hover { transform: translateY(-8px); }
.poc-swap { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); display: none; padding: 3px 8px; border-radius: 8px;
            font-size: 11px; font-weight: 700; color: var(--text); background: rgba(12, 9, 26, .9); border: 1px solid rgba(233, 185, 73, .5); white-space: nowrap; }
.poc-reserve.poc-live .poc-first:hover .poc-swap { display: block; }
.poc-drop { position: absolute; left: -4px; right: -4px; bottom: 26%; padding: 2px 0; text-align: center; font-size: 10px; font-weight: 800;
            color: #fff; background: rgba(200, 40, 50, .9); border-radius: 4px; transform: rotate(-8deg); }
.poc-pick { position: absolute; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 10px 14px; pointer-events: auto;
            border-radius: 14px; background: rgba(16, 12, 34, .92); border: 1px solid rgba(255, 216, 96, .7); box-shadow: 0 10px 28px rgba(0, 0, 0, .55); }
.poc-pick .poc-card { position: relative; flex: none; }
.poc-pick-info { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.poc-pick-title { color: #ffd860; font-size: 14px; }
.poc-pick-name { font-size: 15px; font-weight: 700; color: var(--text); }
.poc-pick-where { font-size: 12px; color: var(--muted); }
.poc-pick-buttons { display: flex; gap: 6px; margin-top: 4px; }
.poc-pick-buttons .pbtn { min-width: 40px; justify-content: center; }
