/* Tournament tab: weekly contest, layout B (design 2026-10-28). Cream cards float on a dark blue stage, gold frame,
   blue title band - the same surface as the roulette and collection cards. Real elements with ids only (web-ui-style section 6). */
.contest-scroll { display: grid; gap: 12px; align-content: start; width: 100%; max-width: var(--cs-content-width); margin-inline: auto; padding: 0 10px 24px; box-sizing: border-box; }
.contest-card { border: 3px solid var(--cs-gold); border-radius: var(--cs-radius); background: linear-gradient(180deg, #fffdf5, var(--cs-cream)); box-shadow: var(--cs-shadow); color: var(--cs-brown); padding: 14px 16px; display: grid; gap: 8px; }
.contest-card.hidden { display: none; }
.contest-me { position: relative; z-index: 1; display: grid; grid-template-columns: 128px minmax(0, 1fr); column-gap: 10px; row-gap: 8px; padding-inline: 12px; align-items: start; text-align: center; }
.contest-me-actions { grid-column: 1 / -1; display: grid; gap: 6px; min-width: 0; justify-items: stretch; text-align: center; }
.contest-me-side { display: grid; justify-items: center; position: relative; width: 100%; min-width: 0; }
.contest-me-medal { width: 100%; max-width: 128px; height: auto; display: block; object-fit: contain; }
/* The representative animal: a gold ring around the face, the small crown on top. */
.contest-me-avatar { position: relative; width: 100%; max-width: 128px; aspect-ratio: 1 / 1; }
.contest-me-avatar-img { position: absolute; left: 50%; top: 14%; width: 80%; height: 80%; transform: translateX(-50%); border-radius: 50%; border: 5px solid var(--cs-gold); box-sizing: border-box; object-fit: cover; object-position: 50% 22%; background: var(--cs-cream, #fff6df); box-shadow: 0 0 0 3px var(--cs-gold-lo), 0 4px 8px rgba(90, 51, 19, .35); }
.contest-me-avatar-crown { position: absolute; left: 50%; top: -2px; width: 34px; height: 34px; margin-left: -17px; }
.contest-me-panel { display: grid; gap: 6px; min-width: 0; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, .55); }
.contest-me-main { display: grid; gap: 6px; min-width: 0; justify-items: stretch; word-break: keep-all; overflow-wrap: anywhere; }
.contest-me-scoreline { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.contest-me-laurel { width: 18px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.contest-me-rankline { display: flex; align-items: center; justify-content: center; gap: 6px; row-gap: 2px; flex-wrap: wrap; }
.contest-me-divider { width: 2px; height: 16px; background: var(--cs-brown-soft); opacity: .5; border-radius: 1px; }
.contest-me-divider.hidden { display: none; }
.contest-num { color: #e0336b; font-weight: 900; }
.contest-me-head { display: flex; align-items: center; justify-content: center; }
.contest-me-name { min-height: 44px; width: 85%; max-width: 100%; box-sizing: border-box; margin: -18px auto 0; padding: 2px 6px; border: 2px solid var(--cs-gold-lo); border-radius: 12px; background: linear-gradient(180deg, var(--cs-gold-hi), var(--cs-gold) 60%, #e3a92f); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 3px 0 rgba(90, 51, 19, .35); font: inherit; font-size: 15px; line-height: 1.15; font-weight: 900; color: #4a2a0c; cursor: pointer; touch-action: manipulation; overflow: hidden; overflow-wrap: anywhere; word-break: keep-all; white-space: normal; position: relative; }
.contest-title-ribbon { position: relative; display: inline-grid; place-items: center; width: 132px; max-width: 100%; min-height: 36px; box-sizing: border-box; }
.contest-title-ribbon.hidden { display: none; }
.contest-title-ribbon img { position: absolute; inset: 0; width: 100%; height: 100%; }
.contest-title-ribbon span { position: relative; font-size: 12px; font-weight: 900; padding-left: 22px; color: #241f17; }
#contest-me-title-text { display: block; box-sizing: border-box; max-width: 124px; white-space: nowrap; }
#contest-me-title-text.wrap { white-space: normal; text-align: center; overflow-wrap: anywhere; word-break: keep-all; padding-block: 2px; }
.contest-me-total { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-wrap: nowrap; white-space: nowrap; word-break: keep-all; gap: 2px; margin: 0; min-width: 0; font-size: 18px; font-weight: 900; color: #fff; line-height: 1.15; }
#contest-me-total .contest-me-total-label { font-size: 16px; }
#contest-me-total .contest-me-total-line { display: flex; align-items: baseline; justify-content: center; gap: 2px; white-space: nowrap; max-width: 100%; }
#contest-me-total .contest-me-total-line { font-size: clamp(24px, 8vw, 40px); }
#contest-me-total .contest-me-total-num { font-size: 1em; color: #ffcf2e; white-space: nowrap; }
#contest-me-total .contest-me-total-unit { font-size: .55em; color: #ffcf2e; white-space: nowrap; }
.contest-me-rank, .contest-me-pct, .contest-me-lastweek { margin: 0; font-size: 15px; }
.contest-me-rank, .contest-me-pct { font-size: clamp(13px, 3.6vw, 15px); white-space: nowrap; word-break: keep-all; }
/* The rank line wraps (balanced) instead of running out of the card: the zero-play invitation is longer than a rank. */
.contest-me-rank { white-space: normal; text-wrap: balance; text-align: center; max-width: 100%; }
.contest-me-lastweek { font-size: 14px; color: var(--cs-brown-soft); }
.contest-me-held, .contest-board-empty, .contest-note { margin: 0; font-size: 14px; opacity: .85; }
.contest-me-held.hidden, .contest-board-empty.hidden { display: none; }
.contest-me #btn-contest-link-google { margin-top: 4px; }
.contest-me #contest-link-body { margin-top: 6px; }
.contest-gsi-host { display: flex; justify-content: center; margin-top: 10px; }
.contest-btn { min-height: 48px; border-radius: 14px; font-weight: 900; font-size: 18px; padding: 0 18px; cursor: pointer; touch-action: manipulation; }
.contest-btn--start { display: grid; grid-template-columns: 26px minmax(0, 1fr) 20px; align-items: center; gap: 6px; width: min(88%, 340px); margin-inline: auto; min-height: 56px; box-sizing: border-box; padding: 0 12px; font-size: 20px; white-space: nowrap; word-break: keep-all; }
.contest-btn--start .contest-btn-icon { width: 26px; height: 26px; }
.contest-btn-icon { width: 32px; height: 32px; object-fit: contain; }
.contest-btn-chevron { font-size: 28px; line-height: 1; }
.contest-btn--blue { background: linear-gradient(180deg, #2a95ff, #0a55c9); color: #fff; border: 3px solid #06348a; }
.contest-btn--main { background: linear-gradient(180deg, var(--ui-cta-green-mid), #3d9d00); color: #fff; border: 3px solid #2d7a00; }
.contest-btn--sub { background: linear-gradient(180deg, #fffdf5, var(--cs-cream)); color: var(--cs-brown); border: 2px solid var(--cs-gold); font-size: 15px; min-height: 44px; }
.contest-panel-head { display: flex; align-items: center; justify-content: flex-start; gap: 8px; }
.contest-panel-title { margin: 0; flex: 1 1 auto; min-width: 0; text-align: left; font-size: 20px; font-weight: 900; color: var(--cs-brown); }
.contest-today, .contest-players { font-size: 13px; font-weight: 700; opacity: .85; }
.contest-slots-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.contest-slot { position: relative; min-height: 62px; box-sizing: border-box; padding: 4px 2px; border-radius: 12px; border: 2px solid var(--cs-gold); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-weight: 900; font-size: 15px; color: var(--cs-brown); -webkit-text-fill-color: var(--cs-brown); opacity: 1; }
.contest-slot-label { font-size: 18px; line-height: 1.1; }
.contest-slot[data-status="done"] { background: #e3f6dc; border-color: #7bc96f; justify-content: space-between; padding: 3px 2px; }
.contest-slot[data-status="done"] .contest-slot-label { line-height: 1; }
.contest-slot-icon { width: 18px; height: 18px; object-fit: contain; }
.contest-slot-check { width: 22px; height: 22px; }
.contest-slot-play { width: 20px; height: 20px; }
.contest-head-icon { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.contest-slot[data-status="playing"] { background: #fff4c2; border-color: #e9b400; }
.contest-slot[data-status="capped"] { opacity: .55; }
.contest-slot-score { font-size: clamp(10px, 2.9vw, 12px); white-space: nowrap; word-break: keep-all; }
.contest-groups-cards { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.contest-groups-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contest-rules-list { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }

/* Layout B: a dark blue stage under the whole tab; cream cards float on it (web-ui-style 3.1 blue face). */
:root { --cs-stage-top: #1d4fa8; --cs-stage-bottom: #0b2457; --cs-stage-edge: #06173a; --cs-reward: #7a3fc4; --cs-reward-edge: #4f2289; --cs-score-pill: #1b3a7a; --cs-me-row: #ffd76a; }
#screen-tournament { position: relative; overflow-x: hidden; overflow-x: clip; }
/* The plate keeps its size (owner 2026-10-31); its drawn top (the trophy, 20/240 of the art) sits about
   12px under the real bottom of the top bar like every tab's title: 2px head padding + 10px clear art. */
#screen-tournament { padding-top: var(--lobby-bar-bottom, 62px); }
.contest-stage { position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, var(--cs-stage-top), var(--cs-stage-bottom)); }
#contest-stage { background-image: url('../assets/ui-refresh/contest/contest-stage-bg.webp'), linear-gradient(180deg, var(--cs-stage-top), var(--cs-stage-bottom)); background-size: cover, auto; background-position: center top; background-repeat: no-repeat; }
#screen-tournament > .contest-scroll { position: relative; z-index: 1; }
.contest-head { min-width: 0; /* its overflowing rules button / peeking cat must not widen the 320px column to 334px */ position: relative; overflow: visible; display: grid; justify-items: center; gap: 0; padding-top: 2px; padding-bottom: 0; }
.contest-ribbon { display: grid; place-items: center; position: relative; isolation: isolate; width: 328px; height: 116px; max-width: 100%; padding: 0; box-sizing: border-box; }
.contest-title-emblem { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: -1; pointer-events: none; }
/* The cat peeks from behind my card: lower z-index than .contest-me, its bottom part is covered by the card. */
/* The cat's drawn bottom level with the plate's bottom edge, not its laurel leaves (owner 2026-10-31):
   top = 2px head padding + plate edge (187/240 of 116px) - cat art bottom (214/240 of its 83px box). */
.contest-peek-cat { position: absolute; right: 10px; top: 18px; width: 76px; height: 83px; object-fit: contain; z-index: 0; pointer-events: none; }
#tournament-title { position: relative; z-index: 1; margin: 0; max-width: 210px; padding-bottom: 0; top: 4px; font-size: 36px; line-height: 1; white-space: nowrap; text-align: center; color: #ffe066; }
.contest-rules-btn { position: absolute; z-index: 3; /* beside the centered plate, but never past the screen edge (320px) */ left: min(calc(100% - 6px), calc(50% + 50vw - 48px)); top: 4px; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--cs-gold); background: var(--cs-score-pill); color: #fff; font-size: 18px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.contest-timeleft { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: 42px; margin: -14px 0 26px; padding: 0 16px; line-height: 1; border-radius: 999px; background: var(--cs-stage-edge); color: var(--cs-gold-hi); font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.contest-timeleft:empty { display: none; } /* offline / loading: no empty pill */
.contest-reward-strip { position: relative; z-index: 1; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: linear-gradient(180deg, var(--cs-reward), var(--cs-reward-edge)); border: 3px solid var(--cs-gold); box-shadow: var(--cs-shadow); }
.contest-reward-strip.hidden { display: none; }
.contest-reward-art { width: 52px; height: 52px; }
.contest-reward-text { margin: 0; color: #fff; font-size: 16px; font-weight: 900; }
.contest-me-reward { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 4px 10px; word-break: keep-all; overflow-wrap: anywhere; border-radius: 999px; background: #ece3ff; font-size: 15px; font-weight: 900; color: #6b3fc4; }
.contest-me-reward.hidden { display: none; }
.contest-me-reward-icon { width: 20px; height: 20px; object-fit: contain; flex: 0 0 auto; }
/* The three tabs under the title board (weekly / 1:1 / send a puzzle): the wooden board tone of the board / groups switch, the open tab lit gold. */
/* 8px under the plate's bottom edge (187/240 of the art; the laurel leaves may run behind the tabs) and
   8px over the pane (owner 2026-10-31). The scroll grid's 12px gap is included; with the time pill shown,
   its 26px bottom margin keeps the tabs 8px under the pill. */
.contest-modes { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: -30px 0 -4px; }
.contest-mode-btn { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; padding: 4px 6px; box-sizing: border-box; border-radius: 14px; border: 3px solid var(--cs-stage-edge); background: var(--cs-stage-edge); color: #c8d6f2; font: inherit; font-size: 16px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.contest-mode-btn.active { background: linear-gradient(180deg, var(--cs-gold-hi), var(--cs-gold)); border-color: var(--cs-gold-lo); color: var(--cs-brown); }
.contest-mode-btn.active .contest-mode-label.bp-outline-text { color: #4a2a0c; text-shadow: none; -webkit-text-stroke: 0; }
.contest-mode-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.contest-mode-label { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; line-height: 1.15; }
.contest-pane { display: grid; gap: 12px; align-content: start; min-width: 0; }
.contest-pane.hidden { display: none; }
.contest-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contest-switch-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px; border: 3px solid var(--cs-stage-edge); background: var(--cs-stage-edge); color: #c8d6f2; font-size: 18px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.contest-switch-icon { width: 34px; height: 34px; object-fit: contain; }
.contest-switch-pointer { display: none; position: absolute; left: 50%; bottom: -9px; width: 18px; height: 9px; margin-left: -9px; background: var(--cs-gold); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.contest-switch-btn.active .contest-switch-pointer { display: block; }
.contest-switch-btn.active { background: linear-gradient(180deg, var(--cs-gold-hi), var(--cs-gold)); border-color: var(--cs-gold-lo); color: var(--cs-brown); }
/* Gold face: dark brown letters, no outline and no shadow. The extra class beats the shared outline rule at the end of style.css. */
.contest-switch-btn.active .contest-switch-label.bp-outline-text { color: #4a2a0c; text-shadow: none; -webkit-text-stroke: 0; }
.contest-switch-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.contest-board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contest-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; padding: 4px 10px; border-radius: 12px; background: #fff; border: 2px solid var(--cs-cream-deep); color: var(--cs-brown); text-align: left; width: 100%; box-sizing: border-box; cursor: pointer; touch-action: manipulation; font: inherit; font-size: 17px; }
.contest-row--me { background: var(--cs-me-row); border-color: var(--cs-gold-lo); cursor: default; }
.contest-row-rank { font-weight: 900; text-align: center; font-size: 18px; }
.contest-row-medal { width: 40px; height: 40px; display: block; margin: 0 auto; }
.contest-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.contest-row-total { padding: 2px 12px; border-radius: 999px; background: var(--cs-score-pill); color: #fff; font-weight: 900; font-variant-numeric: tabular-nums; }
.contest-board-gap { text-align: center; color: var(--cs-brown-soft); font-weight: 900; letter-spacing: .2em; }
#contest-board-myrow { position: sticky; bottom: 0; }
#contest-board-myrow.hidden { display: none; }
.contest-board-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 900; color: var(--cs-gold-lo); padding: 2px 8px; }
.contest-board-line-rule { flex: 1; border-top: 2px dashed var(--cs-gold-lo); }
.contest-podium-spot[data-place="1"] { order: 2; } .contest-podium-spot[data-place="2"] { order: 1; } .contest-podium-spot[data-place="3"] { order: 3; }
.contest-podium-crown { width: 20px; height: 20px; display: block; }
.contest-group-rows { display: grid; gap: 6px; }
.contest-row-sub { font-size: 14px; color: var(--cs-brown-soft); margin-left: 6px; }
.contest-group-face-name { max-width: 100%; font-size: 11px; line-height: 1.2; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; color: #5a3313; }
.contest-group-face-add.hidden { display: none; }
.contest-invite-strip.hidden { display: none; }
#btn-contest-groups-manage { margin-left: auto; }
.contest-groups-manage.hidden { display: none; }
.contest-groups-members { flex: 0 1 auto; min-width: 0; white-space: nowrap; }
#popup-contest-row .contest-btn, #popup-contest-group-manage .contest-btn { width: 100%; }

/* Contest popups (nickname, result, group, invite join) and the relocated duel popup. */
.popup-card--contest { position: relative; display: grid; gap: 10px; width: min(92vw, 380px); max-height: min(88vh, calc(100dvh - 40px - var(--popup-safe-y))); overflow-y: auto; box-sizing: border-box; }
.contest-popup-body { margin: 0; font-size: 15px; text-align: center; }
.contest-input { min-height: 44px; width: 100%; box-sizing: border-box; border: 2px solid var(--cs-gold); border-radius: 12px; padding: 0 12px; font-size: 18px; font-weight: 700; color: var(--cs-brown); background: #fff; }
.contest-error { margin: 0; min-height: 18px; font-size: 13px; font-weight: 700; color: #c0392b; text-align: center; }
.contest-nick-avatars { display: grid; gap: 8px; }
.contest-nick-avatar-title { margin: 0; font-size: 16px; font-weight: 900; text-align: center; color: var(--cs-brown); }
.contest-nick-avatar-grid { display: grid; grid-template-columns: repeat(4, 56px); justify-content: space-between; gap: 8px; }
.contest-avatar-btn { width: 56px; height: 56px; padding: 0; border-radius: 50%; border: 3px solid var(--cs-cream-deep); background: var(--cs-cream, #fff6df); overflow: hidden; cursor: pointer; touch-action: manipulation; }
.contest-avatar-img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 22%; }
.contest-avatar-btn.active { border-color: var(--cs-gold-lo); box-shadow: 0 0 0 3px var(--cs-gold); }
.contest-avatar-btn:focus-visible { outline: 3px solid var(--cs-brown); outline-offset: 2px; }
.contest-popup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contest-result-found { margin: 0; text-align: center; font-size: 18px; font-weight: 900; }
.contest-result-rank { font-size: 16px; font-weight: 900; }
.contest-result-breakdown { display: grid; gap: 4px; font-size: 14px; }
#popup-contest-group[data-mode="join"] #contest-group-name-input { display: none; }
#popup-contest-group[data-mode="create"] #contest-group-code-input, #popup-contest-group[data-mode="rename"] #contest-group-code-input { display: none; }
/* "+" on the group tabs (2.4.0): create or join with a code, shaped like the group tabs. */
.contest-group-modes { display: flex; gap: 8px; justify-content: center; }
.contest-group-mode { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 10px; box-sizing: border-box; border-radius: 999px; border: 2px solid #ecd48a; background: linear-gradient(180deg, #fffdf5, var(--cs-cream)); color: var(--cs-brown); font-size: 15px; font-weight: 900; line-height: 1.15; cursor: pointer; touch-action: manipulation; }
.contest-group-mode.active { border-color: var(--cs-gold-lo); background: linear-gradient(180deg, #ffe680, var(--cs-gold) 65%, #e3a92f); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), 0 3px 0 rgba(185, 129, 31, .6); }

@media (max-width: 360px) { .contest-row { font-size: 15px; gap: 6px; } #tournament-title { font-size: 30px; max-width: 185px; top: 3px; } .contest-ribbon { width: 290px; height: 102px; } .contest-peek-cat { top: 8px; right: 1px; } .contest-modes { margin-top: -26px; } .contest-me-avatar { max-width: 96px; } .contest-me-rank, .contest-me-pct { white-space: normal; } .contest-me { grid-template-columns: 96px minmax(0, 1fr); column-gap: 8px; } .contest-me-medal { max-width: 96px; } .contest-me-rankline { flex-wrap: wrap; } .contest-btn--start { font-size: 17px; } .contest-slot { min-height: 54px; } .contest-slot-check { width: 18px; height: 18px; } .contest-switch-btn { font-size: 16px; } .contest-mode-btn { padding-inline: 3px; } .contest-mode-btn .contest-mode-label { font-size: 14px; } .contest-slots-grid { grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 6px; } .contest-slot { font-size: 14px; } .contest-groups-actions { grid-template-columns: 1fr; } }

/* Group cards (task 9). The card row scrolls inside #contest-groups-cards; nothing here widens the page. */
.contest-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.contest-group-code { align-self: center; font-size: 14px; font-weight: 900; letter-spacing: .04em; }

/* Toast (task 10): one short line above the bottom bar for reports, joins and copied invite links. */
.contest-toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); box-sizing: border-box; background: var(--cs-brown); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
.contest-toast.show { opacity: 1; }

@media (min-width: 431px) { .contest-me { grid-template-columns: 140px minmax(0, 1fr); column-gap: 14px; } .contest-me-medal { max-width: 140px; } .contest-me-laurel { width: 28px; height: 60px; } }

.contest-face-initial { display: flex; align-items: center; justify-content: center; font-weight: 900; color: var(--cs-brown-soft); }

/* "우리 모임" (mockup 2026-10-28): blue band on top, cream body, gold-medal podium over a park picture, gold rows, big invite buttons. */
#contest-groups { padding: 0; gap: 12px; overflow: hidden; border-width: 3px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .75), inset 0 -3px 0 rgba(185, 129, 31, .45), var(--cs-shadow); }
#contest-groups-tabrow, #contest-groups-members-row, #contest-groups-cards, #contest-groups-empty { padding-inline: 12px; }
#contest-groups-empty { padding-bottom: 14px; }
#contest-groups-cards { padding-bottom: 12px; }
.contest-card-band { gap: 8px; min-height: 60px; padding: 8px 12px; box-sizing: border-box; border-bottom: 3px solid var(--cs-gold); border-radius: 19px 19px 0 0; background: linear-gradient(180deg, var(--cs-blue-top), var(--cs-blue-bottom)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 2px 0 var(--cs-gold-lo); }
.contest-groups-head-icon { width: 34px; height: 34px; }
#contest-groups-title, #contest-board-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(16px, 5.2vw, 22px); line-height: 1.1; word-break: keep-all; overflow-wrap: anywhere; color: #ffe066; }
.contest-groups-head-paw { width: 20px; height: 20px; object-fit: contain; flex: 0 0 auto; opacity: .85; }
.contest-groups-manage { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; box-sizing: border-box; border: 2px solid var(--cs-gold-hi); border-radius: 999px; background: linear-gradient(180deg, #fff, #e6eefb); box-shadow: 0 2px 0 rgba(6, 52, 138, .55), inset 0 1px 0 #fff; color: #123d8c; font: inherit; font-size: 15px; font-weight: 900; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.contest-band-pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; box-sizing: border-box; border: 2px solid var(--cs-gold-hi); border-radius: 999px; background: linear-gradient(180deg, #fff, #e6eefb); box-shadow: 0 2px 0 rgba(6, 52, 138, .55), inset 0 1px 0 #fff; color: #123d8c; font: inherit; font-size: 15px; font-weight: 900; white-space: nowrap; cursor: default; touch-action: manipulation; }
#btn-contest-groups-manage { margin-left: 0; }
.contest-groups-manage-icon { width: 22px; height: 22px; object-fit: contain; }
.contest-groups-tabrow { display: flex; align-items: center; gap: 8px; }
.contest-groups-tabs-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.contest-groups-tabs { display: flex; gap: 8px; overflow-x: auto; flex: 1 1 auto; min-width: 0; padding: 2px; margin: -2px; }
.contest-groups-members-row { display: flex; align-items: center; gap: 4px; margin-top: -10px; min-height: 18px; }
.contest-groups-members-icon { width: 18px; height: 18px; object-fit: contain; flex: 0 0 auto; }
.contest-groups-members { font-size: 13px; }
.contest-groups-members-icon.hidden { display: none; }
.contest-tabs-arrow { position: absolute; top: calc(50% - 1px); transform: translateY(-50%); display: none; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.contest-tabs-arrow--left { left: 0; }
.contest-tabs-arrow--right { right: 0; }
.contest-tabs-arrow-fade { position: absolute; top: -8px; bottom: -8px; width: 56px; pointer-events: none; }
.contest-tabs-arrow--left .contest-tabs-arrow-fade { left: 0; background: linear-gradient(90deg, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, .95) 55%, rgba(255, 255, 255, 0) 100%); }
.contest-tabs-arrow--right .contest-tabs-arrow-fade { right: 0; background: linear-gradient(270deg, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, .95) 55%, rgba(255, 255, 255, 0) 100%); }
.contest-tabs-arrow-img { position: relative; width: 32px; height: 32px; padding: 7px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--cs-gold-hi); background: var(--cs-cream); box-shadow: 0 2px 0 rgba(185, 129, 31, .45); object-fit: contain; }
.contest-tabs-arrow--left .contest-tabs-arrow-img { transform: scaleX(-1); }
.contest-groups-tabs-wrap[data-more-left="true"] .contest-tabs-arrow--left, .contest-groups-tabs-wrap[data-more-right="true"] .contest-tabs-arrow--right { display: flex; }
.contest-group-tab { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 44px; padding: 0 16px; box-sizing: border-box; border-radius: 999px; border: 2px solid #ecd48a; background: linear-gradient(180deg, #fffdf5, var(--cs-cream)); color: var(--cs-brown); font-size: 16px; font-weight: 900; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.contest-group-tab.active { border-color: var(--cs-gold-lo); background: linear-gradient(180deg, #ffe680, var(--cs-gold) 65%, #e3a92f); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), 0 3px 0 rgba(185, 129, 31, .6); }
.contest-group-card { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; border: 0; border-radius: 0; background: transparent; padding: 0; display: grid; gap: 14px; box-sizing: border-box; }
.contest-podium { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); align-items: end; gap: 4px; padding: 16px 8px 12px; border: 2px solid #ecd48a; border-radius: 18px; background: #bfe3ff url('../assets/ui-refresh/contest/contest-groups-podium-bg.webp') center / cover no-repeat; overflow: hidden; }
.contest-podium-spot { display: grid; justify-items: center; align-content: end; gap: 0; min-width: 0; }
.contest-podium-medal { position: relative; width: 100%; max-width: 100px; aspect-ratio: 100 / 110; }
.contest-podium-spot[data-place="1"] .contest-podium-medal { max-width: 120px; aspect-ratio: 120 / 130; }
.contest-podium-face { position: absolute; left: 18%; top: 22%; width: 64%; height: 64%; z-index: 0; border-radius: 50%; background: var(--cs-cream, #fff6df); object-fit: cover; object-position: 50% 22%; display: block; box-sizing: border-box; }
.contest-podium-spot.contest-podium-spot--me .contest-podium-face { background: var(--cs-me-row); }
.contest-podium-ring { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; object-fit: contain; pointer-events: none; }
.contest-podium-place { position: absolute; left: 0; right: 0; top: 2%; z-index: 2; text-align: center; font-size: 13px; line-height: 1.2; font-weight: 900; color: #4a2a0c; }
.contest-podium-spot[data-place="1"] .contest-podium-place { font-size: 16px; top: 0; }
.contest-podium-name { position: relative; z-index: 2; width: 100%; box-sizing: border-box; margin-top: -12px; padding: 4px 6px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .7); font-size: 15px; line-height: 1.2; font-weight: 900; text-align: center; color: #4a2a0c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: linear-gradient(180deg, #dfe6f2, #b9c6da); box-shadow: 0 2px 0 rgba(60, 70, 90, .3); }
.contest-podium-spot[data-place="1"] .contest-podium-name { background: linear-gradient(180deg, #fff3b0, #f0bf45); }
.contest-podium-spot[data-place="3"] .contest-podium-name { background: linear-gradient(180deg, #f6d2b0, #e2a676); }
.contest-podium-step { width: 92%; box-sizing: border-box; min-height: 48px; margin-top: 2px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .6); display: grid; place-items: center; font-weight: 900; color: #4a2a0c; background: linear-gradient(180deg, #dfe6f2, #b9c6da); box-shadow: 0 3px 0 rgba(60, 70, 90, .3); }
.contest-podium-spot[data-place="1"] .contest-podium-step { min-height: 62px; background: linear-gradient(180deg, #fff3b0, #f0bf45); box-shadow: 0 3px 0 rgba(185, 129, 31, .6); }
.contest-podium-spot[data-place="2"] .contest-podium-step { min-height: 52px; }
.contest-podium-spot[data-place="3"] .contest-podium-step { min-height: 46px; background: linear-gradient(180deg, #f6d2b0, #e2a676); box-shadow: 0 3px 0 rgba(150, 90, 40, .4); }
.contest-podium-empty { position: absolute; left: 18%; top: 22%; width: 64%; height: 64%; z-index: 0; border-radius: 50%; border: 3px dashed rgba(120, 86, 40, .55); box-sizing: border-box; background: rgba(255, 246, 223, .75); display: grid; place-items: center; font-size: 26px; font-weight: 900; color: rgba(120, 86, 40, .7); }
.contest-podium-spot--empty .contest-podium-name { color: rgba(74, 42, 12, .7); }
.contest-podium-spot--empty[role="button"] { cursor: pointer; }
.contest-podium-total { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.contest-group-rows .contest-row { grid-template-columns: 22px 34px 2px minmax(0, 1fr) auto; gap: 8px; min-height: 60px; padding: 4px 12px; border-radius: 16px; border: 2px solid var(--cs-gold-lo); background: linear-gradient(180deg, #fff3b0, var(--cs-gold) 70%, #e9b43a); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), 0 3px 0 rgba(185, 129, 31, .55); }
.contest-group-rows .contest-row--me { border-color: #8a5a10; }
.contest-group-row-paw { width: 22px; height: 22px; object-fit: contain; }
.contest-group-rows .contest-row-rank { font-size: 28px; line-height: 1; }
.contest-group-row-divider { width: 2px; height: 32px; border-radius: 1px; background: rgba(122, 84, 50, .45); }
.contest-group-rows .contest-row-name { font-size: 20px; font-weight: 900; color: #4a2a0c; }
.contest-group-rows .contest-row-sub { font-size: 15px; }
.contest-group-rows .contest-row-total { padding: 4px 16px; border: 2px solid var(--cs-blue-edge); background: linear-gradient(180deg, var(--cs-blue-top), var(--cs-blue-bottom)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 0 var(--cs-blue-edge); font-size: 22px; line-height: 1.15; color: #fff; }
.contest-group-faces { position: relative; display: flex; align-items: flex-start; gap: 6px; flex-wrap: nowrap; padding-bottom: 6px; }
.contest-group-face-unit { flex: 0 1 54px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.contest-group-face { width: 100%; aspect-ratio: 1 / 1; border-radius: 50%; border: 3px solid var(--cs-gold); box-shadow: 0 0 0 3px rgba(240, 191, 69, .28); object-fit: cover; object-position: 50% 22%; box-sizing: border-box; background: var(--cs-cream, #fff6df); display: block; }
.contest-group-face-name { max-width: 100%; font-size: 11px; line-height: 1.2; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; color: #5a3313; }
.contest-group-face-add { flex: 0 1 54px; min-width: 0; aspect-ratio: 1 / 1; padding: 0; border-radius: 50%; border: 2px dashed var(--cs-brown-soft); background: transparent; color: var(--cs-brown-soft); font: inherit; font-size: 28px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.contest-group-faces-paw { position: absolute; width: 26px; height: 26px; object-fit: contain; opacity: .35; pointer-events: none; }
.contest-group-faces-paw--1 { left: -2px; bottom: -14px; }
.contest-group-faces-paw--2 { right: 4px; bottom: -12px; width: 22px; height: 22px; }
.contest-invite-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contest-invite-strip .contest-btn { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; height: 64px; min-height: 64px; padding: 0 12px; box-sizing: border-box; border-radius: 18px; font-size: 18px; line-height: 1.15; white-space: normal; word-break: keep-all; text-align: center; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 3px 0 rgba(0, 0, 0, .25); }
.contest-invite-strip .contest-btn--main { font-size: 20px; }
.contest-invite-strip .contest-btn-icon { width: 28px; height: 28px; }
.contest-btn-paw { position: absolute; right: 8px; bottom: 4px; width: 20px; height: 20px; object-fit: contain; opacity: .35; pointer-events: none; }
@media (max-width: 420px) { #contest-board-paw, .contest-groups-head-paw { display: none; } }
@media (max-width: 360px) { .contest-groups-head-paw { display: none; } .contest-groups-manage { padding: 0 10px; font-size: 14px; } .contest-group-face-unit, .contest-group-face-add { flex-basis: 44px; } .contest-podium-total { font-size: 24px; } .contest-podium-name { font-size: 13px; } .contest-group-rows .contest-row { grid-template-columns: 18px 28px 2px minmax(0, 1fr) auto; gap: 6px; padding: 4px 8px; } .contest-group-rows .contest-row-name { font-size: 17px; } .contest-group-rows .contest-row-total { font-size: 19px; padding: 4px 12px; } .contest-invite-strip .contest-btn { font-size: 15px; gap: 4px; padding: 0 8px; } .contest-invite-strip .contest-btn--main { font-size: 17px; } }
@media (max-width: 340px) { #btn-contest-groups-manage { flex: 0 1 auto; } }
/* Shrink fixes: every track in the groups card may be narrower than its content; rank number sits inside the crown. */
#contest-groups { grid-template-columns: minmax(0, 1fr); min-width: 0; }
#contest-groups-head, #contest-board-head, #contest-groups-tabrow, #contest-groups-cards, #contest-groups-empty { min-width: 0; box-sizing: border-box; }
.contest-card-band { min-width: 0; }
/* The title clips long names (overflow hidden); room for the 2px outline so the first letter is not cut, same text position. */
.contest-card-band .contest-panel-title { padding: 2px 4px; margin-inline-start: -4px; }
.contest-groups-manage { flex: 0 0 auto; min-width: 0; overflow: hidden; }
.contest-groups-manage { justify-content: center; width: 44px; height: 44px; padding: 0; gap: 0; border-radius: 50%; }
.contest-groups-manage-icon { width: 24px; height: 24px; }
.contest-band-pill { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.contest-group-card { grid-template-columns: minmax(0, 1fr); }
.contest-group-rows { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.contest-group-rows .contest-row { min-width: 0; }
.contest-podium { min-width: 0; box-sizing: border-box; }
.contest-podium-spot, .contest-podium-name, .contest-podium-step { min-width: 0; }
.contest-podium-ring { height: auto; }
.contest-invite-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-width: 0; }
.contest-invite-strip .contest-btn { min-width: 0; }
.contest-invite-strip .contest-btn-label { min-width: 0; overflow-wrap: anywhere; }
.contest-podium-place { left: 50%; right: auto; top: 25%; width: auto; transform: translate(-50%, -50%); font-size: 14px; color: #5a3313; text-shadow: none; }
.contest-podium-spot[data-place="1"] .contest-podium-place { top: 24%; font-size: 14px; }
.contest-podium-spot[data-place="3"] .contest-podium-place { top: 24%; }

/* Board card: same band as the groups card; the card itself carries no padding so the band spans its full width. */
#contest-board { padding: 0; gap: 8px; overflow: hidden; grid-template-columns: minmax(0, 1fr); min-width: 0; border-width: 3px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .75), inset 0 -3px 0 rgba(185, 129, 31, .45), var(--cs-shadow); }
#contest-board-empty, #contest-board-list, #contest-board-myrow { padding-inline: 12px; box-sizing: border-box; min-width: 0; }
#contest-board-list { padding-bottom: 12px; }
#contest-board-title { color: #ffe066; font-size: clamp(16px, 5.2vw, 22px); line-height: 1.1; word-break: keep-all; overflow-wrap: anywhere; }

/* Long languages: nothing in my card may be wider than its panel (checked per language at 390px and 320px). */
.contest-me-panel { overflow-wrap: anywhere; }
.contest-me-main > *, .contest-me-panel > *, .contest-me-panel :is(.contest-me-head, .contest-me-scoreline, .contest-me-total, .contest-me-rankline, .contest-me-rank, .contest-me-pct, .contest-me-reward, .contest-me-reward-text, .contest-me-lastweek, .contest-title-ribbon) { min-width: 0; max-width: 100%; }
#contest-me-total .contest-me-total-label { white-space: normal; text-align: center; word-break: keep-all; overflow-wrap: anywhere; max-width: 100%; }
.contest-me-reward, .contest-me-reward-text, .contest-me-lastweek { white-space: normal; text-align: center; word-break: keep-all; overflow-wrap: anywhere; }
.contest-me-reward { border-radius: 18px; }
.contest-me-scoreline .contest-me-total { flex: 0 1 auto; }

/* Korean breaks between words, as on the shop, World and Collection (2.5.2: "주세|요." in the offline card). */
html:lang(ko) #screen-tournament {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
