election-game/web/src/game/minigames/billboard.css

394 lines
8.1 KiB
CSS
Raw Normal View History

/* 看板卡位(BillboardGame.tsx):手機上下排(提示、格子、看板、工具);電腦橫排(格子在左、看板與工具在右) */
.mg-billboard {
--mg-cell: light-dark(#ffffff, #1b2a40);
display: grid;
container-type: size;
}
.mg-bb {
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto auto;
justify-items: center;
align-content: center;
gap: 10px;
min-height: 0;
padding: 6px 12px max(12px, env(safe-area-inset-bottom, 0px));
}
.mg-status {
max-width: 100%;
min-height: 32px;
margin: 0;
padding: 4px 14px;
font-size: 15px;
font-weight: 800;
line-height: 1.5;
text-align: center;
color: var(--muted);
border: 3px solid transparent;
border-radius: 999px;
animation: mg-fade 160ms ease-out;
}
.mg-status.is-good {
color: var(--good);
}
.mg-status.is-bad {
color: #fff;
background: #c3121e;
border-color: var(--mg-k);
}
.mg-status.is-big {
color: var(--mg-k);
background: var(--signal);
border-color: var(--mg-k);
}
.mg-gridwrap {
--gw: min(600px, calc(100cqw - 24px), calc(100cqh - 250px));
display: grid;
grid-template-columns: 24px minmax(0, 1fr) 24px;
width: max(260px, var(--gw));
}
.mg-walk {
position: relative;
color: var(--muted);
}
.mg-walk svg {
position: absolute;
left: 50%;
transform: translate(-50%, -50%) rotate(90deg);
}
.mg-grid {
position: relative;
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
aspect-ratio: 1;
background: var(--mg-cell);
border: 3px solid var(--mg-k);
box-shadow: 5px 5px 0 var(--shadow-ink);
}
.mg-grid-row {
display: contents;
}
.mg-cell {
position: relative;
display: grid;
place-items: center;
min-width: 0;
min-height: 44px;
padding: 0;
font-family: var(--font-num);
font-size: clamp(17px, calc(var(--gw) / 15), 34px);
font-weight: 800;
color: var(--ink);
background: color-mix(in srgb, var(--signal) calc(var(--heat) * 100%), var(--mg-cell));
border: 1px solid light-dark(#d6d4cd, #2c3f5b);
cursor: pointer;
touch-action: manipulation;
}
.mg-cell:disabled {
cursor: default;
}
.mg-cell.is-zero b {
opacity: 0.35;
}
/* 人流 5 以上的格子很黃:深色模式也用黑字 */
.mg-cell.is-hot:not(.is-mine):not(.is-ghost):not(.is-ghost-bad) {
color: var(--mg-k);
}
.mg-cell.is-path::after {
content: "";
position: absolute;
right: 6px;
bottom: 6px;
width: 8px;
height: 8px;
background: var(--ink);
border-radius: 50%;
opacity: 0.35;
}
.mg-cell.is-build {
color: var(--mg-k);
background: repeating-linear-gradient(45deg, var(--signal) 0 7px, var(--mg-k) 7px 14px);
}
.mg-cell.is-build svg {
box-sizing: content-box;
padding: 3px;
background: #fff;
border: 2px solid var(--mg-k);
border-radius: 50%;
}
.mg-cell.is-rival {
color: #fff;
background: #6f757d;
border: 3px solid var(--mg-k);
}
.mg-cell.is-rival small {
font-family: var(--font-serif);
font-size: clamp(12px, calc(var(--gw) / 30), 18px);
}
.mg-cell.is-mine {
z-index: 1;
color: #fff;
background: #d61f2c;
border: 3px solid var(--mg-k);
}
.mg-cell.no-t {
border-top-width: 0;
}
.mg-cell.no-b {
border-bottom-width: 0;
}
.mg-cell.no-l {
border-left-width: 0;
}
.mg-cell.no-r {
border-right-width: 0;
}
.mg-cell.is-new {
animation: mg-drop 260ms var(--ease-out);
}
.mg-cell.is-ghost {
z-index: 2;
color: #fff;
background: color-mix(in srgb, #d61f2c 70%, var(--mg-cell));
outline: 3px dashed var(--mg-k);
outline-offset: -5px;
}
.mg-cell.is-ghost-bad {
z-index: 2;
color: var(--ink);
background: repeating-linear-gradient(-45deg, rgb(195 18 30 / 0.55) 0 6px, transparent 6px 12px), var(--mg-cell);
outline: 3px solid #c3121e;
outline-offset: -4px;
}
/* 右邊(手機在下面):看板托盤、工具、圖例 */
.mg-side {
display: grid;
justify-items: center;
gap: 10px;
}
.mg-tray {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
}
.mg-piece {
position: relative;
display: grid;
grid-template-rows: 1fr auto;
place-items: center;
width: 76px;
height: 80px;
padding: 6px 2px 4px;
font: inherit;
color: var(--ink);
background: var(--surface);
border: 3px solid var(--ink);
border-radius: 12px;
box-shadow: 3px 3px 0 var(--shadow-ink);
cursor: pointer;
transition: transform 120ms var(--ease-out);
}
.mg-piece small {
font-size: 11px;
font-weight: 800;
white-space: nowrap;
}
.mg-piece kbd {
position: absolute;
top: 3px;
left: 5px;
font-family: var(--font-num);
font-size: 12px;
font-weight: 800;
color: var(--muted);
}
.mg-piece.is-selected {
color: var(--mg-k);
background: var(--signal);
border-color: var(--mg-k);
transform: translate(-2px, -2px);
box-shadow: 5px 5px 0 var(--shadow-ink);
}
.mg-piece.is-selected kbd {
color: var(--mg-k);
}
.mg-piece:disabled {
cursor: default;
}
.mg-piece.is-used {
opacity: 0.45;
box-shadow: none;
}
.mg-piece-done {
position: absolute;
top: -9px;
right: -9px;
padding: 2px;
color: #fff;
background: var(--good);
border: 2px solid var(--mg-k);
border-radius: 50%;
box-sizing: content-box;
}
.mg-mini {
display: grid;
grid-template-columns: repeat(3, 14px);
grid-auto-rows: 14px;
gap: 2px;
}
.mg-mini i {
background: #d61f2c;
border: 2px solid var(--mg-k);
}
.mg-tools {
display: flex;
justify-content: center;
gap: 8px;
}
.mg-tools .gs-btn {
min-height: 48px;
padding: 6px 14px;
white-space: nowrap;
}
.mg-tools kbd {
padding: 0 5px;
font-family: var(--font-num);
font-size: 12px;
line-height: 1.4;
border: 2px solid currentColor;
border-radius: 5px;
opacity: 0.6;
}
.mg-tools .is-ready {
animation: mg-ready 700ms var(--ease-in-out) infinite alternate;
}
.mg-legend {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 4px 14px;
margin: 0;
padding: 0;
font-size: 12px;
font-weight: 800;
color: var(--muted);
list-style: none;
}
.mg-legend li {
display: inline-flex;
align-items: center;
gap: 5px;
}
.mg-legend i {
display: inline-grid;
place-items: center;
width: 18px;
height: 18px;
font-family: var(--font-num);
font-size: 12px;
font-style: normal;
color: var(--mg-k);
border: 2px solid var(--mg-k);
}
.mg-legend .is-heat {
background: color-mix(in srgb, var(--signal) 78%, #fff);
}
.mg-legend .is-build {
background: repeating-linear-gradient(45deg, var(--signal) 0 4px, var(--mg-k) 4px 8px);
}
.mg-legend .is-rival {
background: #6f757d;
}
.mg-legend .is-path {
background: radial-gradient(circle, var(--ink) 0 3px, transparent 4px), var(--mg-cell);
opacity: 0.8;
}
/* 觸控裝置沒有鍵盤:不顯示快捷鍵 */
@media (hover: none) {
.mg-tools kbd,
.mg-piece kbd {
display: none;
}
}
@media (hover: hover) and (pointer: fine) {
.mg-piece:hover:not(:disabled):not(.is-selected) {
background: color-mix(in srgb, var(--signal) 35%, var(--surface));
}
}
/* 電腦、平板橫放:格子在左,右邊放托盤和工具 */
@container (min-width: 760px) and (orientation: landscape) {
.mg-bb {
grid-template-columns: auto 300px;
grid-template-rows: auto auto;
column-gap: 40px;
justify-content: center;
align-items: center;
}
.mg-status {
grid-column: 1;
grid-row: 1;
}
.mg-gridwrap {
grid-column: 1;
grid-row: 2;
}
.mg-side {
grid-column: 2;
grid-row: 1 / span 2;
}
.mg-gridwrap {
--gw: min(640px, calc(100cqh - 90px), calc(100cqw - 400px));
}
.mg-side {
gap: 18px;
}
.mg-tray {
gap: 12px;
}
.mg-piece {
width: 88px;
height: 92px;
}
.mg-mini {
grid-template-columns: repeat(3, 17px);
grid-auto-rows: 17px;
}
.mg-tools {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
}
.mg-tools .gs-btn:last-child {
grid-column: 1 / -1;
min-height: 56px;
font-size: 18px;
}
}
@keyframes mg-drop {
0% {
transform: scale(1.25);
}
60% {
transform: scale(0.95);
}
}
@keyframes mg-ready {
to {
transform: translate(-1px, -1px) scale(1.04);
}
}
@media (prefers-reduced-motion: reduce) {
.mg-cell.is-new,
.mg-tools .is-ready,
.mg-status {
animation: none;
}
.mg-piece {
transition: none;
}
}