From ca8baf5cc8443fd6348d45b4d770152399e5aa84 Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sat, 17 Oct 2026 16:17:15 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=EA=B2=8C=EC=9E=84?= =?UTF-8?q?=EC=9D=B4=20=EB=82=A8=EB=8A=94=20=ED=99=94=EB=A9=B4=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=EB=A5=BC=20=EC=93=B0=EB=8F=84=EB=A1=9D:=20=EA=B2=8C?= =?UTF-8?q?=EC=9E=84=EB=B3=84=20=ED=8F=AD=20=EC=83=81=ED=95=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0,=20=ED=8C=90=C2=B7=EC=B9=B4=EB=93=9C=C2=B7=EB=A7=90?= =?UTF-8?q?=EC=9D=84=20--play-w/--play-h=EC=97=90=20=EB=A7=9E=EC=B6=B0=20?= =?UTF-8?q?=ED=82=A4=EC=9B=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카드 게임: 펠트가 남는 높이를 채우고 손패·가운데 더미·자리 크기가 화면에 따라 커짐 - 판 게임: 체스·바둑·오목 등은 높이를 다 쓰고, 장기·쿼리도·젬블로는 넓은 화면에서 조작판을 판 옆으로 - 섯다: 자리를 판 크기에 맞춘 타원 위에 고르게 두고, 많을 때 자리 크기를 줄여 8명에서도 겹치지 않게 - 바퀴벌레 포커 6명·야단법석 달리기 5명 선수 뽑기가 PC에서 넘치지 않게 - 휴대폰·태블릿(1100px 아래) 배치는 그대로 - layout-survey: 컴퓨터 넣기 버튼 기다림, 넘친 높이(px) 표시 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/games/apple/index.tsx | 6 + apps/web/src/games/baduk/index.tsx | 8 +- apps/web/src/games/bang/index.tsx | 12 +- apps/web/src/games/blackjack/board.tsx | 20 +- apps/web/src/games/case-file/index.tsx | 30 +- .../src/games/castles-of-burgundy/index.tsx | 19 +- apps/web/src/games/catchmind/index.tsx | 13 +- apps/web/src/games/chess/index.tsx | 8 +- apps/web/src/games/clue/index.tsx | 20 ++ apps/web/src/games/cockroach-poker/index.tsx | 12 +- apps/web/src/games/connect-four/index.tsx | 9 +- apps/web/src/games/dalmuti/index.tsx | 15 + apps/web/src/games/davinci-code/index.tsx | 22 +- apps/web/src/games/dobble/index.tsx | 6 +- apps/web/src/games/gemblo/index.tsx | 280 ++++++++++-------- apps/web/src/games/gostop/index.tsx | 115 +++++-- apps/web/src/games/halli-galli/index.tsx | 41 ++- apps/web/src/games/hot-streak/index.tsx | 6 + apps/web/src/games/janggi/index.tsx | 123 +++++--- apps/web/src/games/las-vegas/index.tsx | 24 ++ apps/web/src/games/liar/index.tsx | 2 +- apps/web/src/games/mafia/index.tsx | 2 +- apps/web/src/games/magical-athlete/index.tsx | 19 ++ apps/web/src/games/mahjong/index.tsx | 12 +- apps/web/src/games/marble/index.tsx | 9 + apps/web/src/games/ninety-nine/index.tsx | 16 +- apps/web/src/games/old-maid/index.tsx | 44 ++- apps/web/src/games/omok/index.tsx | 5 +- apps/web/src/games/one-card/index.tsx | 31 +- apps/web/src/games/othello/index.tsx | 7 +- apps/web/src/games/poker/index.tsx | 105 +++++-- apps/web/src/games/quoridor/index.tsx | 155 ++++++---- apps/web/src/games/rummikub/index.tsx | 19 +- apps/web/src/games/seotda/board.tsx | 93 ++++-- apps/web/src/games/six-nimmt/index.tsx | 21 +- apps/web/src/games/splendor/index.tsx | 19 ++ apps/web/src/games/tichu/index.tsx | 17 ++ apps/web/src/games/uno/index.tsx | 31 +- apps/web/src/games/yacht/index.tsx | 23 +- e2e/layout-survey.ts | 9 +- 40 files changed, 1025 insertions(+), 403 deletions(-) diff --git a/apps/web/src/games/apple/index.tsx b/apps/web/src/games/apple/index.tsx index b454817..25270b5 100644 --- a/apps/web/src/games/apple/index.tsx +++ b/apps/web/src/games/apple/index.tsx @@ -137,6 +137,12 @@ const CSS = ` @keyframes ap-count { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.85); opacity: .85; } } @keyframes ap-pop { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.25); opacity: .9; } 100% { transform: scale(.2) translateY(-30px); opacity: 0; } } @keyframes ap-flash { 0% { opacity: 0; transform: translateX(-50%) scale(.8); } 15% { opacity: 1; transform: translateX(-50%) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; } } +/* PC: the 17x10 board is the largest that fits the play column after the score rows, buttons and key help (~150px). */ +@media (min-width: 1100px) { + .ap-wrap { width: min(100%, calc((var(--play-h) - 150px) * 1.7)); } + .ap-pill { font-size: clamp(1rem, calc(var(--play-h) * .017), 1.2rem); } + .ap-others li { font-size: clamp(.85rem, calc(var(--play-h) * .014), 1rem); } +} @media (prefers-reduced-motion: reduce) { .ap-hint { animation: none; } .ap-pop { animation-duration: .01s; } .ap-flash, .ap-in, .ap-burst, .ap-over.count b { animation: none; } .ap-burst { display: none; } } `; diff --git a/apps/web/src/games/baduk/index.tsx b/apps/web/src/games/baduk/index.tsx index a5ca000..66f936e 100644 --- a/apps/web/src/games/baduk/index.tsx +++ b/apps/web/src/games/baduk/index.tsx @@ -66,6 +66,8 @@ type MarkMode = 'dead' | 'seki'; const BADUK_CSS = ` .bd-own { transform-box: fill-box; transform-origin: center; animation: bd-own .32s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: var(--d, 0ms); } @keyframes bd-own { from { opacity: 0; transform: scale(.2); } } +/* PC: the board takes the whole play-area height minus the rows that can show under it (--bd-rows). */ +@media (min-width: 1100px) { .board-wrap.bd-fit { max-width: min(100%, calc(var(--play-h) - var(--bd-rows, 0px))); } } `; /** @@ -262,7 +264,11 @@ function BadukBoard({ view: v, act, pending, tapConfirm }: BoardProps const lastColor: Color | null = v.lastMove ? (at(v.lastMove) === 1 ? 'black' : 'white') : null; const pad = 0.95; return ( -
+
`${CARD_INFO[f.kind].name}, ${SUIT_KO[f.suit]} // ---------------------------------------------------------------- styles const CSS = ` -.bg { width: 100%; max-width: 1180px; display: flex; flex-direction: column; gap: 12px; align-self: center; } +.bg { width: 100%; display: flex; flex-direction: column; gap: 12px; align-self: stretch; } .bg-table { position: relative; width: 100%; aspect-ratio: 16 / 8.2; min-height: 460px; border-radius: 200px; border: 10px solid var(--wood); background: radial-gradient(ellipse at center, rgba(255,255,255,.13), rgba(255,255,255,0) 62%), var(--felt); box-shadow: var(--shadow); } .bg-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: var(--sw, 178px); z-index: 1; @@ -160,6 +160,16 @@ button.bg-card:focus-visible { outline: 3px solid var(--focus); outline-offset: .bg-log { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; max-height: 300px; overflow: auto; } .bg-rules td, .bg-rules th { padding: 4px 6px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); } .bg-last { font-size: .86rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; } +/* PC: fill the play column; the table takes the height my area leaves, hand cards grow a little with the screen. */ +@media (min-width: 1100px) { + .bg { flex: 1 1 auto; min-height: 0; } + .bg-table { flex: 1 1 auto; aspect-ratio: auto; min-height: 400px; } + .bg-me .bg-card:not(.sm) { --cw: clamp(96px, calc(var(--play-h) * .11), 124px); } +} +/* Very large screens: seats and the centre piles grow with the bigger table (scaled around their own centre). */ +@media (min-width: 2200px) and (min-height: 1200px) { + .bg-seat, .bg-center { transform: translate(-50%, -50%) scale(1.3); } +} @media (max-width: 719px) { .bg-table { aspect-ratio: auto; min-height: 0; border-radius: 18px; border-width: 6px; padding: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } .bg-seat { position: static; transform: none; width: auto; padding: 4px 5px; font-size: .76rem; gap: 2px; border-width: 2px; } diff --git a/apps/web/src/games/blackjack/board.tsx b/apps/web/src/games/blackjack/board.tsx index 245848e..0250dd8 100644 --- a/apps/web/src/games/blackjack/board.tsx +++ b/apps/web/src/games/blackjack/board.tsx @@ -26,7 +26,7 @@ const HAND_KO: Record = { playing: '', stand: '', bu const OUTCOME_KO: Record, string> = { win: '승', lose: '패', push: '푸시', blackjack: '블랙잭', bonus: '보너스' }; const CSS = ` -.bj-wrap { width: 100%; max-width: 1180px; display: flex; flex-direction: column; gap: 12px; align-self: center; } +.bj-wrap { width: 100%; display: flex; flex-direction: column; gap: 12px; align-self: stretch; } .bj-table { position: relative; width: 100%; aspect-ratio: 16 / 8.4; min-height: 460px; border: 12px solid var(--wood); border-radius: 48px 48px 50% 50% / 48px 48px 34% 34%; background: radial-gradient(ellipse at 50% 20%, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%), @@ -40,7 +40,7 @@ const CSS = ` .bj-print::after { content: ''; display: block; width: 420px; height: 120px; margin: -64px auto 0; border: 2px solid rgba(255,255,255,.12); border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; } .bj-dealer { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 2; } .bj-dealer .who { display: flex; gap: 8px; align-items: center; font-weight: 900; font-size: .9rem; } -.bj-shoe { position: absolute; right: 7%; top: 20px; width: 70px; height: 92px; z-index: 1; } +.bj-shoe { position: absolute; right: 7%; top: 20px; width: 70px; height: 92px; z-index: 1; transform: scale(var(--bjs, 1)); transform-origin: top right; } .bj-shoe i { position: absolute; inset: 0; border-radius: 8px; background: linear-gradient(160deg, #3b82f6, #1e3a8a); border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.35); } .bj-shoe i:nth-child(2) { transform: translate(-4px, 4px); } .bj-shoe i:nth-child(3) { transform: translate(-8px, 8px); } .bj-shoe::after { content: ''; position: absolute; left: -16px; right: -6px; bottom: -12px; height: 34px; border-radius: 8px; background: linear-gradient(180deg, #4b5563, #1f2937); box-shadow: 0 3px 6px rgba(0,0,0,.4); } @@ -117,6 +117,12 @@ const CSS = ` .bj-act:active { transform: translateY(1px); } :root[data-theme='dark'] .bj-act { color: color-mix(in srgb, var(--c) 55%, #fff); } .bj-help { margin: 0; text-align: center; min-height: 1.4em; } +/* PC: the table takes all the height the dock leaves (cards grow with it, see BlackjackBoard). */ +@media (min-width: 1100px) { + .bj-wrap { flex: 1 1 auto; min-height: 0; justify-content: center; } + .bj-table { flex: 1 1 0; aspect-ratio: auto; max-height: calc(var(--play-w) * .62); } + .bj-print b { font-size: calc(1.5rem * var(--bjs, 1)); } +} @media (max-width: 719px) { .bj-table { aspect-ratio: auto; min-height: 0; border-width: 7px; border-radius: 24px; padding: 12px 8px; display: flex; flex-direction: column; gap: 14px; } .bj-print, .bj-shoe { display: none; } @@ -643,12 +649,14 @@ export function BlackjackBoard({ view: v, me, players, act, pending, deadline }: const dealerCards = d.cards.map((c) => c ?? holeKey(v)).filter((k) => q.shown(k)); const dealerReal = d.cards.filter((c): c is string => !!c && q.shown(c)); const slots = seatLayout(v, me); - const otherW = phone ? 40 : 56; - const myW = phone ? 56 : 76; - const dealerW = phone ? 56 : 66; // Table width for fitting cards into each seat's share (phone: my seat a full row, others two per row). const tableRef = useRef(null); const [[tableW, tableH], setTableSize] = useState([990, 520]); + // Cards grow with the table on PC (1 at the old 990×520 table, up to 1.7×). + const scale = phone ? 1 : Math.min(1.7, Math.max(1, Math.min(tableW / 990, tableH / 520))); + const otherW = phone ? 40 : Math.round(56 * scale); + const myW = phone ? 56 : Math.round(76 * scale); + const dealerW = phone ? 56 : Math.round(66 * scale); useLayoutEffect(() => { const el = tableRef.current; if (!el) return undefined; @@ -715,7 +723,7 @@ export function BlackjackBoard({ view: v, me, players, act, pending, deadline }: return (
-
+
BLACKJACK diff --git a/apps/web/src/games/case-file/index.tsx b/apps/web/src/games/case-file/index.tsx index 2a01d90..0fa4fa6 100644 --- a/apps/web/src/games/case-file/index.tsx +++ b/apps/web/src/games/case-file/index.tsx @@ -69,6 +69,20 @@ const CSS = ` .cf-table { width: 100%; border-collapse: collapse; font-size: .95rem; } .cf-table td, .cf-table th { border-bottom: 1px solid var(--border); padding: 6px 4px; text-align: left; vertical-align: top; } .cf-memo { width: 100%; min-height: 220px; font: inherit; font-size: max(16px, 1rem); line-height: 1.6; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); } +.cf-main { display: flex; flex-direction: column; gap: 12px; } +/* PC: use the whole play column. Reading (briefing / last clue) sits in a left column of readable width, choices on the right. */ +@media (min-width: 1100px) { + .cf { max-width: none; } + .cf-main { flex-direction: row; align-items: flex-start; } + .cf-main > * { flex: 1 1 0; min-width: 0; } + .cf-main > .cf-read { flex-grow: 1.15; } + .cf-brief { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-content: start; align-items: start; } + .cf-brief > .cf-bar { grid-column: 1 / -1; } + .cf-brief > .cf-paper { grid-row: 2 / span 3; } + .cf-brief > :not(.cf-bar):not(.cf-paper) { grid-column: 2; } + .cf-memo { min-height: max(220px, calc(var(--play-h) - 260px)); } + .cf-doc { font-size: clamp(16px, calc(var(--play-h) * .0185), 20px); } +} `; // ---------------------------------------------------------------- device-only notes (§9) @@ -284,11 +298,16 @@ function LeadsTab({ v, players, act, titles }: { v: CaseFileView; players: Playe const meSeat = v.seats.find((s) => s.id === v.me); const here = v.seats.filter((s) => !s.left && s.idle === 0); return ( -
- {today && inv.hour === 9 && ( -
📰 {today.day}일째 아침 소식
+
+ {((today && inv.hour === 9) || last) && ( +
+ {today && inv.hour === 9 && ( +
📰 {today.day}일째 아침 소식
+ )} + {last && } +
)} - {last && } +
📍 지금 위치: {inv.placeName} ({inv.zoneName})
@@ -335,6 +354,7 @@ function LeadsTab({ v, players, act, titles }: { v: CaseFileView; players: Playe {inv.hints.length > 0 && (
💡 반장님 조언
    {inv.hints.map((h, i) =>
  1. {h}
  2. )}
)} +
); } @@ -550,7 +570,7 @@ function Board({ view: v, me, players, act, deadline }: BoardProps if (v.phase === 'briefing') { const ready = v.seats.filter((s) => s.ready).length; return ( -
+
diff --git a/apps/web/src/games/castles-of-burgundy/index.tsx b/apps/web/src/games/castles-of-burgundy/index.tsx index facb024..b92888d 100644 --- a/apps/web/src/games/castles-of-burgundy/index.tsx +++ b/apps/web/src/games/castles-of-burgundy/index.tsx @@ -1,5 +1,5 @@ /** 버건디의 성 화면 (docs/games/castles-of-burgundy.md §9). Everything is drawn from the view; art is own SVG. */ -import { useEffect, useMemo, useState, type ReactNode } from 'react'; +import { useEffect, useMemo, useState, type CSSProperties, type ReactNode } from 'react'; import type { CobAction, CobOptions, CobPlayerView, CobView, LogEntry, Pending } from '@bg/games/castles-of-burgundy'; import { ANIMAL_KO, @@ -102,6 +102,21 @@ button.cob-shield.on { background: var(--primary); color: #fff; border-color: va .cob-sticky { display: block; position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 2px solid var(--border); padding: 6px; margin: 0 -4px; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 12px rgba(0,0,0,.12); } .cob-depots { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +/* PC: fill the whole play column. Depots (2 x 3) and the duchy share it; tile / duchy sizes follow --play-w / --play-h. + --cob-n (tiles per depot) is set on .cob-root. */ +@media (min-width: 1100px) { + .cob-root { max-width: none; align-self: stretch; flex: 1 0 auto; --cob-col: calc((var(--play-w) - 10px) / 2); + --cob-hex: clamp(43px, min(calc(((var(--cob-col) - 36px) / 2 - 16px) / var(--cob-n, 4) - 2px), calc((var(--play-h) - 540px) / 4)), 170px); } + .cob-wide { flex: 1 0 auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; } + .cob-wide > .cob-pane > .cob-card { height: 100%; } + .cob-depots { grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 1 auto; grid-auto-rows: 1fr; } + .cob-slots { justify-content: center; align-items: center; flex: 1 1 auto; } + .cob-depots .cob-hexbtn svg { width: var(--cob-hex); height: auto; } + .cob-black .cob-hexbtn svg { width: min(calc(var(--cob-hex) * .7), calc((var(--cob-col) - 40px) / 9)); height: auto; } + .cob-wide .cob-duchy { flex: 1 1 0; min-height: 260px; } + .cob-root > .cob-card .cob-duchy { height: max(260px, calc(var(--play-h) - 330px)); } + .cob-bar .cob-diebtn svg { width: clamp(40px, calc(var(--play-h) * .05), 60px); height: auto; } +} `; let cssDone = false; @@ -801,7 +816,7 @@ function CobBoard({ view: v, me, players, act, pending: busy, tapConfirm }: Boar const depots = ; return ( -
+
{banner} {bannerBox} {!myPv && ( diff --git a/apps/web/src/games/catchmind/index.tsx b/apps/web/src/games/catchmind/index.tsx index 396dc70..6b2784d 100644 --- a/apps/web/src/games/catchmind/index.tsx +++ b/apps/web/src/games/catchmind/index.tsx @@ -90,7 +90,7 @@ const cmSound = { }; const CSS = ` -.cm { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 8px; align-self: center; } +.cm { width: 100%; display: flex; flex-direction: column; gap: 8px; align-self: stretch; } .cm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; font-weight: 700; } .cm-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .92rem; font-variant-numeric: tabular-nums; } .cm-hint { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 48px; } @@ -102,8 +102,9 @@ const CSS = ` .cm-bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; } .cm-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; transition: width .25s linear; } .cm-stage { display: flex; gap: 12px; align-items: flex-start; justify-content: center; } -.cm-paper { position: relative; width: min(100%, calc(100vh - 290px)); min-width: 280px; aspect-ratio: 1 / 1; border-radius: 14px; background: #fff; box-shadow: var(--shadow); - border: 3px solid var(--border); overflow: hidden; flex: 0 0 auto; } +/* Square paper: as tall as the play column allows after the pills, hint and time rows above it (PC). */ +.cm-paper { position: relative; width: min(100%, var(--play-h, 100vh) - 150px); min-width: 280px; aspect-ratio: 1 / 1; border-radius: 14px; background: #fff; box-shadow: var(--shadow); + border: 3px solid var(--border); overflow: hidden; flex: 0 1 auto; } .cm-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: auto; } .cm-paper[data-draw='true'] canvas { touch-action: none; cursor: crosshair; } .cm-over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; @@ -167,6 +168,12 @@ const CSS = ` .cm-away { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: var(--warning-soft); color: var(--text); border-radius: 12px; padding: 8px 12px; } @keyframes cm-pop { 0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; } 70% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); } } @keyframes cm-shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } } +/* PC: the guess chat in the side panel takes the height left under the scores. */ +@media (min-width: 1100px) { + .cm-side { flex: 1 1 auto; min-height: 0; } + .cm-side .cm-chat { flex: 1 1 auto; min-height: 260px; } + .cm-side .cm-chat-list { flex: 1 1 auto; max-height: none; } +} @media (max-width: 1099px) { .cm-stage { flex-direction: column; align-items: stretch; } .cm-paper { width: 100%; min-width: 0; } diff --git a/apps/web/src/games/chess/index.tsx b/apps/web/src/games/chess/index.tsx index 8caa752..5904e76 100644 --- a/apps/web/src/games/chess/index.tsx +++ b/apps/web/src/games/chess/index.tsx @@ -86,6 +86,8 @@ const CHESS_CSS = ` @keyframes ch-fade { from { opacity: 0; } } :root[data-theme='dark'] .ch-icon-dark { filter: drop-shadow(0 0 .6px #e5e7eb) drop-shadow(0 0 .6px #e5e7eb); } @media (prefers-color-scheme: dark) { :root[data-theme='auto'] .ch-icon-dark { filter: drop-shadow(0 0 .6px #e5e7eb) drop-shadow(0 0 .6px #e5e7eb); } } +/* PC: the board takes the whole play-area height minus the row(s) that can show under it (--ch-rows). */ +@media (min-width: 1100px) { .board-wrap.ch-fit { max-width: min(100%, calc(var(--play-h) - var(--ch-rows, 0px))); } } `; function ChessBoard({ view: v, act, pending }: BoardProps) { @@ -229,7 +231,11 @@ function ChessBoard({ view: v, act, pending }: BoardProps) { const cursorSq = squareAt(cursor.x, cursor.y, bottom); return ( -
+
.cl-panel { grid-area: act; } + .cl-board > section.cl-sec { grid-area: cards; } + .cl-board > details.cl-sec { grid-area: note; } + .cl-note li { min-height: clamp(34px, calc((var(--play-h) - 400px) / 11), 48px); } +} /* Tokens / weapons on the map are lifted above the rooms while they slide (see slideFrom). */ .cl-map [data-tok], .cl-map [data-weap] { position: relative; } .fx-ghost.cl-ghost { display: flex; align-items: center; justify-content: center; border-radius: 8px; background: linear-gradient(160deg, #fffaf0, #f1e6cf); diff --git a/apps/web/src/games/cockroach-poker/index.tsx b/apps/web/src/games/cockroach-poker/index.tsx index 2daa4a9..a80e88c 100644 --- a/apps/web/src/games/cockroach-poker/index.tsx +++ b/apps/web/src/games/cockroach-poker/index.tsx @@ -211,7 +211,7 @@ function BackCard({ size = 'md', fx }: { size?: 'sm' | 'md' | 'lg'; fx?: string // ---------------------------------------------------------------- styles const CSS = ` -.cp-board { width: 100%; max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 370px); gap: 12px; align-items: start; padding: 2px; } +.cp-board { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 370px); gap: 12px; align-items: start; padding: 2px; } .cp-felt { position: relative; border-radius: 26px; border: 8px solid var(--wood); box-shadow: var(--shadow); color: #fff; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 540px; background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.14), rgba(255,255,255,0) 60%), var(--felt); } .cp-actions { display: flex; flex-direction: column; gap: 10px; min-width: 0; } @@ -347,6 +347,16 @@ ${KINDS.map((k) => `.fx-ghost.cp-face-${k} { background: ${KIND_COLOR[k].bg}; co .cp-say button:disabled { opacity: .45; cursor: not-allowed; } .cp-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; } .cp-log li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } +/* PC: the felt fills the play column's height and its cards grow with it. */ +@media (min-width: 1100px) { + .cp-board { flex: 1 1 auto; min-height: 0; align-items: stretch; grid-template-columns: minmax(0, 1fr) clamp(320px, 26%, 400px); } + .cp-felt .cp-card.lg { --w: clamp(92px, calc(var(--play-h) * .13), 180px); } + .cp-myhand .cp-card { --w: clamp(60px, min(calc(var(--play-h) * .085), calc(var(--play-w) * .06)), 120px); } + .cp-chip .cp-mini { --w: clamp(30px, calc(var(--play-h) * .04), 52px); } + .cp-seat { flex-basis: 140px; max-width: 340px; } + .cp-center { min-height: 0; } + .cp-speech { font-size: clamp(1.15rem, calc(var(--play-h) * .022), 1.5rem); max-width: 240px; } +} @media (max-width: 899px) { .cp-board { grid-template-columns: minmax(0, 1fr); } .cp-felt { min-height: 0; } diff --git a/apps/web/src/games/connect-four/index.tsx b/apps/web/src/games/connect-four/index.tsx index e835a15..7a9b9c3 100644 --- a/apps/web/src/games/connect-four/index.tsx +++ b/apps/web/src/games/connect-four/index.tsx @@ -33,6 +33,9 @@ const CSS = ` :root[data-theme='dark'] .c4-svg { --c4-frame: #1e40af; --c4-frame-edge: #172554; } @media (prefers-color-scheme: dark) { :root[data-theme='auto'] .c4-svg { --c4-frame: #1e40af; --c4-frame-edge: #172554; } } @media (prefers-reduced-motion: reduce) { .c4-drop, .c4-win { animation: none; } } +.board-wrap.c4-fit { max-width: min(100%, calc((100vh - var(--site-h, 56px) - 180px) * var(--c4-ar))); } +/* PC: the board takes the whole play-area height minus the row that can show under it (--c4-rows). */ +@media (min-width: 1100px) { .board-wrap.c4-fit { max-width: min(100%, calc((var(--play-h) - var(--c4-rows, 0px)) * var(--c4-ar))); } } `; function Disc({ color, cx, cy, r, ghost }: { color: Color; cx: number; cy: number; r: number; ghost?: boolean }) { @@ -134,7 +137,11 @@ function C4Board({ view: v, act, pending, tapConfirm }: BoardProps i); return ( -
+
* { flex: none; } .dv-opps { display: grid; gap: 10px; } .dv-player { background: var(--surface); border-radius: var(--radius-lg); padding: 10px 12px; box-shadow: var(--shadow); border: 3px solid transparent; } .dv-player.turn { border-color: var(--focus); } @@ -116,11 +120,11 @@ const CSS = ` .dv-badge.turn { background: var(--focus); color: #1c1e21; } .dv-badge.out { background: var(--danger-soft); color: var(--danger); } .dv-badge.ok { background: var(--success-soft); color: var(--success); } -.dv-row { --lift: 34px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding-top: calc(8px + var(--lift)); } -.dv-me .dv-row { --lift: 40px; } +.dv-row { --lift: calc(var(--tw, 46px) * .74); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: flex-end; padding-top: calc(8px + var(--lift)); } +.dv-me .dv-row { --lift: calc(var(--tw, 46px) * .87); } .dv-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; } .dv-pos { font-size: .75rem; color: var(--text-sub); font-variant-numeric: tabular-nums; line-height: 1; } -.dv-tile { --w: 46px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: 8px; display: flex; align-items: center; justify-content: center; +.dv-tile { --w: var(--tw, 46px); width: var(--w); height: calc(var(--w) * 1.42); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: calc(var(--w) * .56); line-height: 1; position: relative; user-select: none; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 rgba(0,0,0,.35); transition: transform .15s ease; } .dv-tile.black { background: linear-gradient(160deg, #42454d, #141519); color: #fff; border: 2px solid color-mix(in srgb, var(--text) 30%, #050505); } @@ -131,8 +135,8 @@ const CSS = ` .dv-slot.open > .dv-pick { position: relative; top: calc(-1 * var(--lift)); } .dv-slot.open > .dv-pick::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -7px; height: 5px; border-radius: 3px; background: #f59e0b; } .dv-tile.secret { outline: 3px dashed var(--primary); outline-offset: 2px; } -.dv-tile.sm { --w: 30px; } -.dv-tile.lg { --w: 54px; } +.dv-tile.sm { --w: calc(var(--tw, 46px) * .65); } +.dv-tile.lg { --w: calc(var(--tw, 46px) * 1.17); } .dv-tile.hit { animation: dv-flip .5s ease-out both, dv-hit 1.2s ease-out both; } .dv-tile.miss { animation: dv-flip .5s ease-out both, dv-miss 1.2s ease-out both; animation-delay: var(--anim-delay, 0ms); } .dv-tile.new { animation: dv-drop .38s ease-out both; animation-delay: var(--anim-delay, 0ms); } @@ -153,7 +157,7 @@ const CSS = ` .dv-gap { align-self: stretch; min-width: 28px; min-height: 48px; border: 2px dashed var(--primary); background: var(--primary-soft); color: var(--text); border-radius: 8px; font-weight: 800; cursor: pointer; padding: 0 2px; font-size: .8rem; } .dv-gap:focus-visible { outline: 3px solid var(--focus); } -.dv-mid { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 12px; align-items: start; } +.dv-mid { display: grid; grid-template-columns: minmax(0, clamp(260px, 24%, 360px)) minmax(0, 1fr); gap: 12px; align-items: start; } .dv-center { background: var(--felt); color: #fff; border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; } .dv-piles { display: flex; gap: 12px; justify-content: center; } .dv-pile { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(0,0,0,.18); border: 2px solid transparent; border-radius: 12px; @@ -161,7 +165,7 @@ const CSS = ` .dv-pile:disabled { cursor: default; opacity: .8; } .dv-pile.can { border-color: #fde047; background: rgba(253,224,71,.15); } .dv-pile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } -.dv-stack { position: relative; width: 44px; height: 50px; } +.dv-stack { position: relative; width: calc(var(--tw, 46px) * .96); height: calc(var(--tw, 46px) * 1.09); } .dv-stack .dv-tile { position: absolute; left: 0; } .dv-pending { display: flex; align-items: center; gap: 10px; font-size: .9rem; } .dv-panel { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; } @@ -365,7 +369,7 @@ function DavinciBoard({ view: v, me, players, act, pending, deadline }: BoardPro }; return ( -
+
{opponentsOf(v, me).map((p) => ( diff --git a/apps/web/src/games/dobble/index.tsx b/apps/web/src/games/dobble/index.tsx index bc505bf..1628b3c 100644 --- a/apps/web/src/games/dobble/index.tsx +++ b/apps/web/src/games/dobble/index.tsx @@ -39,7 +39,9 @@ const dbSound = { }; const CSS = ` -.db { width: 100%; max-width: 1060px; display: flex; flex-direction: column; gap: 10px; align-self: center; --cd: min(440px, 50vh, calc(50% - 14px)); } +/* Fills the play column: the two cards are as big as the column allows (width split in two, height minus the rows around the table). */ +.db { width: 100%; display: flex; flex-direction: column; gap: 10px; align-self: stretch; flex: 1 1 auto; min-height: 0; + --cd: clamp(200px, min(calc((var(--play-w) - 76px) / 2), calc(var(--play-h) - 250px)), 960px); } .db-top { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: space-between; font-weight: 700; } .db-top .grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .db-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; } @@ -58,7 +60,7 @@ button.db-seat { cursor: pointer; } .db-tag { border-radius: 999px; padding: 0 6px; font-size: .72rem; font-weight: 800; line-height: 1.6; white-space: nowrap; color: #fff; background: #6b7280; } .db-tag.ok { background: #15803d; } .db-tag.warn { background: #f59e0b; color: #111827; } -.db-table { position: relative; display: flex; gap: 24px; justify-content: center; align-items: flex-start; padding: 14px; border-radius: 26px; background: radial-gradient(ellipse at center, rgba(255,255,255,.12), rgba(255,255,255,0) 65%), var(--felt); border: 6px solid var(--wood); box-shadow: var(--shadow); touch-action: manipulation; } +.db-table { position: relative; flex: 1 1 auto; display: flex; gap: 24px; justify-content: center; align-items: center; padding: 14px; border-radius: 26px; background: radial-gradient(ellipse at center, rgba(255,255,255,.12), rgba(255,255,255,0) 65%), var(--felt); border: 6px solid var(--wood); box-shadow: var(--shadow); touch-action: manipulation; } .db-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: var(--cd); } .db-slot .cap { color: #fff; font-weight: 800; font-size: .95rem; text-shadow: 0 1px 2px rgba(0,0,0,.4); display: flex; gap: 6px; align-items: center; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; } .db-card { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; background: #fffdf6; border: 4px solid #d6c7a1; box-shadow: 0 6px 0 rgba(0,0,0,.18), 0 10px 22px rgba(0,0,0,.28); } diff --git a/apps/web/src/games/gemblo/index.tsx b/apps/web/src/games/gemblo/index.tsx index b1132e0..516ae49 100644 --- a/apps/web/src/games/gemblo/index.tsx +++ b/apps/web/src/games/gemblo/index.tsx @@ -148,6 +148,9 @@ const CSS = ` .gm-chip.done { opacity: .55; } .gm-left { display: flex; flex-wrap: wrap; gap: 2px; } @media (prefers-reduced-motion: reduce) { .gm-link { animation: none; } } +.gm-root.gm-side { flex-direction: row; align-items: center; justify-content: center; gap: 20px; } +.gm-side > .gm-rows { flex: 0 1 380px; min-width: 0; } +.gm-rows:empty { display: none; } `; // ---------------------------------------------------------------- board layers @@ -226,6 +229,22 @@ function GembloBoard({ view: v, me, players, act, pending }: BoardProps ro.disconnect(); }, []); const narrow = width < 600; + // PC play-area size (.game-main, px), null under 1100px where the page scrolls and the rows stay under the board. + const [main, setMain] = useState<{ w: number; h: number } | null>(null); + useLayoutEffect(() => { + const el = wrapRef.current?.closest('.game-main'); + if (!el) return; + const wide = matchMedia('(min-width: 1100px)'); + const update = () => setMain(wide.matches ? { w: el.clientWidth, h: el.clientHeight } : null); + update(); + const ro = new ResizeObserver(update); + ro.observe(el); + wide.addEventListener('change', update); + return () => { + ro.disconnect(); + wide.removeEventListener('change', update); + }; + }, []); const turnColor = v.colors[v.turn]!; const myTurn = v.phase === 'playing' && v.turnPlayer === me && v.legal !== null; @@ -661,138 +680,151 @@ function GembloBoard({ view: v, me, players, act, pending }: BoardProps stackW; return ( -
+
-
-
- {strip} +
+
+
+ {strip} +
+
- -
-
- { - pointers.current.delete(e.pointerId); - gesture.current = { kind: 'none' }; - }} - onPointerLeave={(e) => e.pointerType === 'mouse' && setHover(null)} - > - - {placing === 'color' && - v.showHints && - links.map((c) => ( - - ))} - {preview && ( - - {preview.cells.map((c) => ( - +
+ { + pointers.current.delete(e.pointerId); + gesture.current = { kind: 'none' }; + }} + onPointerLeave={(e) => e.pointerType === 'mouse' && setHover(null)} + > + + {placing === 'color' && + v.showHints && + links.map((c) => ( + ))} - {preview.links.map(([a, b], i) => { - const [x1, y1] = CELL_XY[a]!; - const [x2, y2] = CELL_XY[b]!; - return ; - })} - {preview.crosses.map(([m1, m2], i) => { - const x = (CELL_XY[m1]![0] + CELL_XY[m2]![0]) / 2; - const y = (CELL_XY[m1]![1] + CELL_XY[m2]![1]) / 2; - return ; - })} - - )} - {kbd && placing && } - + {preview && ( + + {preview.cells.map((c) => ( + + ))} + {preview.links.map(([a, b], i) => { + const [x1, y1] = CELL_XY[a]!; + const [x2, y2] = CELL_XY[b]!; + return ; + })} + {preview.crosses.map(([m1, m2], i) => { + const x = (CELL_XY[m1]![0] + CELL_XY[m2]![0]) / 2; + const y = (CELL_XY[m1]![1] + CELL_XY[m2]![1]) / 2; + return ; + })} + + )} + {kbd && placing && } + +

{announce}

- {(placing || myPick) && ( -

- {hintText} -

- )} - {trayIds.length > 0 && v.phase !== 'finished' && (placing || myPick || trayColor) && ( -
- {trayIds.map((id) => { - const used = placing === 'color' ? !hand.includes(id) : !placing && !myPick && trayColor ? !trayColor.left.includes(id) : false; - const locked = placing === 'color' && !used && !placeable.has(id); - const can = myPick ? !pending : !!placing && !used; - return ( - - ); - })} -
- )} - {placing && ( -
- - - - - -
- )} - {v.phase === 'finished' && } +
+ {(placing || myPick) && ( +

+ {hintText} +

+ )} + {trayIds.length > 0 && v.phase !== 'finished' && (placing || myPick || trayColor) && ( +
+ {trayIds.map((id) => { + const used = placing === 'color' ? !hand.includes(id) : !placing && !myPick && trayColor ? !trayColor.left.includes(id) : false; + const locked = placing === 'color' && !used && !placeable.has(id); + const can = myPick ? !pending : !!placing && !used; + return ( + + ); + })} +
+ )} + {placing && ( +
+ + + + + +
+ )} + {v.phase === 'finished' && } +
); } diff --git a/apps/web/src/games/gostop/index.tsx b/apps/web/src/games/gostop/index.tsx index 58687d4..22aac0c 100644 --- a/apps/web/src/games/gostop/index.tsx +++ b/apps/web/src/games/gostop/index.tsx @@ -1,5 +1,5 @@ /** 고스톱 / 맞고 화면 (docs/games/gostop.md §9). Points are room-only play points. */ -import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'; +import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'; import type { BakKind, CardView, GostopOptions, GostopView, HandCardView, OutcomeView, SeatView, TurnTag } from '@bg/games/gostop'; import type { PublicUser } from '@bg/shared/lite'; import { Avatar, Sheet } from '../../components/ui'; @@ -49,6 +49,15 @@ function useNarrow(): boolean { return narrow; } +/** Card size factor for the board (PC: grows with the play area, see GostopBoard). */ +const CardScale = createContext(1); +const HW = { sm: 40, md: 60, lg: 84 } as const; +/** Card width in px for a HwatuCard size, scaled for the play area. */ +function useCardW(): (size: keyof typeof HW) => number { + const k = useContext(CardScale); + return (size) => Math.round(HW[size] * k); +} + function totalMsOf(v: GostopView): number { if (v.phase === 'roundResult') return 10_000; const who = v.step === 'sell' ? v.sell?.current : v.turn; @@ -93,7 +102,7 @@ function statusText(v: GostopView, me: string | null, players: Record * + * { margin-left: var(--ov, -30px); } +.gs-pile-cards > * + * { margin-left: calc(var(--ov, -30px) * var(--gk, 1)); } .gs-cap[aria-expanded='true'] .gs-pile-cards > * + * { --ov: -14px; } .gs-table { border-radius: 20px; border: 8px solid var(--wood); box-shadow: var(--shadow); color: #fff; padding: 10px; background: radial-gradient(ellipse at center, rgba(255,255,255,.12), rgba(255,255,255,0) 65%), var(--felt); - display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 10px; align-items: stretch; } + display: grid; grid-template-columns: minmax(0, 1fr) calc(210px * var(--gk, 1)); gap: 10px; align-items: stretch; } .gs-floor { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; list-style: none; margin: 0; padding: 0; } -.gs-slot { min-height: 104px; border-radius: 10px; border: 2px dashed rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; position: relative; } +.gs-slot { min-height: calc(104px * var(--gk, 1)); border-radius: 10px; border: 2px dashed rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; position: relative; } .gs-slot .m { position: absolute; top: 1px; left: 6px; font-size: .72rem; font-weight: 700; color: rgba(255,255,255,.55); } .gs-slot.has { border-style: solid; border-color: rgba(255,255,255,.28); } .gs-slot.ppeok { border: 3px solid #f87171; background: rgba(239,68,68,.18); } .gs-slot.ppeok::after { content: '뻑'; position: absolute; right: 4px; top: 2px; font-size: .75rem; font-weight: 900; color: #fecaca; } .gs-slot.natural::after { content: '3장'; } .gs-slot-cards { display: flex; } -.gs-slot-cards > * + * { margin-left: var(--sov, -40px); } +.gs-slot-cards > * + * { margin-left: var(--sov, calc(-40px * var(--gk, 1))); } .gs-glow { animation: gs-blink .9s ease-in-out infinite; border-radius: 8px; } @keyframes gs-blink { 0%, 100% { filter: drop-shadow(0 0 2px #fde047); } 50% { filter: drop-shadow(0 0 10px #fde047) brightness(1.08); } } .gs-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; } @@ -166,6 +175,11 @@ const CSS = ` .gs-res td { padding: 3px 4px; border-bottom: 1px solid var(--border); } .gs-res td.n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; } .gs-notice { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin: 0; } +/* PC: fill the play column; the floor takes the height the seats leave (cards grow with the area, see GostopBoard). */ +@media (min-width: 1100px) { + .gs { align-self: stretch; flex: 1 1 auto; min-height: 0; margin: 0; } + .gs-table { flex: 1 1 auto; } +} @media (max-width: 719px) { .gs-opps { grid-template-columns: 1fr; } .gs-table { grid-template-columns: 1fr; border-width: 5px; padding: 8px; } @@ -182,18 +196,20 @@ const CSS = ` function Card({ c, size = 'sm', className, style }: { c: CardView | null; size?: 'sm' | 'md' | 'lg'; className?: string; style?: React.CSSProperties }) { const card = c as HwatuInfo | null; + const cw = useCardW(); return className ? ( - + ) : ( - + ); } function CapturedRow({ seat, label }: { seat: SeatView; label: string }) { const [open, setOpen] = useState(false); const groups = (['gwang', 'yeol', 'tti', 'pi'] as const).filter((k) => seat.captured[k].length > 0); + const cw = useCardW(); if (groups.length === 0) return ( @@ -210,7 +226,7 @@ function CapturedRow({ seat, label }: { seat: SeatView; label: string }) { {seat.captured[k].map((c) => ( - + ))} @@ -310,9 +326,28 @@ function SeatBox({ seat, v, players, me, deadline }: { seat: SeatView; v: Gostop function Floor({ v, glow, narrow, players }: { v: GostopView; glow: Set; narrow: boolean; players: Record }) { const months = Array.from({ length: 12 }, (_, i) => i + 1); const pf = v.pendingFlip; + const cw = useCardW(); + // PC: floor cards fill their month slot (3 overlapping cards across, one card high), never smaller than the base size. + const floorRef = useRef(null); + const [fit, setFit] = useState(0); + useLayoutEffect(() => { + const el = floorRef.current; + if (!el) return undefined; + const measure = () => { + if (window.innerWidth < 1100) return setFit(0); + const slotW = (el.clientWidth - 5 * 6) / 6; + const slotH = (el.clientHeight - 6) / 2; + setFit(Math.floor(Math.min(150, (slotW - 10) / 1.66, (slotH - 24) / 1.63))); + }; + const ro = new ResizeObserver(measure); + ro.observe(el); + measure(); + return () => ro.disconnect(); + }, []); + const fw = narrow ? 40 : Math.max(cw('md'), fit); return (
-
    +
      {months.map((m) => { const g = v.floor.find((x) => x.month === m); const cls = `gs-slot${g ? ' has' : ''}${g && g.cards.length === 3 ? (g.natural ? ' ppeok natural' : ' ppeok') : ''}`; @@ -328,7 +363,7 @@ function Floor({ v, glow, narrow, players }: { v: GostopView; glow: Set; {g.cards.map((c) => ( - + ))} @@ -340,7 +375,7 @@ function Floor({ v, glow, narrow, players }: { v: GostopView; glow: Set;
      - + {v.deckCount}장
      @@ -358,7 +393,7 @@ function Floor({ v, glow, narrow, players }: { v: GostopView; glow: Set;
      뒤집은 패
      - +
      )} @@ -426,6 +461,7 @@ function MyHand({ v, act, pending, tapConfirm, onFocusCard }: { v: GostopView; a const [ask, setAsk] = useState(null); const canPlay = v.step === 'play' && v.turn === v.me && !pending; const hints = v.rules.hints; + const cw = useCardW(); useEffect(() => { setLifted(null); setAsk(null); @@ -476,7 +512,7 @@ function MyHand({ v, act, pending, tapConfirm, onFocusCard }: { v: GostopView; a onFocus={() => onFocusCard(h)} onBlur={() => onFocusCard(null)} > - + {tag && {tag}} ); @@ -1115,6 +1151,23 @@ function useGostopFx(v: GostopView, me: string | null, players: Record) { const { view: v, me, players } = props; const narrow = useNarrow(); + // PC: cards grow with the play area (1 at the old 1100 px column, up to 1.7×; the height check keeps it on screen). + const rootRef = useRef(null); + const [k, setK] = useState(1); + useLayoutEffect(() => { + const el = rootRef.current; + if (!el) return undefined; + const wide = matchMedia('(min-width: 1100px)'); + const measure = () => setK(wide.matches ? Math.min(1.7, Math.max(1, Math.min(el.clientWidth / 1100, el.clientHeight / 640))) : 1); + const ro = new ResizeObserver(measure); + ro.observe(el); + wide.addEventListener('change', measure); + measure(); + return () => { + ro.disconnect(); + wide.removeEventListener('change', measure); + }; + }, []); const [focus, setFocus] = useState(null); const [announce, setAnnounce] = useState(''); const mine = isMyTurn(v, me); @@ -1149,22 +1202,24 @@ function GostopBoard(props: BoardProps) { const glow = new Set(v.rules.hints && focus ? focus.matches : []); if (v.pendingFlip) for (const c of v.pendingFlip.options) glow.add(c.id); return ( -
      - -
        - {others.map((s) => ( - - ))} -
      - - - - - {banner} -

      - {announce} -

      -
      + +
      + +
        + {others.map((s) => ( + + ))} +
      + + + + + {banner} +

      + {announce} +

      +
      +
      ); } diff --git a/apps/web/src/games/halli-galli/index.tsx b/apps/web/src/games/halli-galli/index.tsx index cdb667f..18064d2 100644 --- a/apps/web/src/games/halli-galli/index.tsx +++ b/apps/web/src/games/halli-galli/index.tsx @@ -10,6 +10,7 @@ import type { BoardProps, GameUI, OptionsProps } from '../types'; import { helpNow } from './help'; import { quickStart } from './quick'; import { fxMs } from '../../lib/motion'; +import { useWide } from '../../lib/media'; const FRUITS: Fruit[] = ['strawberry', 'banana', 'lime', 'plum']; const FRUIT_KO: Record = { strawberry: '딸기', banana: '바나나', lime: '라임', plum: '자두' }; @@ -36,7 +37,8 @@ const hgSound = { }; const CSS = ` -.hg { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 10px; align-self: center; } +/* Fills the play column; on PC the table takes all the height the top row and my deck row leave. */ +.hg { width: 100%; display: flex; flex-direction: column; gap: 10px; align-self: stretch; flex: 1 1 auto; min-height: 0; } .hg-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; font-weight: 700; } .hg-top .grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .hg-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .92rem; font-variant-numeric: tabular-nums; } @@ -144,6 +146,12 @@ const CSS = ` @keyframes hg-pop { 0% { transform: translateX(-50%) scale(.6); opacity: 0; } 70% { transform: translateX(-50%) scale(1.06); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } } @keyframes hg-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } } @keyframes hg-fly { from { left: var(--fx); top: var(--fy); opacity: 1; } 85% { opacity: .9; } to { left: var(--tx); top: var(--ty); opacity: 0; transform: translate(-50%, -50%) scale(.6); } } +@media (min-width: 720px) { + .hg-table { flex: 1 1 auto; height: auto; min-height: clamp(440px, 64vh, 600px); } +} +@media (min-width: 1100px) { + .hg-table { min-height: 440px; } +} @media (max-width: 719px) { .hg-table { height: 450px; border-width: 6px; border-radius: 22px; } .hg-seat { padding: 3px 3px 4px; gap: 2px; } @@ -331,7 +339,7 @@ const CENTER: Pos = { left: '50%', top: '50%' }; * "half the table minus half a seat", so seats always stay inside the felt whatever its size. * `tall` (narrow phone table): seats that are not level with the bell move further up/down so they clear it. */ -function seatPositions(n: number, seat: { w: number; h: number }, maxRx: number, tall: boolean): Pos[] { +function seatPositions(n: number, seat: { w: string; h: string }, maxRx: string, tall: boolean): Pos[] { const f = (x: number) => (Math.abs(x) < 1e-9 ? 0 : Number(x.toFixed(4))); return Array.from({ length: n }, (_, k) => { const t = (2 * Math.PI * k) / n; @@ -339,8 +347,8 @@ function seatPositions(n: number, seat: { w: number; h: number }, maxRx: number, const y = tall && c !== 0 ? Math.sign(c) * Math.max(Math.abs(c), 0.75) : c; const sn = f(Math.sin(t)); return { - left: `calc(50% - ${sn} * min(50% - ${seat.w / 2 + 6}px, ${maxRx}px))`, - top: `calc(50% + ${y} * (50% - ${seat.h / 2 + 6}px))`, + left: `calc(50% - ${sn} * min(50% - ${seat.w} / 2 - 6px, ${maxRx}))`, + top: `calc(50% + ${y} * (50% - ${seat.h} / 2 - 6px))`, side: sn > 0.2 ? 'left' : sn < -0.2 ? 'right' : 'mid', dir: [-sn, y], }; @@ -546,6 +554,7 @@ function bellText(v: HalliGalliView, players: Record): Bubbl function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps) { const now = useServerNow(100); const phone = usePhone(); + const wide = useWide(); const rtt = useRoom((s) => s.rttMs); const [bubble, setBubble] = useState(null); const [ghosts, setGhosts] = useState([]); @@ -563,9 +572,16 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps s.id === me); const rot = myIdx < 0 ? v.seats : [...v.seats.slice(myIdx), ...v.seats.slice(0, myIdx)]; const many = rot.length >= 5; - const cw = phone ? (many ? 40 : 50) : many ? 64 : 80; - const sw = Math.round(cw * 1.72 + 6 + 12); - const pos = seatPositions(rot.length, { w: sw, h: cw * 1.4 + (phone ? 50 : 58) + 8 }, phone ? 400 : 400, phone); + // Card width: fixed on phones/tablets; on PC it grows with the play area (CSS length, so seats and fly-ins follow live resizes). + const cwPx = phone ? (many ? 40 : 50) : many ? 64 : 80; + const cw = !wide + ? `${cwPx}px` + : many + ? 'clamp(64px, min(var(--play-w) * .056, var(--play-h) * .088), 128px)' + : 'clamp(80px, min(var(--play-w) * .07, var(--play-h) * .11), 160px)'; + const sw = wide ? 'calc(var(--cw) * 1.72 + 18px)' : `${Math.round(cwPx * 1.72 + 18)}px`; + const seatH = wide ? 'calc(var(--cw) * 1.4 + 66px)' : `${cwPx * 1.4 + (phone ? 50 : 58) + 8}px`; + const pos = seatPositions(rot.length, { w: sw, h: seatH }, wide ? 'max(400px, var(--bell) * 2.4)' : '400px', phone); const posOf = (id: string) => pos[rot.findIndex((s) => s.id === id)] ?? CENTER; const mine = v.seats.find((s) => s.id === me) ?? null; const playing = v.phase === 'playing'; @@ -709,7 +725,14 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps clearTimeout(t); }, [bubble]); - const bellSize = phone ? (rot.length >= 5 ? 128 : 'min(40vw, 156px)') : 'clamp(140px, 20vh, 190px)'; + // PC: the bell (and its dashed ring, 1.55x) grows too, but stays clear of the top and bottom seats (table ≈ play height - 130px). + const bellSize = phone + ? rot.length >= 5 + ? 128 + : 'min(40vw, 156px)' + : wide + ? 'clamp(140px, min(var(--play-h) * .26, var(--play-w) * .2, (var(--play-h) - 142px - 2 * (var(--cw) * 1.4 + 66px)) / 1.55), 320px)' + : 'clamp(140px, 20vh, 190px)'; const countdown = v.phase === 'countdown' ? Math.max(0, Math.ceil((v.countdownEndsAt - now) / 1000)) : 0; const totals = FRUITS.map((f) => ({ f, n: v.seats.reduce((a, s) => a + (s.top && s.top.fruit === f ? s.top.count : 0), 0) })); const timeLeft = v.endsAt !== null ? Math.max(0, v.endsAt - Math.max(now, v.countdownEndsAt)) : null; @@ -755,7 +778,7 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps
        {rot.map((s, i) => ( diff --git a/apps/web/src/games/hot-streak/index.tsx b/apps/web/src/games/hot-streak/index.tsx index 42d3bb0..d4632b3 100644 --- a/apps/web/src/games/hot-streak/index.tsx +++ b/apps/web/src/games/hot-streak/index.tsx @@ -133,6 +133,12 @@ const CSS = ` .hs-seg-row { display: flex; gap: 6px; flex-wrap: wrap; } .hs-seg-row .btn { flex: 1 1 0; min-width: 64px; } .hs-seg-row .btn[aria-pressed='true'] { outline: 3px solid var(--primary); outline-offset: 1px; } +/* PC: use the whole play column width. The track grows with it but stays short enough that head, panel, track and + deck list (~620px) still fit the column height. */ +@media (min-width: 1100px) { + .hs-wrap { max-width: none; } + .hs-box { max-width: min(100%, calc((var(--play-h) - 620px) * ${(WIDE.w / WIDE.h).toFixed(3)})); margin: 0 auto; } +} @media (max-width: 899px) { .hs-stacks { grid-template-columns: repeat(3, minmax(0, 1fr)); } } diff --git a/apps/web/src/games/janggi/index.tsx b/apps/web/src/games/janggi/index.tsx index 1398487..728014e 100644 --- a/apps/web/src/games/janggi/index.tsx +++ b/apps/web/src/games/janggi/index.tsx @@ -1,5 +1,5 @@ /** 장기 화면 (docs/games/janggi.md §9). */ -import { useEffect, useMemo, useRef, useState } from 'react'; +import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; import type { Arrangement, JanggiMove, JanggiOptions, JanggiView, Piece, PieceKind, Side, Sq } from '@bg/games/janggi'; import type { PublicUser } from '@bg/shared/lite'; import { Avatar, ConfirmSheet, Sheet } from '../../components/ui'; @@ -168,14 +168,38 @@ const JANGGI_CSS = ` @keyframes jg-check { 0% { opacity: 0; transform: scale(.5); } 30% { opacity: 1; transform: scale(1.22); } 55% { transform: scale(.95); } 78% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } } .jg-fade { animation: jg-fade .3s ease-out both; } @keyframes jg-fade { from { opacity: 0; } } +.board-wrap.jg-side { flex-direction: row; align-items: center; justify-content: center; gap: 20px; } +.jg-side > .jg-rows { flex: 0 1 320px; min-width: 0; } `; +/** PC play-area size (.game-main, px), null under 1100px where the page scrolls and rows stay under the board. */ +function useWideMain(ref: React.RefObject) { + const [size, setSize] = useState<{ w: number; h: number } | null>(null); + useLayoutEffect(() => { + const main = ref.current?.closest('.game-main'); + if (!main) return; + const wide = matchMedia('(min-width: 1100px)'); + const update = () => setSize(wide.matches ? { w: main.clientWidth, h: main.clientHeight } : null); + update(); + const ro = new ResizeObserver(update); + ro.observe(main); + wide.addEventListener('change', update); + return () => { + ro.disconnect(); + wide.removeEventListener('change', update); + }; + }, [ref]); + return size; +} + function JanggiBoard({ view: v, act, pending, tapConfirm }: BoardProps) { const flip = v.mySide === 'han'; const toScreen = (q: Sq) => (flip ? { x: 8 - q.f, y: q.r } : { x: q.f, y: 9 - q.r }); const fromScreen = (x: number, y: number): Sq => (flip ? { f: 8 - x, r: y } : { f: x, r: 9 - y }); const myTurn = v.phase === 'playing' && v.mySide === v.turn; const [hangul, setHangul] = useHangulLabels(); + const wrapRef = useRef(null); + const main = useWideMain(wrapRef); const [selected, setSelected] = useState(null); const [hover, setHover] = useState(null); const [preview, setPreview] = useState(null); @@ -341,11 +365,22 @@ function JanggiBoard({ view: v, act, pending, tapConfirm }: BoardProps stackW; return ( -
        +
        -
        +
        {announce}

        - {v.phase === 'playing' && v.inCheck && ( -
        - {v.inCheck === v.mySide ? '장군이에요! 궁을 지켜야 해요.' : `${SIDE_KO[v.inCheck]} 장군!`} -
        - )} - {v.phase === 'playing' && v.bikjang && ( -
        - {v.bikjang.calledBy === v.mySide - ? '빅장을 불렀어요. 상대가 막지 못하면 점수로 판정해요.' - : v.mySide - ? '빅장이에요! 궁 사이를 막거나 궁을 옆으로 옮기지 않으면 점수로 판정해요.' - : `${SIDE_KO[v.bikjang.calledBy]} 빅장!`} -
        - )} - {myTurn && v.repeatWarning && ( -
        - {v.rules.repetition === 'forbid' - ? '같은 국면이 3번 나왔어요. 한 번 더 반복하는 수는 둘 수 없어요.' - : v.rules.repetition === 'lose' - ? '같은 국면이 3번 나왔어요. 한 번 더 반복하면 실격패예요!' - : '같은 국면이 3번 나왔어요. 한 번 더 반복하면 점수로 판정해요.'} -
        - )} - {preview !== null && selected !== null && myTurn && ( -
        - - -
        - )} - {v.phase === 'setup' && ( - - )} - +
        + {v.phase === 'playing' && v.inCheck && ( +
        + {v.inCheck === v.mySide ? '장군이에요! 궁을 지켜야 해요.' : `${SIDE_KO[v.inCheck]} 장군!`} +
        + )} + {v.phase === 'playing' && v.bikjang && ( +
        + {v.bikjang.calledBy === v.mySide + ? '빅장을 불렀어요. 상대가 막지 못하면 점수로 판정해요.' + : v.mySide + ? '빅장이에요! 궁 사이를 막거나 궁을 옆으로 옮기지 않으면 점수로 판정해요.' + : `${SIDE_KO[v.bikjang.calledBy]} 빅장!`} +
        + )} + {myTurn && v.repeatWarning && ( +
        + {v.rules.repetition === 'forbid' + ? '같은 국면이 3번 나왔어요. 한 번 더 반복하는 수는 둘 수 없어요.' + : v.rules.repetition === 'lose' + ? '같은 국면이 3번 나왔어요. 한 번 더 반복하면 실격패예요!' + : '같은 국면이 3번 나왔어요. 한 번 더 반복하면 점수로 판정해요.'} +
        + )} + {preview !== null && selected !== null && myTurn && ( +
        + + +
        + )} + {v.phase === 'setup' && ( + + )} + +
        ); } diff --git a/apps/web/src/games/las-vegas/index.tsx b/apps/web/src/games/las-vegas/index.tsx index 88695a4..24be1dd 100644 --- a/apps/web/src/games/las-vegas/index.tsx +++ b/apps/web/src/games/las-vegas/index.tsx @@ -174,6 +174,30 @@ button.lv-casino:hover { border-color: var(--primary); } @media (max-width: 1099px) { .lv-lower { grid-template-columns: minmax(0, 1fr); } } +/* PC: fill the play column; casinos take the spare height and everything on the table scales with --lv-u (1px at ~1100x760). */ +@media (min-width: 1100px) { + .lv-wrap { --lv-u: clamp(1px, min(var(--play-w) / 1100, var(--play-h) / 760), 1.7px); max-width: none; flex: 1 1 auto; min-height: 0; justify-content: center; gap: calc(var(--lv-u) * 10); } + .lv-help span { font-size: calc(var(--lv-u) * 16); } + .lv-casinos { flex: 1 1 auto; min-height: 0; gap: calc(var(--lv-u) * 10); } + .lv-casino { min-height: 196px; padding: calc(var(--lv-u) * 10); gap: calc(var(--lv-u) * 8); } + .lv-ctop .lv-die { width: calc(var(--lv-u) * 30); height: calc(var(--lv-u) * 30); } + .lv-cnum { font-size: calc(var(--lv-u) * 26); } + .lv-cname { font-size: calc(var(--lv-u) * 13); } + /* Bills stack down the casino as full-width notes, so the tall casinos are not empty. */ + .lv-casinos .lv-bills { flex-direction: column; flex-wrap: nowrap; gap: calc(var(--lv-u) * 6); } + .lv-casinos .lv-bill { width: 100%; height: calc(var(--lv-u) * 40); font-size: calc(var(--lv-u) * 22); border-radius: calc(var(--lv-u) * 7); } + .lv-casinos .lv-bill::before { font-size: calc(var(--lv-u) * 11); left: calc(var(--lv-u) * 6); top: 50%; transform: translateY(-50%); } + .lv-stacks { gap: calc(var(--lv-u) * 5); } + .lv-stack { font-size: calc(var(--lv-u) * 14); } + .lv-pips { gap: calc(var(--lv-u) * 3); } + .lv-casinos .lv-dot { width: calc(var(--lv-u) * 19); height: calc(var(--lv-u) * 19); border-radius: calc(var(--lv-u) * 4); } + .lv-tag { font-size: calc(var(--lv-u) * 13); } + .lv-group { min-width: calc(var(--lv-u) * 100); padding: calc(var(--lv-u) * 7) calc(var(--lv-u) * 12); } + .lv-group b { font-size: calc(var(--lv-u) * 19); } + .lv-tray .lv-die { width: calc(var(--lv-u) * 32); height: calc(var(--lv-u) * 32); } + .lv-tray .lv-die.lg { width: calc(var(--lv-u) * 46); height: calc(var(--lv-u) * 46); } + .lv-roll { min-height: calc(var(--lv-u) * 64); font-size: calc(var(--lv-u) * 19); } +} @media (max-width: 719px) { .lv-casinos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } .lv-casino { min-height: 132px; padding: 6px; gap: 4px; } diff --git a/apps/web/src/games/liar/index.tsx b/apps/web/src/games/liar/index.tsx index f228e8a..e839d61 100644 --- a/apps/web/src/games/liar/index.tsx +++ b/apps/web/src/games/liar/index.tsx @@ -78,7 +78,7 @@ const CSS = ` .lg-bar .tr { height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; } .lg-bar .tr i { display: block; height: 100%; background: #8b5cf6; border-radius: 7px; animation: lg-grow .7s ease-out; transform-origin: left; } .lg-bar[data-top='true'] .tr i { background: #dc2626; } -.lg-grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: 236px minmax(0, 1fr) 290px; grid-template-areas: 'players talk actions'; } +.lg-grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: clamp(236px, 17%, 340px) minmax(0, 1fr) clamp(290px, 20%, 400px); grid-template-areas: 'players talk actions'; } .lg-col { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; } .lg-players { grid-area: players; } .lg-talk { grid-area: talk; } diff --git a/apps/web/src/games/mafia/index.tsx b/apps/web/src/games/mafia/index.tsx index f0f22cd..c416498 100644 --- a/apps/web/src/games/mafia/index.tsx +++ b/apps/web/src/games/mafia/index.tsx @@ -114,7 +114,7 @@ const CSS = ` .mf-bar .tr { height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; } .mf-bar .tr i { display: block; height: 100%; background: #f97316; border-radius: 7px; animation: mf-grow .7s ease-out; transform-origin: left; } .mf-bar[data-top='true'] .tr i { background: #dc2626; } -.mf-grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: 236px minmax(0, 1fr) 280px; grid-template-areas: 'players chat actions'; } +.mf-grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: clamp(236px, 17%, 340px) minmax(0, 1fr) clamp(280px, 20%, 400px); grid-template-areas: 'players chat actions'; } .mf-col { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; } .mf-players { grid-area: players; } .mf-chatwrap { grid-area: chat; } diff --git a/apps/web/src/games/magical-athlete/index.tsx b/apps/web/src/games/magical-athlete/index.tsx index 88156a6..83fc632 100644 --- a/apps/web/src/games/magical-athlete/index.tsx +++ b/apps/web/src/games/magical-athlete/index.tsx @@ -314,6 +314,25 @@ button.ma-card:hover:not(:disabled) { border-color: var(--primary); transform: t .ma-card small { font-size: .78rem; } .ma-legend { grid-template-columns: minmax(0, 1fr); } } +/* PC: fill the play column. The race board is as big as the column height allows and the log + racer list sit beside it + when there is room (otherwise they wrap below as before). Without a board (draft) the panel fills the column. */ +@media (min-width: 1100px) { + .ma-wrap { max-width: none; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; align-content: flex-start; } + .ma-wrap > .ma-track { width: min(100%, calc((var(--play-h) - 86px) * ${(BW / WIDE.bh).toFixed(3)})); } + .ma-box { max-width: 100%; } + .ma-wrap > .ma-lower { flex: 1 1 340px; width: auto; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } + .ma-die3d { --ds: clamp(64px, calc(var(--play-h) * .07), 96px); } + .ma-wrap:not(:has(> .ma-track)) { flex: 1 1 auto; min-height: 0; flex-direction: column; flex-wrap: nowrap; align-items: stretch; } + .ma-wrap:not(:has(> .ma-track)) > .ma-panel { flex: 1 1 auto; min-height: 0; } + /* Rows grow up to a third of the column but share the height when there are many cards (5 players: 10 in the draft). */ + .ma-panel > .ma-cards { flex: 1 1 auto; min-height: 0; align-content: center; justify-content: center; gap: 14px; + grid-template-columns: repeat(auto-fit, minmax(clamp(190px, calc(var(--play-w) * .19), 360px), clamp(190px, calc(var(--play-w) * .22), 360px))); + grid-auto-rows: minmax(auto, clamp(104px, calc(var(--play-h) * .32), 380px)); } + .ma-panel > .ma-cards .ma-card { padding: clamp(10px, calc(var(--play-h) * .02), 24px); gap: 10px; } + .ma-panel > .ma-cards .ma-card .em { font-size: clamp(1.6rem, calc(var(--play-h) * .06), 4rem); } + .ma-panel > .ma-cards .ma-card b { font-size: clamp(1.05rem, calc(var(--play-h) * .022), 1.6rem); } + .ma-panel > .ma-cards .ma-card small { font-size: clamp(.875rem, calc(var(--play-h) * .016), 1.2rem); } +} @media (prefers-reduced-motion: reduce) { .ma-tok { transition: none; } .ma-hop, .ma-fly, .ma-trip-anim, .ma-ring, .ma-trail, .ma-float, .ma-conf, .ma-ticker div, .ma-die3d.rolling .ma-cube, .ma-die3d.rolling .ma-die-shadow { animation: none; } diff --git a/apps/web/src/games/mahjong/index.tsx b/apps/web/src/games/mahjong/index.tsx index 84fae35..2e4b85a 100644 --- a/apps/web/src/games/mahjong/index.tsx +++ b/apps/web/src/games/mahjong/index.tsx @@ -158,7 +158,7 @@ function Bump({ value, children }: { value: number; children?: ReactNode }) { const CSS = ` .game-main:has(> .mj) { justify-content: flex-start; } -.mj { position: relative; width: 100%; max-width: 1080px; display: flex; flex-direction: column; gap: 8px; align-self: center; } +.mj { position: relative; width: 100%; display: flex; flex-direction: column; gap: 8px; align-self: center; } .mj.wide { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'table side' 'me me'; align-items: start; gap: 8px 12px; } .mj.wide .mj-opps { grid-area: side; flex-direction: column; flex-wrap: nowrap; } .mj.wide .mj-seat { max-width: none; flex: none; } @@ -443,7 +443,7 @@ const ROT = [0, -90, 180, 90]; function Table({ v, players, width, callout, seen }: { v: MahjongView; players: Record; width: number; callout: ReactNode; seen: Seen | null }) { // Pond: 6 tiles per row (+ room for one sideways riichi tile) × 4 rows. Table = H + W + H. // Total width ≈ 2H + W + padding/border = 17·tw + 37. - const tw = Math.max(14, Math.min(30, Math.floor((width - 37) / 17))); + const tw = Math.max(14, Math.min(64, Math.floor((width - 37) / 17))); const th = Math.round((tw * 4) / 3); const W = 5 * (tw + 1) + th + 2; const H = 4 * (th + 1) + 2; @@ -560,7 +560,7 @@ function MyArea({ const beginner = my.prefs.beginner && v.options.beginnerMode; const phone = width > 0 && width < 600; const meldW = phone ? 18 : 26; - const tw = width > 0 ? Math.max(20, Math.min(phone ? 40 : 48, Math.floor((width - 14 - n) / n))) : 40; + const tw = width > 0 ? Math.max(20, Math.min(phone ? 40 : 60, Math.floor((width - 14 - n) / n))) : 40; const send = (code: string) => { if (pending) return; @@ -1153,15 +1153,15 @@ function MahjongBoard({ view: v, me, players, act, pending, deadline, tapConfirm const phone = width > 0 && width < 600; // PC: table on the left sized to the screen height, other players on the right, my hand below. const wide = width >= 900; - const reserve = v.my ? 290 : 20; - const tableWidth = wide ? Math.max(380, Math.min(width - 330, mainH > 0 && wide ? mainH - reserve : 560, 600)) : width || 360; + const reserve = v.my ? 300 : 20; + const tableWidth = wide ? Math.max(380, Math.min(width - 330, mainH > 0 && wide ? mainH - reserve : 560)) : width || 360; const showTable = v.phase === 'playing' || (v.phase === 'handResult' && !wide); return (
          {others.map((s) => ( - + ))}
        0 ? mainH - 12 : undefined } : undefined}> diff --git a/apps/web/src/games/marble/index.tsx b/apps/web/src/games/marble/index.tsx index 4ba66eb..b42b907 100644 --- a/apps/web/src/games/marble/index.tsx +++ b/apps/web/src/games/marble/index.tsx @@ -166,6 +166,15 @@ const CSS = ` @media (prefers-reduced-motion: reduce) { .mb-cell.pick .mb-pick, .mb-trail, .mb-hop, .mb-die.rolling, .mb-card, .mb-pop, .mb-fly, .mb-ring { animation: none; } } +/* PC: the square board is as large as the play column allows; the centre (dice, prompt, title) grows with it. */ +@media (min-width: 1100px) { + .mb-box { max-width: min(100%, var(--play-h)); } + .mb-title { font-size: clamp(1.5rem, calc(var(--play-h) * .03), 2.4rem); } + .mb-die { width: clamp(60px, calc(var(--play-h) * .07), 92px); height: clamp(60px, calc(var(--play-h) * .07), 92px); } + .mb-dice { min-height: clamp(64px, calc(var(--play-h) * .074), 96px); } + .mb-prompt { max-width: clamp(420px, calc(var(--play-h) * .5), 620px); } + .mb-card { width: min(100%, clamp(320px, calc(var(--play-h) * .36), 440px)); } +} `; // ---------------------------------------------------------------- geometry (viewBox 0..1000) diff --git a/apps/web/src/games/ninety-nine/index.tsx b/apps/web/src/games/ninety-nine/index.tsx index 7cb1a0b..8dda70e 100644 --- a/apps/web/src/games/ninety-nine/index.tsx +++ b/apps/web/src/games/ninety-nine/index.tsx @@ -159,6 +159,18 @@ const CSS = ` .nn-opps { flex-wrap: wrap; justify-content: center; overflow: visible; width: 100%; max-width: calc(var(--cols) * 184px - 4px); margin: 0 auto; } .nn-seat { flex: 0 1 calc((100% - (var(--cols) - 1) * 8px) / var(--cols)); min-width: 0; max-width: 176px; } } +/* PC: fill the play column. The felt takes the spare height; dial, hand cards (--nn-dial / --nn-cw) and seats grow with the play area. */ +@media (min-width: 1100px) { + .nn { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; gap: 12px; + --nn-dial: min(var(--play-h) * .34, 420px); --nn-cw: min(var(--play-h) * .17, 200px); } + .nn-opps { max-width: calc(var(--cols) * 256px - 4px); } + .nn-seat { max-width: 248px; padding: 8px 12px; font-size: clamp(.9rem, calc(var(--play-h) / 62), 1.1rem); } + .nn-table { flex: 1 1 auto; padding: 20px 28px; font-size: clamp(1rem, calc(var(--play-h) / 62), 1.2rem); } + .nn-hand { gap: clamp(10px, 1.2vw, 20px); } + .nn-table .nn-chip { font-size: .9em; } + .nn-recent li { font-size: .88em; } + .nn-recent .who { max-width: 140px; } +} @media (max-width: 719px) { .nn-table { grid-template-columns: 1fr auto; grid-template-areas: 'dial left' 'right right'; padding: 10px; gap: 8px 10px; border-width: 6px; } .nn-dial { grid-area: dial; } @@ -273,7 +285,7 @@ function SeatChip({ s, v, players, me, deadline }: { s: SeatView; v: NinetyNineV function Table({ v, players, me, deadline }: { v: NinetyNineView; players: Record; me: string | null; deadline: number | null }) { const shown = useCountUp(v.total); - const dial = 'clamp(150px, 20vw, 196px)'; + const dial = 'max(clamp(150px, 20vw, 196px), var(--nn-dial, 0px))'; const r = 44; const c = 2 * Math.PI * r; const frac = Math.min(1, v.total / 99); @@ -445,7 +457,7 @@ function MyHand({ v, act, pending }: { v: NinetyNineView; act: (a: unknown) => v btns[(i + (e.key === 'ArrowRight' ? 1 : btns.length - 1)) % btns.length]?.focus(); }; const n = my.hand.length; - const cw = n <= 3 ? 'clamp(84px, 24vw, 104px)' : n === 4 ? 'clamp(72px, 20vw, 96px)' : 'clamp(62px, 16.5vw, 90px)'; + const cw = `max(${n <= 3 ? 'clamp(84px, 24vw, 104px)' : n === 4 ? 'clamp(72px, 20vw, 96px)' : 'clamp(62px, 16.5vw, 90px)'}, var(--nn-cw, 0px))`; const meSeat = v.seats.find((s) => s.id === v.me); const legalCount = my.hand.filter((c) => c.legal).length; return ( diff --git a/apps/web/src/games/old-maid/index.tsx b/apps/web/src/games/old-maid/index.tsx index 4ed2e9d..7ebed0d 100644 --- a/apps/web/src/games/old-maid/index.tsx +++ b/apps/web/src/games/old-maid/index.tsx @@ -131,8 +131,10 @@ function logText(e: LogEntry, players: Record, me: string | // ---------------------------------------------------------------- styles const CSS = ` -.om-board { width: 100%; max-width: 1040px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; } -.om-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding-top: 6px; } +.om-board { width: 100%; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; flex: 1 1 auto; min-height: 0; } +.om-board > * { flex: none; } +.om-board > .om-table { flex: 1 0 auto; } +.om-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 260px)); justify-content: center; gap: 10px; padding-top: 6px; } .om-seat { position: relative; background: var(--surface); border-radius: var(--radius-lg); padding: 8px 10px; box-shadow: var(--shadow); border: 3px solid transparent; display: flex; flex-direction: column; gap: 5px; min-width: 0; } .om-seat.turn { border-color: var(--focus); } .om-seat.target { border-color: var(--primary); border-style: dashed; } @@ -156,7 +158,7 @@ const CSS = ` .om-mini.empty i { background: none; border-style: dashed; border-color: var(--border); box-shadow: none; } .om-mini.empty i::after { display: none; } .om-bubble { position: absolute; right: 8px; top: -12px; background: var(--text); color: var(--surface); border-radius: 12px; padding: 2px 10px; font-weight: 800; font-size: .8rem; box-shadow: var(--shadow); animation: om-pop .25s ease-out; z-index: 2; } -.om-table { position: relative; color: #fff; border-radius: 22px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; min-height: 200px; +.om-table { position: relative; color: #fff; border-radius: 22px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; min-height: 200px; background: radial-gradient(ellipse 75% 60% at 50% 36%, rgba(255,255,255,.15), rgba(255,255,255,0) 70%), var(--felt); border: 6px solid var(--wood); box-shadow: inset 0 0 0 2px rgba(255,255,255,.07), inset 0 0 48px rgba(0,0,0,.32), var(--shadow); } .om-table .small { color: #fff; opacity: .92; text-shadow: 0 1px 2px rgba(0,0,0,.35); } @@ -241,8 +243,10 @@ button.om-back[aria-pressed='true'] > .om-face { box-shadow: 0 0 0 3px #fde047, // ---------------------------------------------------------------- pieces /** Width of an element, kept up to date (a callback ref, so it follows the element when it is re-created). */ -function useWidth(): [(node: T | null) => void, number, { current: T | null }] { +/** Width of the node + the play area height on PC (`--play-h` of .game-main, 0 when the page scrolls instead). */ +function useWidth(): [(node: T | null) => void, number, { current: T | null }, number] { const [w, setW] = useState(0); + const [h, setH] = useState(0); const el = useRef(null); const ro = useRef(null); const ref = useCallback((node: T | null) => { @@ -250,13 +254,28 @@ function useWidth(): [(node: T | null) => void, number, { ro.current = null; el.current = node; if (!node) return; - setW(node.clientWidth); + const measure = () => { + setW(node.clientWidth); + setH(parseFloat(getComputedStyle(node).getPropertyValue('--play-h')) || 0); + }; + measure(); if (typeof ResizeObserver === 'function') { - ro.current = new ResizeObserver(() => setW(node.clientWidth)); + ro.current = new ResizeObserver(measure); ro.current.observe(node); + const main = node.closest('.game-main'); + if (main) ro.current.observe(main); } }, []); - return [ref, w, el]; + return [ref, w, el, h]; +} + +/** + * How much bigger than the base size the two card rows (table fan + my hand) can be on a big PC play area: both rows + * share the height left after the seats, titles, notes and buttons (~520px + a row of seats per extra seat line). + */ +function cardGrow(v: OldMaidView, width: number, playH: number): number { + const seatRows = Math.ceil(Math.max(1, v.order.length - 1) / Math.max(1, Math.floor((width + 50) / 270))); + return Math.min(2, Math.max(1, Math.min(width / 900, (playH - 520 - (seatRows - 1) * 110) / 200))); } const rowStyle = (l: FanLayout): CSSProperties => ({ '--cw': `${l.cw}px`, '--sw': `${l.step}px` }) as CSSProperties; @@ -405,7 +424,7 @@ function Fan({ v, me, players, act, pending, tapConfirm, riffle }: { v: OldMaidV const mine = !!v.my?.canDraw && v.my.from === target; const count = mine ? v.my!.count : (v.handCounts[target] ?? 0); const [sel, setSel] = useState(null); - const [ref, width, box] = useWidth(); + const [ref, width, box, playH] = useWidth(); // A new turn, or the owner shuffled / the fan changed: start over. useEffect(() => setSel(null), [v.turnNo, target, count, v.shuffles[target]]); // Where every card sits now (relative to the table), so a draw by someone else lifts that very card (useOldMaidFx). @@ -421,7 +440,8 @@ function Fan({ v, me, players, act, pending, tapConfirm, riffle }: { v: OldMaidV }), }; }); - const l = fanLayout(count, width, width > 0 && width < 520 ? FAN_PHONE : { ...FAN_PC, wrapCw: count > 12 ? 50 : 60 }); + const g = cardGrow(v, width, playH); + const l = fanLayout(count, width, width > 0 && width < 520 ? FAN_PHONE : { cw: Math.round(FAN_PC.cw * g), prefer: Math.round(FAN_PC.prefer * g), wrapCw: Math.round((count > 12 ? 50 : 60) * g) }); const draw = (index: number) => { if (pending) return; myDrawRect = box.current?.querySelectorAll('button.om-back')[index]?.querySelector('.om-face')?.getBoundingClientRect() ?? null; @@ -591,9 +611,11 @@ function MyArea({ v, me, players, act, pending, deadline, fresh, bubble }: { v: const hand = v.myHand ?? []; const st = v.status[me]; const cls = ['om-me', v.turn === me ? 'turn anim-glow' : '', v.target === me ? 'target' : ''].filter(Boolean).join(' '); - const [ref, width, box] = useWidth(); + const [ref, width, box, playH] = useWidth(); const narrow = width > 0 && width < 520; - const l = fanLayout(hand.length, width, { ...(narrow ? HAND_PHONE : HAND_PC), wrapCw: narrow ? (hand.length > 12 ? 44 : 50) : hand.length > 12 ? 52 : 64 }); + const g = narrow ? 1 : cardGrow(v, width, playH); + const base = narrow ? HAND_PHONE : HAND_PC; + const l = fanLayout(hand.length, width, { cw: Math.round(base.cw * g), prefer: Math.round(base.prefer * g), wrapCw: Math.round((narrow ? (hand.length > 12 ? 44 : 50) : hand.length > 12 ? 52 : 64) * g) }); // Shuffled (same cards, new order): every card slides with a little hop from its old place to its new one. const order = hand.join(','); const pos = useRef<{ order: string; at: Map }>({ order: '', at: new Map() }); diff --git a/apps/web/src/games/omok/index.tsx b/apps/web/src/games/omok/index.tsx index 5ccf462..7732474 100644 --- a/apps/web/src/games/omok/index.tsx +++ b/apps/web/src/games/omok/index.tsx @@ -43,6 +43,8 @@ const OMOK_CSS = ` @keyframes om-forbid { 0% { transform: scale(.3); opacity: 0; } 18% { transform: scale(1.25); opacity: 1; } 32% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } } .om-forbid-t { animation: om-forbid-t .9s ease-out both; pointer-events: none; } @keyframes om-forbid-t { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-.9px); opacity: 0; } } +/* PC: the board takes the whole play-area height minus the row that can show under it (--om-rows). */ +@media (min-width: 1100px) { .board-wrap.om-fit { max-width: min(100%, calc(var(--play-h) - var(--om-rows, 0px))); } } `; function OmokBoard({ view: v, act, pending, tapConfirm }: BoardProps) { @@ -153,7 +155,8 @@ function OmokBoard({ view: v, act, pending, tapConfirm }: BoardProps) const ghost = preview ?? (hover && canPlace(hover) ? hover : null); const pad = 0.9; return ( -
        + // Touch with tap-confirm shows [두기][취소] under the board: keep room for it. +
        .oc-pile { grid-column: 2; } + .oc-hand { justify-content: center; } +} @media (max-width: 719px) { .oc-table { grid-template-columns: auto auto; padding: 10px; gap: 10px; border-width: 6px; justify-content: center; } .oc-info { grid-column: 1 / -1; align-items: center; } @@ -230,7 +239,7 @@ function AttackCount({ n, uno }: { n: number; uno: boolean }) { function TableArea({ v, players, canDraw, onDraw, onDropCard, fx }: { v: OneCardView; players: Record; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void; fx: Fx }) { const [over, setOver] = useState(false); const from = fx.playFrom && fx.playFrom.discard === v.discardCount ? fx.playFrom : null; - const pw = 'clamp(64px, 9vw, 92px)'; + const pw = 'clamp(64px, min(9vw, var(--play-h) * .15), 210px)'; const recent = v.recent; const top = recent[recent.length - 1]; const drawText = v.pendingAttack > 0 ? `${v.pendingAttack}장 먹기` : '1장 먹기'; @@ -333,18 +342,26 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard, fx }: { v: OneCard // ---------------------------------------------------------------- my hand -function useWidth(): [React.RefObject, number] { +/** Element width plus the PC play-area height (--play-h on .game-main; 0 under 1100px where it is not measured). */ +function useWidth(): [React.RefObject, number, number] { const ref = useRef(null); const [w, setW] = useState(0); + const [h, setH] = useState(0); useLayoutEffect(() => { const el = ref.current; if (!el) return; - setW(el.clientWidth); - const ro = new ResizeObserver(() => setW(el.clientWidth)); + const main = el.closest('.game-main'); + const update = () => { + setW(el.clientWidth); + setH(main && matchMedia('(min-width: 1100px)').matches ? parseFloat(getComputedStyle(main).getPropertyValue('--play-h')) || 0 : 0); + }; + update(); + const ro = new ResizeObserver(update); ro.observe(el); + if (main) ro.observe(main); return () => ro.disconnect(); }, []); - return [ref, w]; + return [ref, w, h]; } interface PickState { @@ -359,7 +376,7 @@ function MyHand({ v, act, pending, players, arrived }: { v: OneCardView; act: (a const [hints, setHints] = useState(true); const [pick, setPick] = useState(null); const [note, setNote] = useState(''); - const [ref, width] = useWidth(); + const [ref, width, playH] = useWidth(); const hand = sortHand(my.hand, sortBy); const legal = new Set(my.legalCardIds); const turnKey = `${v.turnNo}-${v.phase}`; @@ -417,7 +434,7 @@ function MyHand({ v, act, pending, players, arrived }: { v: OneCardView; act: (a // Layout: one overlapping row on wide screens, wrapped rows on phones (cards ≥ 48 × 68). const n = hand.length; const phone = width > 0 && width < 600; - const cw = phone ? 54 : 78; + const cw = phone ? 54 : Math.round(Math.min(156, Math.max(78, playH * 0.12))); let ov = 6; if (!phone && n > 1) ov = Math.max(-cw * 0.6, Math.min(6, (width - cw * n) / (n - 1))); if (phone) ov = n > 12 ? -14 : 4; diff --git a/apps/web/src/games/othello/index.tsx b/apps/web/src/games/othello/index.tsx index 800fabf..2a84fe8 100644 --- a/apps/web/src/games/othello/index.tsx +++ b/apps/web/src/games/othello/index.tsx @@ -33,7 +33,9 @@ const CSS = ` @media (prefers-reduced-motion: reduce) { .oth-flip { animation: none; } .oth-old { display: none; } -}`; +} +/* PC: the board takes the whole play-area height minus the disc-count bar and the row that can show under it (--oth-rows). */ +@media (min-width: 1100px) { .board-wrap.oth-fit { max-width: min(100%, calc(var(--play-h) - var(--oth-rows, 0px))); } }`; /** Disc set down, then one light click per disc as it turns over (staggered like the animation). */ function placeSound(flipDelays: number[]) { @@ -190,7 +192,8 @@ function OthelloBoard({ view: v, act, pending, tapConfirm }: BoardProps + // Disc bar (30px) above; with touch tap-confirm also [두기][취소] under the board. +
        m === 'badugi' || m === 'fiveDraw'; /** Rank of a card id for the client-side "A를 남기면 4장" check. */ const isAce = (c: string) => c[0] === 'A'; +/** Width of my own (large) cards: 88 px, more on wide PC screens (see PokerBoard). */ +const MyCardW = createContext(88); + const CSS = ` .pk-table { position: relative; width: 100%; aspect-ratio: 16 / 11; border-radius: 180px; border: 10px solid var(--wood); background: radial-gradient(ellipse at center, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 60%), var(--felt); box-shadow: var(--shadow); } .pk-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: var(--seat-w, 172px); z-index: 1; background: var(--surface); color: var(--text); border-radius: 12px; padding: 6px 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.25); - border: 3px solid transparent; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; transition: border-color .2s; } + border: 3px solid transparent; display: flex; flex-direction: column; gap: 4px; font-size: calc(0.85rem * var(--pkf, 1)); transition: border-color .2s; } .pk-seat.turn { border-color: var(--focus); } .pk-seat.me { border-color: var(--primary); } .pk-seat.me.turn { border-color: var(--focus); } @@ -73,7 +77,7 @@ const CSS = ` .pk-seat.out { opacity: 0.6; } .pk-center { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); text-align: center; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); max-width: 52%; } .pk-board { display: flex; gap: 6px; justify-content: center; margin: 6px 0; } -.pk-slot { width: 64px; height: 90px; border-radius: 8px; border: 2px dashed rgba(255,255,255,.35); flex: none; } +.pk-slot { width: calc(64px * var(--pks, 1)); height: calc(90px * var(--pks, 1)); border-radius: 8px; border: 2px dashed rgba(255,255,255,.35); flex: none; } .pk-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; } .pk-actions .btn { min-height: 64px; flex-direction: column; gap: 0; padding: 0 8px; line-height: 1.15; font-size: 1.1rem; } .pk-actions .btn small { font-weight: 600; font-size: .85rem; opacity: .9; } @@ -83,6 +87,11 @@ const CSS = ` .pk-x::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: #dc2626; font-size: 3rem; font-weight: 900; pointer-events: none; } .pk-raise { display: grid; gap: 8px; } .pk-raise input[type=range] { width: 100%; min-height: 40px; } +/* PC: the table is as wide as the play column and takes the height my area leaves (seats and cards grow, see PokerBoard). */ +@media (min-width: 1100px) { + .pk-wrap.board-wrap { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; } + .pk-table { flex: 1 1 0; aspect-ratio: auto; min-height: 420px; } +} @media (max-width: 719px) { .pk-table { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; border-radius: 20px; border-width: 6px; } .pk-seat { position: static; transform: none; width: auto; } @@ -114,7 +123,7 @@ function seatBadges(seat: SeatView, v: PokerView): [string, string][] { return b; } -function SeatCards({ seat, v, me }: { seat: SeatView; v: PokerView; me: string | null }) { +function SeatCards({ seat, v, me, k }: { seat: SeatView; v: PokerView; me: string | null; k: number }) { const sd = v.showdown?.find((e) => e.id === seat.id); const cards: { c: ViewCard; key: string; title?: string }[] = []; if (seat.forehead !== undefined) cards.push({ c: seat.forehead, key: 'f', title: seat.forehead ? undefined : seat.id === me ? '내 이마 카드(나만 못 봐요)' : '이마 카드' }); @@ -130,17 +139,17 @@ function SeatCards({ seat, v, me }: { seat: SeatView; v: PokerView; me: string | 0 ? { marginLeft: cards.length > 5 ? -24 : -16 } : undefined} + style={i > 0 ? { marginLeft: Math.round((cards.length > 5 ? -24 : -16) * k) } : undefined} /> ))}
        ); } -function SeatBox({ seat, v, players, me, deadline, x, y }: { seat: SeatView; v: PokerView; players: Record; me: string | null; deadline: number | null; x: number; y: number }) { +function SeatBox({ seat, v, players, me, deadline, x, y, k }: { seat: SeatView; v: PokerView; players: Record; me: string | null; deadline: number | null; x: number; y: number; k: number }) { const u = userOf(players, seat.id); const badges = seatBadges(seat, v); const waiting = v.waiting.includes(seat.id) && v.handPhase !== 'handEnd'; @@ -187,7 +196,7 @@ function SeatBox({ seat, v, players, me, deadline, x, y }: { seat: SeatView; v: ))}
        )} - + {!sd && v.foldShown?.id === seat.id && {v.foldShown.handName}} {sd && ( @@ -199,7 +208,7 @@ function SeatBox({ seat, v, players, me, deadline, x, y }: { seat: SeatView; v: ); } -function CenterInfo({ v, players }: { v: PokerView; players: Record }) { +function CenterInfo({ v, players, k }: { v: PokerView; players: Record; k: number }) { const limit = v.options.endCondition === 'hands' ? `/${v.options.handLimit}` : ''; const penalty = v.penalties.reduce((a, p) => a + p.amount, 0); return ( @@ -207,11 +216,11 @@ function CenterInfo({ v, players }: { v: PokerView; players: Record{v.streetName}
        } {isCommunity(v.mode) && (
        - {Array.from({ length: 5 }, (_, i) => (v.board[i] ? : ))} + {Array.from({ length: 5 }, (_, i) => (v.board[i] ? : ))}
        )}
        모인 칩
        -
        +
        {formatChips(v.pot)}
        {v.pots.length > 1 && ( @@ -249,6 +258,24 @@ function PokerBoard({ view: v, me, players, act, pending, deadline }: BoardProps const showKey = `${v.handNo}-${v.handPhase}`; const [banner, showBanner] = useBanner(); usePokerFx(v, me, players, showBanner); + // PC: seats, cards and the pot grow with the table (1 at the old 890×600 table, up to 1.6×). + const wide = useWide(); + const tableRef = useRef(null); + const [[tableW, tableH], setTableSize] = useState([890, 600]); + useLayoutEffect(() => { + const el = tableRef.current; + if (!el) return undefined; + const measure = () => setTableSize([el.clientWidth, el.clientHeight]); + const ro = new ResizeObserver(measure); + ro.observe(el); + measure(); + return () => ro.disconnect(); + }, []); + const k = wide ? Math.min(1.6, Math.max(1, Math.min(tableW / 890, tableH / 600))) : 1; + // My cards follow the width only (my area's height decides the table's height, so no loop). + const lgW = Math.round(88 * (wide ? Math.min(1.4, Math.max(1, tableW / 1300)) : 1)); + // Seats (≈170 px × k tall, centred on the oval) stay inside the felt when the table is short and wide. + const ry = wide ? Math.max(28, Math.min(38, 50 - ((85 * k + 6) / Math.max(1, tableH)) * 100)) : 38; useEffect(() => { if (mine && !prevWaiting.current) { @@ -266,22 +293,35 @@ function PokerBoard({ view: v, me, players, act, pending, deadline }: BoardProps }, [showKey]); // eslint-disable-line react-hooks/exhaustive-deps return ( -
        - -
        6 ? '150px' : '176px' } as React.CSSProperties}> - {v.seats.map((s, i) => { - const rel = (i - myIdx + n) % n; - const ang = Math.PI / 2 + (rel * 2 * Math.PI) / n; - return ; - })} - + +
        + +
        6 ? 150 : 176) * k)}px`, '--pks': k.toFixed(2), '--pkf': (1 + (k - 1) / 2).toFixed(2) } as React.CSSProperties} + > + {v.seats.map((s, i) => { + const rel = (i - myIdx + n) % n; + const ang = Math.PI / 2 + (rel * 2 * Math.PI) / n; + // PC: pull side seats toward the table's corners so a short, wide table keeps them apart. + const c = Math.cos(ang); + const sn = Math.sin(ang); + const cx = wide ? Math.sign(c) * Math.abs(c) ** 0.7 : c; + const sy = wide ? Math.sign(sn) * Math.abs(sn) ** 0.7 : sn; + return ; + })} + +
        + +

        + {announce} +

        + {banner}
        - -

        - {announce} -

        - {banner} -
        + ); } @@ -693,25 +733,26 @@ function RevealBox({ v, act, pending }: { v: PokerView; act: (a: unknown) => voi } function MyCards({ v, seat }: { v: PokerView; seat: SeatView }) { + const lgW = useContext(MyCardW); const sd = v.showdown?.find((e) => e.id === seat.id); const best = new Set(sd?.best ?? []); return (
        {seat.forehead !== undefined && (
        - + 이마
        )} {seat.hole.map((c, i) => (
        - + {(isSevenMode(v.mode) || v.mode === 'indian') && {v.mode === 'indian' ? '손' : '나만 봄'}}
        ))} {seat.up.map((c, i) => (
        - + 공개
        ))} @@ -723,6 +764,7 @@ function MyCards({ v, seat }: { v: PokerView; seat: SeatView }) { function ChoicePicker({ cards, act, pending }: { cards: string[]; act: (a: unknown) => void; pending: boolean }) { const [discard, setDiscard] = useState(null); const [open, setOpen] = useState(null); + const lgW = useContext(MyCardW); const tap = (c: string) => { sfx.select(); if (!discard) setDiscard(c); @@ -741,7 +783,7 @@ function ChoicePicker({ cards, act, pending }: { cards: string[]; act: (a: unkno
        {cards.map((c) => ( - tap(c)} title={c === discard ? '버릴 카드(다시 누르면 취소)' : c === open ? '보여 줄 카드' : undefined} /> + tap(c)} title={c === discard ? '버릴 카드(다시 누르면 취소)' : c === open ? '보여 줄 카드' : undefined} /> ))}
        @@ -768,6 +810,7 @@ function ChoicePicker({ cards, act, pending }: { cards: string[]; act: (a: unkno /** 교환(바둑이 / 5카드 드로우): tap to lift the cards to change. */ function DrawPicker({ v, hole, act, pending }: { v: PokerView; hole: string[]; act: (a: unknown) => void; pending: boolean }) { const [sel, setSel] = useState([]); + const lgW = useContext(MyCardW); const { drawMax, drawAceBonus } = v.my; const keepsAce = hole.some((c) => isAce(c) && !sel.includes(c)); const limit = drawAceBonus && keepsAce ? drawMax + 1 : drawMax; @@ -785,7 +828,7 @@ function DrawPicker({ v, hole, act, pending }: { v: PokerView; hole: string[]; a

        {hole.map((c) => ( - { + { sfx.select(); setSel((s) => (s.includes(c) ? s.filter((x) => x !== c) : [...s, c])); }} diff --git a/apps/web/src/games/quoridor/index.tsx b/apps/web/src/games/quoridor/index.tsx index 272d2ff..648fa0a 100644 --- a/apps/web/src/games/quoridor/index.tsx +++ b/apps/web/src/games/quoridor/index.tsx @@ -68,7 +68,31 @@ const CSS = ` @media (prefers-reduced-motion: reduce) { .qd-pawn { transition: none; } .qd-wall-new, .qd-turn-ring { animation: none; } -}`; +} +.board-wrap.qd-side { flex-direction: row; align-items: center; justify-content: center; gap: 20px; } +.qd-side > .qd-rows { flex: 0 1 380px; min-width: 0; } +.qd-side .qd-modes { grid-template-columns: 1fr; } +.qd-rows:empty { display: none; }`; + +/** PC play-area size (.game-main, px), null under 1100px where the page scrolls and rows stay under the board. */ +function useWideMain(ref: React.RefObject) { + const [size, setSize] = useState<{ w: number; h: number } | null>(null); + useLayoutEffect(() => { + const main = ref.current?.closest('.game-main'); + if (!main) return; + const wide = matchMedia('(min-width: 1100px)'); + const update = () => setSize(wide.matches ? { w: main.clientWidth, h: main.clientHeight } : null); + update(); + const ro = new ResizeObserver(update); + ro.observe(main); + wide.addEventListener('change', update); + return () => { + ro.disconnect(); + wide.removeEventListener('change', update); + }; + }, [ref]); + return size; +} /** 판 돌리기: 모델 좌표(x 오른쪽, y 위쪽, 0~9) ↔ 화면 좌표(y 아래쪽). 네 가지 모두 자기 자신이 역변환. */ function makeTf(seat: Seat | null) { @@ -159,6 +183,8 @@ function QuoridorBoard({ view: v, players, act, pending, tapConfirm }: BoardProp const [cursor, setCursor] = useState({ x: 4, y: 8 }); const [kbd, setKbd] = useState(false); const [announce, setAnnounce] = useState(''); + const wrapRef = useRef(null); + const main = useWideMain(wrapRef); const svgRef = useRef(null); const prevCount = useRef(v.moveCount); const [shake, setShake] = useState(0); @@ -383,14 +409,25 @@ function QuoridorBoard({ view: v, players, act, pending, tapConfirm }: BoardProp return { x: N - off - w, y: 0, width: w, height: N }; }; + // PC: the board fills the play-area height. The rows (mode buttons, wall tray, hint) go beside it when that gives a + // bigger board than stacking them under it (which needs about `under` px of height). + const under = me ? (tapConfirm ? 190 : 175) : 60; + const besideW = main ? Math.floor(Math.min(main.w - 320, main.h)) : 0; + const stackW = main ? Math.floor(Math.min(main.w, main.h - under)) : 0; + const beside = !!main && besideW > stackW; + return ( -
        +
        {announce}

        - {me && v.phase === 'playing' && me.status === 'playing' && ( -
        - - -
        - )} - {myTurn && mode === 'wall' && ( -
        - - {!preview - ? '판의 홈(칸 사이) 교차점을 눌러 벽 자리를 골라요.' - : preview.why - ? `${wallText(preview.wall, t.swap)}: ${preview.why}` - : `${wallText(preview.wall, t.swap)} · 상대 길 +${preview.legal!.opp}칸${preview.legal!.me ? ` · 내 길 +${preview.legal!.me}칸` : ''}`} - - - -
        - )} - {myTurn && mode === 'move' && movePreview && ( -
        - - -
        - )} - {me && v.phase === 'playing' && !(myTurn && mode === 'wall') && ( -

        - {me.status === 'playing' - ? `내 말은 ${COLOR_KO[me.seat]}(${SEAT_KO[me.seat]})이에요. ${myGoal} 줄(${COLOR_KO[me.seat]} 띠)에 먼저 닿으면 이겨요.` - : me.status === 'finished' - ? '목표에 도착했어요! 남은 사람들의 순위가 정해질 때까지 지켜봐요.' - : '게임에서 빠졌어요. 계속 지켜볼 수 있어요.'} -

        - )} - {!me && ( -

        - {v.seats.map((x) => `${nick(x.playerId)}: ${COLOR_KO[x.seat]} → ${SIDE_KO[t.goalSide(x.seat)]} 줄`).join(' · ')} -

        - )} +
        + {me && v.phase === 'playing' && me.status === 'playing' && ( +
        + + +
        + )} + {myTurn && mode === 'wall' && ( +
        + + {!preview + ? '판의 홈(칸 사이) 교차점을 눌러 벽 자리를 골라요.' + : preview.why + ? `${wallText(preview.wall, t.swap)}: ${preview.why}` + : `${wallText(preview.wall, t.swap)} · 상대 길 +${preview.legal!.opp}칸${preview.legal!.me ? ` · 내 길 +${preview.legal!.me}칸` : ''}`} + + + +
        + )} + {myTurn && mode === 'move' && movePreview && ( +
        + + +
        + )} + {me && v.phase === 'playing' && !(myTurn && mode === 'wall') && ( +

        + {me.status === 'playing' + ? `내 말은 ${COLOR_KO[me.seat]}(${SEAT_KO[me.seat]})이에요. ${myGoal} 줄(${COLOR_KO[me.seat]} 띠)에 먼저 닿으면 이겨요.` + : me.status === 'finished' + ? '목표에 도착했어요! 남은 사람들의 순위가 정해질 때까지 지켜봐요.' + : '게임에서 빠졌어요. 계속 지켜볼 수 있어요.'} +

        + )} + {!me && ( +

        + {v.seats.map((x) => `${nick(x.playerId)}: ${COLOR_KO[x.seat]} → ${SIDE_KO[t.goalSide(x.seat)]} 줄`).join(' · ')} +

        + )} +
        ); } diff --git a/apps/web/src/games/rummikub/index.tsx b/apps/web/src/games/rummikub/index.tsx index 58b5779..45f72aa 100644 --- a/apps/web/src/games/rummikub/index.tsx +++ b/apps/web/src/games/rummikub/index.tsx @@ -175,6 +175,9 @@ button.rk-tile:disabled { cursor: default; } .rk-result { display: grid; gap: 6px; } .rk-result-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .rk-mini { display: inline-flex; gap: 2px; flex-wrap: wrap; } +@media (min-width: 1100px) { + .rk-rack .rk-tile { --w: clamp(44px, var(--play-w) * .036, 58px); --h: calc(var(--w) * 1.36); } +} @media (max-width: 1099px) { .rk-table { min-height: 160px; } } @@ -331,7 +334,7 @@ function RummikubBoard({ view: v, me, players, act, pending, deadline }: BoardPr const z = Number(localStorage.getItem('rk-zoom')); return ZOOMS.includes(z) ? z : null; }); - const [boxW, setBoxW] = useState(0); + const [box, setBox] = useState({ w: 0, h: 0 }); const [msg, setMsg] = useState(''); const [confirm, setConfirm] = useState(null); const [announce, setAnnounce] = useState(''); @@ -383,19 +386,23 @@ function RummikubBoard({ view: v, me, players, act, pending, deadline }: BoardPr // First-meld progress from what is on the board right now (new sets made of rack tiles only). const meldNow = groups.filter((g) => g.ok && g.tileIds.every((id) => !onTable0.has(id))).reduce((a, g) => a + g.points, 0); - // Grid size: fit the width, zoom in on small screens (the board scrolls). + // Grid size: fit the width, zoom in on small screens (the board scrolls). On PC (fixed-height play area) the cells + // may grow past 64px as long as the first MIN_ROWS rows still fit the height. useLayoutEffect(() => { const el = boxRef.current; if (!el) return; - setBoxW(el.clientWidth); + const wide = window.matchMedia('(min-width: 1100px)'); + const update = () => setBox({ w: el.clientWidth, h: wide.matches ? el.clientHeight : 0 }); + update(); if (typeof ResizeObserver === 'undefined') return; - const ro = new ResizeObserver(() => setBoxW(el.clientWidth)); + const ro = new ResizeObserver(update); ro.observe(el); return () => ro.disconnect(); }, []); - const fit = boxW ? Math.floor((boxW - 2) / BOARD_COLS) : 36; + const fit = box.w ? Math.floor((box.w - 2) / BOARD_COLS) : 36; + const fitH = box.h ? Math.floor((box.h - 2) / MIN_ROWS / 1.36) : 0; const z = zoom ?? (fit >= 30 ? 1 : fit >= 21 ? 1.5 : 2); - const cw = Math.max(16, Math.min(64, Math.round(fit * z))); + const cw = Math.max(16, Math.min(100, Math.round(Math.max(Math.min(fit, 64), Math.min(fit, fitH)) * z))); const ch = Math.round(cw * 1.36); const lowest = cells.reduce((m, x) => Math.max(m, x.r), -1); const rows = Math.min(BOARD_ROWS, Math.max(MIN_ROWS, lowest + 2 + (hand ? 1 : 0))); diff --git a/apps/web/src/games/seotda/board.tsx b/apps/web/src/games/seotda/board.tsx index 5c09f19..67eb035 100644 --- a/apps/web/src/games/seotda/board.tsx +++ b/apps/web/src/games/seotda/board.tsx @@ -86,7 +86,7 @@ function bannerOf(v: SeotdaView): string | null { const isBig = (name: string) => /광땡|땡$|장땡/.test(name) && name !== '땡잡이'; const CSS = ` -.sd-wrap { width: 100%; max-width: 1060px; display: flex; flex-direction: column; gap: 12px; align-self: center; container: sd / inline-size; } +.sd-wrap { width: 100%; display: flex; flex-direction: column; gap: 12px; align-self: stretch; container: sd / inline-size; } /* 테이블: 사이트 공용 펠트·나무 색(다크 모드 따라감) 위에 화투판 담요 같은 마름모 무늬. */ .sd-table { position: relative; width: 100%; aspect-ratio: 16 / 7.2; min-height: 370px; border-radius: 36px; border: 10px solid var(--wood); background: @@ -95,18 +95,18 @@ const CSS = ` repeating-linear-gradient(-45deg, rgba(255,255,255,.045) 0 2px, transparent 2px 18px), var(--felt); box-shadow: inset 0 0 0 2px var(--wood-line), inset 0 0 50px rgba(0,0,0,.28), var(--shadow); } -.sd-table::before { content: ''; position: absolute; left: 50%; top: 48%; width: 300px; height: 190px; transform: translate(-50%, -50%); border-radius: 50%; +.sd-table::before { content: ''; position: absolute; left: 50%; top: 48%; width: calc(300px * var(--sds, 1)); height: calc(190px * var(--sds, 1)); transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed rgba(255,255,255,.16); background: rgba(0,0,0,.08); pointer-events: none; } -.sd-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: 160px; z-index: 2; +.sd-seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: calc(160px * var(--sdseat, 1)); z-index: 2; background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 7px 9px; display: flex; flex-direction: column; gap: 3px; - border: 2px solid transparent; box-shadow: var(--shadow), 0 4px 14px rgba(0,0,0,.18); font-size: .82rem; transition: border-color .2s, opacity .2s, box-shadow .2s; } + border: 2px solid transparent; box-shadow: var(--shadow), 0 4px 14px rgba(0,0,0,.18); font-size: calc(.82rem * var(--sdf, 1)); transition: border-color .2s, opacity .2s, box-shadow .2s; } .sd-seat.turn { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 35%, transparent), 0 4px 14px rgba(0,0,0,.18); } .sd-seat.out { opacity: .6; } .sd-seat.win { border-color: #eab308; box-shadow: 0 0 0 4px rgba(234,179,8,.4), 0 0 22px rgba(234,179,8,.45); } .sd-seat .nm { font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sd-seat .sub { color: var(--text-sub); } .sd-money { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--warning); white-space: nowrap; } -.sd-cards { display: flex; justify-content: center; min-height: 52px; align-items: flex-end; margin-top: -26px; } +.sd-cards { display: flex; justify-content: center; min-height: 52px; align-items: flex-end; margin-top: calc(-26px * var(--sdseat, 1)); } .sd-tag { display: inline-block; border-radius: 999px; padding: 0 7px; font-weight: 800; font-size: .74rem; line-height: 1.5; white-space: nowrap; } .sd-act { position: absolute; top: -12px; right: -8px; z-index: 3; border-radius: 999px; padding: 1px 10px; font-weight: 900; font-size: .85rem; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); pointer-events: none; } @@ -120,7 +120,7 @@ const CSS = ` .sd-delta.plus { color: var(--success); } .sd-delta.minus { color: var(--danger); } .sd-center { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); text-align: center; color: #fff; z-index: 1; min-width: 220px; } .sd-pot-label { display: inline-block; font-size: .85rem; font-weight: 800; letter-spacing: .12em; background: rgba(255,255,255,.18); border-radius: 999px; padding: 1px 12px; } -.sd-pot { font-size: 2.3rem; font-weight: 900; font-variant-numeric: tabular-nums; color: #fde68a; text-shadow: 0 2px 6px rgba(0,0,0,.45); line-height: 1.15; } +.sd-pot { font-size: calc(2.3rem * var(--sdf, 1)); font-weight: 900; font-variant-numeric: tabular-nums; color: #fde68a; text-shadow: 0 2px 6px rgba(0,0,0,.45); line-height: 1.15; } .sd-pile { position: relative; height: 34px; width: 120px; margin: 0 auto 2px; } .sd-pile i { position: absolute; bottom: 0; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff7c2, #f5b301 55%, #b45309); border: 2px solid #92400e; box-shadow: 0 2px 3px rgba(0,0,0,.4); } @@ -196,6 +196,11 @@ button.sd-combo[aria-pressed='true'] { outline: 3px solid #93c5fd; outline-offse .sd-bet.on:active { transform: translateY(1px); } :root[data-theme='dark'] .sd-bet.on .lb { color: color-mix(in srgb, var(--c) 55%, #fff); } .sd-help { margin: 0; text-align: center; min-height: 1.4em; } +/* PC: the table takes all the height the dock leaves (seats and cards grow with it, see SeotdaBoard). */ +@media (min-width: 1100px) { + .sd-wrap { flex: 1 1 auto; min-height: 0; } + .sd-table { flex: 1 1 0; aspect-ratio: auto; } +} @container sd (max-width: 899px) { .sd-dock { flex-wrap: wrap; } .sd-jokbo { order: 3; flex: 1 1 100%; } @@ -230,11 +235,45 @@ button.sd-combo[aria-pressed='true'] { outline: 3px solid #93c5fd; outline-offse // ---------------------------------------------------------------- table positions -/** Seats other than mine around the table (mine is the bar below it): from my left, over the top, to my right (PC). */ -function seatPos(rel: number, others: number): { x: number; y: number } { - const t = rel / (others + 1); - const ang = ((160 + t * 220) * Math.PI) / 180; - return { x: 50 + 39 * Math.cos(ang), y: 52 + 33 * Math.sin(ang) }; +/** + * Seats other than mine around the table (mine is the bar below it): from my left, over the top, to my right (PC). + * They sit on an ellipse kept inside the W×H felt for a seat of `seatW` px, spaced evenly by arc length (equal angles + * would bunch them up at the left and right ends of a wide table). Returns percentages of the table. + */ +function seatPos(rel: number, others: number, w = 1040, h = 457, seatW = 160): { x: number; y: number } { + const rx = Math.max(10, w / 2 - seatW / 2 - 12); + const ry = Math.max(10, h / 2 - seatW * 0.56 - 8); // box ≈ 0.8 × seatW tall, cards stick out 0.16 × seatW above + const a0 = (135 * Math.PI) / 180; + const span = (270 * Math.PI) / 180; + const at = (k: number) => [rx * Math.cos(a0 + span * k), ry * Math.sin(a0 + span * k)] as const; + const steps = 96; + const len: number[] = [0]; + for (let i = 1; i <= steps; i++) { + const [x0, y0] = at((i - 1) / steps); + const [x1, y1] = at(i / steps); + len.push(len[i - 1]! + Math.hypot(x1 - x0, y1 - y0)); + } + const goal = (len[steps]! * rel) / (others + 1); + let i = 1; + while (i < steps && len[i]! < goal) i++; + const k = (i - 1 + (goal - len[i - 1]!) / (len[i]! - len[i - 1]! || 1)) / steps; + const [x, y] = at(k); + return { x: 50 + (x / w) * 100, y: 50 + (y / h) * 100 }; +} + +/** + * Widest seat (px) at which neighbouring seats on a W×H table don't overlap: apart sideways by the width or + * up/down by the height (a seat with its cards is about 0.8 as tall as wide), with an 8px gap. + */ +function seatFit(w: number, h: number, rels: number[], others: number, seatW: number): number { + const pts = rels.map((r) => seatPos(r, others, w, h, seatW)).map((p) => [(p.x * w) / 100, (p.y * h) / 100] as const); + let fit = Infinity; + for (let i = 1; i < pts.length; i++) { + const dx = Math.abs(pts[i]![0] - pts[i - 1]![0]); + const dy = Math.abs(pts[i]![1] - pts[i - 1]![1]); + fit = Math.min(fit, Math.max(dx - 8, (dy - 8) / 0.8)); + } + return fit; } /** Pile of coins in the middle; more coins for a bigger 판돈 (up to 9). */ @@ -620,6 +659,8 @@ interface DockProps { winner: boolean; setRef: SeatProps['setRef']; phone: boolean; + /** My card size factor (PC: grows with the table width). */ + scale: number; } /** @@ -627,7 +668,7 @@ interface DockProps { * them, then the number-key bet buttons. In 3장 섯다 the cards themselves are clicked to pick the open card / the two * cards to use, and the bet buttons make room for that step's button. */ -function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef, phone }: DockProps) { +function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef, phone, scale }: DockProps) { const [pick, setPick] = useState([]); useEffect(() => setPick([]), [v.handNo, v.rematchNo, v.handPhase]); const [hover, setHover] = useState(null); @@ -645,7 +686,7 @@ function Dock({ view: v, seat, players, act, pending, deadline, winner, setRef, const choosing = !!seat && v.handPhase === 'choose' && seat.chosen === false; const revealing = !!v.reveal?.mine; const playing = !!seat && seat.inHand && !seat.folded; - const w = phone ? (cards.length > 2 ? 62 : 74) : cards.length > 2 ? 76 : 88; + const w = phone ? (cards.length > 2 ? 62 : 74) : Math.round((cards.length > 2 ? 76 : 88) * scale); const tag = `${v.handNo}-${v.rematchNo}`; // While a card is still face down, don't give away the new 족보. const h = peeking ? null : v.myHand; @@ -900,7 +941,25 @@ export function SeotdaBoard({ view: v, me, players, act, pending, deadline }: Bo if (v.foldWin) winners.add(v.foldWin.winner); for (const p of v.showdown?.pots ?? []) if (p.type !== 'rematch') for (const w of p.winners) winners.add(w); } - const cardW = phone ? (v.threeCard ? 24 : 28) : v.threeCard ? 38 : 46; + // PC: seats, cards and the pot grow with the table (1 at the old 1040×457 felt, up to 1.8×); my cards with its width. + const [[tableW, tableH], setTableSize] = useState([1040, 457]); + useLayoutEffect(() => { + const el = tableRef.current; + if (!el) return undefined; + const measure = () => setTableSize([el.clientWidth, el.clientHeight]); + const ro = new ResizeObserver(measure); + ro.observe(el); + measure(); + return () => ro.disconnect(); + }, []); + const scale = phone ? 1 : Math.min(1.8, Math.max(1, Math.min(tableW / 1040, tableH / 457))); + const dockScale = phone ? 1 : Math.min(1.35, Math.max(1, tableW / 1040)); + // Seats (and their cards) shrink below that when many of them would overlap on the arc (7–8 players). + const seatRel = (rel: number) => (mySeat ? rel : rel + 1); + const seatOthers = mySeat ? n - 1 : n; + const rels = others.map((o) => seatRel(o.rel)); + const seatScale = phone ? 1 : Math.max(0.7, Math.min(scale, seatFit(tableW, tableH, rels, seatOthers, 160 * scale) / 160)); + const cardW = phone ? (v.threeCard ? 24 : 28) : Math.round((v.threeCard ? 38 : 46) * seatScale); const cols = phone ? (others.length > 4 ? 3 : 2) : 0; const othersEls: ReactNode = others.map(({ s, rel }) => ( -
        +
        {phone ? (
        {othersEls} @@ -937,7 +996,7 @@ export function SeotdaBoard({ view: v, me, players, act, pending, deadline }: Bo
        )}
        - +

        {announce}

        diff --git a/apps/web/src/games/six-nimmt/index.tsx b/apps/web/src/games/six-nimmt/index.tsx index a23ecaf..24a12e0 100644 --- a/apps/web/src/games/six-nimmt/index.tsx +++ b/apps/web/src/games/six-nimmt/index.tsx @@ -840,7 +840,14 @@ function Rules({ options }: { options?: SixNimmtOptions }) { // ---------------------------------------------------------------- styles const CSS = ` -.sx-wrap { width: 100%; max-width: 980px; display: flex; flex-direction: column; gap: 10px; } +.sx-wrap { width: 100%; display: flex; flex-direction: column; gap: 10px; + /* Card width: the 4 rows + the hand share the play height left after the bars, hints and buttons. */ + --sx-c: clamp(64px, (var(--play-h) - 400px) / 7, 140px); } +@media (min-width: 1100px) { + .sx-wrap { flex: 1 1 auto; min-height: 0; } + .sx-wrap > * { flex: none; } + .sx-wrap > .sx-rows { flex: 1 0 auto; justify-content: center; } +} .game-main:has(> .sx-wrap) { justify-content: flex-start; } .sx-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding: 8px 14px; } .sx-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; } @@ -860,7 +867,7 @@ const CSS = ` .sx-player.timed { padding-right: 40px; } .sx-rows { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--felt); border-radius: 16px; padding: 8px; } -.sx-row { width: 100%; max-width: 480px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px; align-items: center; border-radius: 10px; padding: 2px; transition: background .2s; } +.sx-row { width: 100%; max-width: calc(var(--sx-c) * 6 + 96px); display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px; align-items: center; border-radius: 10px; padding: 2px; transition: background .2s; } .sx-row.glow { background: rgba(255, 255, 255, .16); } .sx-row.take { animation: sx-shake .45s ease both; background: rgba(239, 68, 68, .35); } @keyframes sx-shake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } } @@ -869,10 +876,10 @@ const CSS = ` .sx-rowbulls { white-space: nowrap; } .sx-mark { border-radius: 6px; padding: 1px 3px; font-weight: 900; font-size: .72rem; background: #fff; color: #1c1e21; white-space: nowrap; } .sx-mark.mountain { background: #d9f99d; } -.sx-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 64px)); gap: 4px; } +.sx-slots { display: grid; grid-template-columns: repeat(6, minmax(0, var(--sx-c))); gap: 4px; } .sx-takebtn { grid-column: 2; justify-self: start; min-height: 40px; } @media (min-width: 720px) { - .sx-row:has(.sx-takebtn) { max-width: 680px; grid-template-columns: 30px minmax(0, 1fr) auto; } + .sx-row:has(.sx-takebtn) { max-width: calc(var(--sx-c) * 6 + 296px); grid-template-columns: 30px minmax(0, 1fr) auto; } .sx-row .sx-takebtn { grid-column: 3; } } .sx-card { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; border: 2px solid #3b3f46; color: #1c1e21; background: #fff; font-weight: 900; user-select: none; box-sizing: border-box; } @@ -886,8 +893,8 @@ const CSS = ` .sx-card.cow { background: #f1f5f9; border-style: dashed; } .sx-card.new { animation: sx-in .35s ease-out both; box-shadow: 0 0 0 3px var(--focus); } @keyframes sx-in { from { transform: translateY(-14px) scale(1.15); opacity: .3; } } -.sx-bulls { position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-size: .62rem; font-weight: 700; line-height: 1; } -.sx-n { font-size: clamp(.95rem, 4.2vw, 1.5rem); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } +.sx-bulls { position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-size: clamp(.62rem, calc(var(--sx-c) * .15), .95rem); font-weight: 700; line-height: 1; } +.sx-n { font-size: clamp(.95rem, min(4.2vw, calc(var(--sx-c) * .37)), 2.6rem); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .sx-card.mini .sx-n { font-size: 1.05rem; } .sx-card.mini .sx-bulls { font-size: .55rem; } .sx-orig { position: absolute; bottom: 2px; font-size: .55rem; font-weight: 700; color: #334155; } @@ -910,7 +917,7 @@ const CSS = ` .sx-hand-wrap { display: flex; flex-direction: column; gap: 6px; } .sx-hint { margin: 0; } -.sx-hand { display: grid; grid-template-columns: repeat(10, minmax(0, 72px)); gap: 6px; justify-content: center; padding-top: 12px; } +.sx-hand { display: grid; grid-template-columns: repeat(10, minmax(0, calc(var(--sx-c) + 8px))); gap: 6px; justify-content: center; padding-top: 12px; } @media (max-width: 720px) { .sx-hand { grid-template-columns: repeat(5, minmax(0, 64px)); } } .sx-hcard { all: unset; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border-radius: 10px; transition: transform .15s; min-width: 0; } .sx-hcard:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } diff --git a/apps/web/src/games/splendor/index.tsx b/apps/web/src/games/splendor/index.tsx index 2859d29..7d8d581 100644 --- a/apps/web/src/games/splendor/index.tsx +++ b/apps/web/src/games/splendor/index.tsx @@ -191,6 +191,25 @@ button.sp-noble { cursor: pointer; } .sp-help { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .9rem; } .sp-help b { background: var(--primary-soft); border-radius: 8px; padding: 2px 8px; } +/* PC: cards, decks, nobles and tokens grow with the play area (3 market rows + help strip + my dock fill the height). */ +@media (min-width: 1100px) { + .sp-root { --ch: clamp(136px, min((var(--play-h) - 390px) / 3, (var(--play-w) - 340px) / 3.5), 260px); --cw: calc(var(--ch) * .735); --dw: calc(var(--ch) * .53); + --tok: clamp(58px, calc(var(--ch) * .42), 96px); max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; justify-content: center; } + .sp-root > * { flex: none; } + .sp-table { gap: clamp(22px, 2vw, 40px); } + .sp-card:not(.mini) .sp-card-top .sp-gem { width: calc(var(--ch) * .162); height: calc(var(--ch) * .162); } + .sp-card:not(.mini) .sp-cost .sp-gem { width: calc(var(--ch) * .103); height: calc(var(--ch) * .103); } + .sp-card:not(.mini) .sp-tierdots, .sp-card:not(.mini) .sp-flag { font-size: clamp(.64rem, calc(var(--ch) * .068), .9rem); } + .sp-deck .n { font-size: clamp(1.25rem, calc(var(--ch) * .15), 2rem); } + .sp-deck .t { font-size: clamp(.74rem, calc(var(--ch) * .062), 1rem); } + .sp-nobles .sp-noble { width: calc(var(--ch) * .68); min-height: calc(var(--ch) * .54); } + .sp-nobles .sp-noble .nm { font-size: clamp(.7rem, calc(var(--ch) * .06), .95rem); } + .sp-nobles .sp-noble .rq { font-size: clamp(.8rem, calc(var(--ch) * .072), 1.1rem); } + .sp-nobles .sp-noble .rq .sp-gem { width: calc(var(--ch) * .096); height: calc(var(--ch) * .096); } + .sp-nobles .sp-noble .np { font-size: clamp(.95rem, calc(var(--ch) * .088), 1.35rem); } + .sp-bank .sp-token .sp-gem { width: calc(var(--tok) * .45); height: calc(var(--tok) * .45); } + .sp-bank .sp-token .lt { font-size: clamp(.7rem, calc(var(--tok) * .19), .95rem); } +} @media (max-width: 1099px) { .sp-root { max-width: 720px; } .sp-table { grid-template-columns: minmax(0, 1fr); } diff --git a/apps/web/src/games/tichu/index.tsx b/apps/web/src/games/tichu/index.tsx index 672fbb1..fa7c97d 100644 --- a/apps/web/src/games/tichu/index.tsx +++ b/apps/web/src/games/tichu/index.tsx @@ -176,6 +176,23 @@ button.tc-c { cursor: pointer; } .tc-actions .btn { min-height: 48px; font-size: .98rem; min-width: 56px; padding: 0 6px; } } @media (min-width: 720px) { .tc-ring .tc-row.mobile-only { display: none; } } +/* PC: fill the play column. The ring takes the spare height (felt grows), seats, trick cards and the hand grow with the play area. */ +@media (min-width: 1100px) { + .tc { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; gap: 12px; } + .tc-ring { flex: 1 1 auto; min-height: 0; grid-template-rows: auto minmax(0, 1fr); align-items: stretch; gap: 12px; } + .tc-pos-top, .tc-pos-left, .tc-pos-right { align-self: center; } + .tc-pos-top .tc-seat { min-width: 240px; } + .tc-seat { padding: 8px 12px; font-size: clamp(.86rem, calc(var(--play-h) / 64), 1.08rem); } + .tc-badge, .tc-bubble { font-size: .86em; } + .tc-tablewrap { display: flex; flex-direction: column; justify-content: center; } + .tc-tablewrap > .tc-table { flex: 1 1 auto; padding: 20px; font-size: clamp(1rem, calc(var(--play-h) / 62), 1.2rem); } + .tc-now { font-size: 1.25em; } .tc-now small { font-size: .72em; } .tc-dir { font-size: .78em; } + .tc-set { --cw: clamp(56px, calc(var(--play-h) * .1), 150px); } + .tc-set.prev { --cw: clamp(34px, calc(var(--play-h) * .055), 66px); } + .tc-hand { justify-content: center; gap: 6px; --cw: clamp(58px, min(var(--play-h) * .085, (var(--play-w) - 40px) / 14.5 - 6px), 120px); } + .tc-panel .tc-hand { --cw: clamp(58px, min(var(--play-h) * .075, (var(--play-w) * .52 - 40px) / 7.5 - 6px), 92px); } + .tc-slot { --cw: clamp(50px, calc(var(--play-h) * .065), 76px); } +} `; // ---------------------------------------------------------------- seats diff --git a/apps/web/src/games/uno/index.tsx b/apps/web/src/games/uno/index.tsx index 4c607fb..6980bdd 100644 --- a/apps/web/src/games/uno/index.tsx +++ b/apps/web/src/games/uno/index.tsx @@ -154,6 +154,15 @@ const CSS = ` .un-opps { flex-wrap: wrap; justify-content: center; overflow: visible; width: 100%; max-width: calc(var(--cols) * 184px - 4px); margin: 0 auto; } .un-seat { flex: 0 1 calc((100% - (var(--cols) - 1) * 8px) / var(--cols)); min-width: 0; max-width: 176px; } } +/* PC: fill the play column. The felt takes the spare height, piles and hand cards grow with the play area, seats get bigger. */ +@media (min-width: 1100px) { + .un { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; gap: 12px; } + .un-opps { max-width: calc(var(--cols) * 256px - 4px); } + .un-seat { max-width: 248px; padding: 8px 12px; font-size: clamp(.9rem, calc(var(--play-h) / 62), 1.1rem); } + .un-table { flex: 1 1 auto; grid-template-columns: 1fr auto auto 1fr; gap: clamp(18px, 2vw, 40px); padding: 20px 28px; font-size: clamp(1rem, calc(var(--play-h) / 62), 1.2rem); } + .un-table > .un-pile { grid-column: 2; } + .un-hand { justify-content: center; } +} @media (max-width: 719px) { .un-table { grid-template-columns: auto auto; padding: 12px 10px 10px; gap: 14px; border-width: 6px; justify-content: center; } .un-info { grid-column: 1 / -1; align-items: center; } @@ -216,7 +225,7 @@ function SeatChip({ s, v, players, me, deadline, next }: { s: SeatView; v: UnoVi function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: UnoView; players: Record; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void }) { const [over, setOver] = useState(false); - const pw = 'clamp(64px, 9vw, 92px)'; + const pw = 'clamp(64px, min(9vw, var(--play-h) * .15), 210px)'; const recent = v.recent; const top = recent[recent.length - 1]; const drawText = `${v.my?.drawCount ?? 1}장 뽑기`; @@ -286,18 +295,26 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: UnoView; pl // ---------------------------------------------------------------- my hand -function useWidth(): [React.RefObject, number] { +/** Element width plus the PC play-area height (--play-h on .game-main; 0 under 1100px where it is not measured). */ +function useWidth(): [React.RefObject, number, number] { const ref = useRef(null); const [w, setW] = useState(0); + const [h, setH] = useState(0); useLayoutEffect(() => { const el = ref.current; if (!el) return; - setW(el.clientWidth); - const ro = new ResizeObserver(() => setW(el.clientWidth)); + const main = el.closest('.game-main'); + const update = () => { + setW(el.clientWidth); + setH(main && matchMedia('(min-width: 1100px)').matches ? parseFloat(getComputedStyle(main).getPropertyValue('--play-h')) || 0 : 0); + }; + update(); + const ro = new ResizeObserver(update); ro.observe(el); + if (main) ro.observe(main); return () => ro.disconnect(); }, []); - return [ref, w]; + return [ref, w, h]; } function ColorSheet({ title, onPick, onClose }: { title: string; onPick: (c: Color) => void; onClose: () => void }) { @@ -326,7 +343,7 @@ function MyHand({ v, act, pending, players }: { v: UnoView; act: (a: unknown) => const [hints, setHints] = useState(true); const [pick, setPick] = useState(null); const [note, setNote] = useState(''); - const [ref, width] = useWidth(); + const [ref, width, playH] = useWidth(); const hand = sortHand(my.hand, sortBy); const legal = new Set(my.playable); const bluff = new Set(my.bluff); @@ -379,7 +396,7 @@ function MyHand({ v, act, pending, players }: { v: UnoView; act: (a: unknown) => // One overlapping row on wide screens, wrapped rows on phones (cards ≥ 54 × 76). const n = hand.length; const phone = width > 0 && width < 600; - const cw = phone ? 54 : 78; + const cw = phone ? 54 : Math.round(Math.min(156, Math.max(78, playH * 0.12))); let ov = 6; if (!phone && n > 1) ov = Math.max(-cw * 0.6, Math.min(6, (width - cw * n) / (n - 1))); if (phone) ov = n > 12 ? -14 : 4; diff --git a/apps/web/src/games/yacht/index.tsx b/apps/web/src/games/yacht/index.tsx index 9f303a7..faeeac7 100644 --- a/apps/web/src/games/yacht/index.tsx +++ b/apps/web/src/games/yacht/index.tsx @@ -130,12 +130,27 @@ const CSS = ` .yt-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; } .yt-bar > span { display: block; height: 100%; background: var(--success); transition: width .3s; } .yt-pname { display: inline-block; max-width: 72px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +/* PC: fill the play column. Dice tray (left) and score sheet (right) take the full height; dice grow with the tray, + the sheet's rows stretch to the column height and its text grows with it. */ @media (min-width: 1100px) { - .yt-wrap { display: grid; grid-template-columns: 380px minmax(0, 1fr); align-items: start; max-height: 100%; } - .yt-die { --s: 64px; } - .yt-sheet { max-height: calc(100vh - var(--site-h) - 52px - 40px); } + .yt-wrap { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); + max-width: none; flex: 1 1 auto; min-height: 0; align-self: stretch; } + /* Head on top; dice, roll button and notes centred in the rest of the tray. */ + .yt-tray > :last-child { margin-bottom: auto; } + .yt-dice { --s: clamp(64px, min(calc((var(--play-w) - 12px) * .5 / 6.4), calc(var(--play-h) * .12)), 150px); margin-top: auto; + gap: clamp(8px, calc(var(--play-w) * .008), 18px); padding-bottom: calc(var(--s) * .3); } + .yt-die { --s: inherit; border-radius: calc(var(--s) * .22); } + .yt-die.held { transform: translateY(calc(var(--s) * .2)); } + .yt-lock { font-size: clamp(.72rem, calc(var(--s) * .14), .95rem); bottom: calc(var(--s) * -.14); } + .yt-roll { min-height: clamp(64px, calc(var(--play-h) * .075), 84px); font-size: clamp(1.2rem, calc(var(--play-h) * .022), 1.5rem); } + .yt-sheet { max-height: 100%; } + .yt-table { height: 100%; font-size: clamp(1rem, calc(var(--play-h) * .017), 1.25rem); } .yt-table th, .yt-table td { height: 34px; } - .yt-cell { height: 30px; } + .yt-table thead th { font-size: .9em; } + .yt-table td.mine { font-size: 1.08em; } + .yt-table tr.yt-sum th, .yt-table tr.yt-sum td { font-size: .92em; } + .yt-table tr.yt-total th, .yt-table tr.yt-total td { font-size: 1.1em; } + .yt-cell { height: clamp(30px, calc(var(--play-h) * .04), 44px); } } @media (prefers-reduced-motion: reduce) { .yt-die, .yt-die.held { transition: none; } diff --git a/e2e/layout-survey.ts b/e2e/layout-survey.ts index ab4f5df..4972c6e 100644 --- a/e2e/layout-survey.ts +++ b/e2e/layout-survey.ts @@ -64,7 +64,7 @@ async function measure(p: Page) { right: Math.round(m.right - r), bottom: Math.round(m.bottom - b), side: side ? Math.round(side.width) : 0, - scroll: main.scrollHeight > main.clientHeight + 2 || document.documentElement.scrollHeight > innerHeight + 2, + scroll: Math.max(main.scrollHeight - main.clientHeight, document.documentElement.scrollHeight - innerHeight), }; }); } @@ -89,9 +89,10 @@ for (const g of games) { await p.waitForURL(/\/r\/\d{6}$/); if (bots) { const add = p.getByLabel('자리').getByRole('button', { name: '🤖 컴퓨터 넣기' }); + await add.first().waitFor({ timeout: 5000 }).catch(() => {}); // the lobby renders the button a moment later for (let i = 1; i < BOTS; i++) { - if (!(await add.count()) || !(await add.isEnabled().catch(() => false))) break; - await add.click(); + if (!(await add.count()) || !(await add.first().isEnabled().catch(() => false))) break; + await add.first().click(); await p.getByLabel('자리').getByText(`컴퓨터 ${i + 1}`).waitFor({ timeout: 3000 }); } } else { @@ -119,7 +120,7 @@ for (const g of games) { const fw = r.used[0] / r.main[0]; const fh = r.used[1] / r.main[1]; console.log( - `${g.padEnd(20)} ${w}x${h} main ${r.main.join('x')} used ${r.used.join('x')} (${Math.round(fw * 100)}% x ${Math.round(fh * 100)}%) gap L${r.left} R${r.right} B${r.bottom} side ${r.side}${r.scroll ? ' SCROLL' : ''}`, + `${g.padEnd(20)} ${w}x${h} main ${r.main.join('x')} used ${r.used.join('x')} (${Math.round(fw * 100)}% x ${Math.round(fh * 100)}%) gap L${r.left} R${r.right} B${r.bottom} side ${r.side}${r.scroll > 2 ? ` SCROLL ${r.scroll}px` : ''}`, ); } catch (e) { console.log(`${g.padEnd(20)} ${w}x${h} ERROR ${(e as Error).message.split('\n')[0]}`);