Practice mode is now at /practice on server.py instead of a separate server, with a button in the bottom-right corner of each page to the other mode. Touch: no double-tap zoom, no sticky hover after a tap, no long-press selection on the board, and a pressed look on tapped squares. Co-Authored-By: Claude Opus 5.5 <[email protected]>
203 lines
7.4 KiB
CSS
203 lines
7.4 KiB
CSS
:root {
|
|
--bg: #f6f5f1;
|
|
--surface: #ffffff;
|
|
--border: #dedbd2;
|
|
--text: #1d1c1a;
|
|
--muted: #6f6c64;
|
|
--x: #d0543a;
|
|
--o: #2f6fb5;
|
|
--win: #e9c46a;
|
|
--error: #b3261e;
|
|
--radius: 14px;
|
|
color-scheme: light;
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
:root {
|
|
--bg: #15161a;
|
|
--surface: #1f2026;
|
|
--border: #33353d;
|
|
--text: #ecebe6;
|
|
--muted: #9a988f;
|
|
--x: #f07a5f;
|
|
--o: #6aa6ea;
|
|
--win: #c9a64a;
|
|
--error: #ff8a80;
|
|
color-scheme: dark;
|
|
}
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
body {
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
main {
|
|
width: 100%;
|
|
max-width: 420px;
|
|
padding: 48px 16px 96px; /* room at the bottom to scroll clear of the mode switch */
|
|
}
|
|
|
|
h1 { font-size: 2.2rem; margin: 0 0 8px; letter-spacing: -0.02em; }
|
|
.lede { color: var(--muted); margin: 0 0 32px; }
|
|
|
|
button {
|
|
font: inherit;
|
|
font-weight: 600;
|
|
padding: 12px 18px;
|
|
border-radius: 10px;
|
|
border: 1px solid var(--border);
|
|
background: var(--surface);
|
|
color: var(--text);
|
|
cursor: pointer;
|
|
touch-action: manipulation; /* no double-tap zoom or tap delay on touch screens */
|
|
}
|
|
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); width: 100%; }
|
|
/* Hover styles only for real pointers: on touch screens they stick after a tap */
|
|
@media (hover: hover) {
|
|
button:hover { border-color: var(--muted); }
|
|
button.primary:hover { opacity: 0.9; }
|
|
.cell.playable:hover { border-color: var(--muted); }
|
|
}
|
|
button.small { padding: 6px 12px; font-size: 0.875rem; }
|
|
button.ghost { background: transparent; }
|
|
|
|
.divider {
|
|
display: flex; align-items: center; gap: 12px;
|
|
color: var(--muted); font-size: 0.875rem; margin: 28px 0 16px;
|
|
}
|
|
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
|
|
|
|
#join-form { display: flex; gap: 8px; }
|
|
#join-code {
|
|
flex: 1; min-width: 0;
|
|
font: 600 1.25rem/1 ui-monospace, "SF Mono", Menlo, monospace;
|
|
letter-spacing: 0.05em; text-transform: uppercase;
|
|
padding: 12px 14px;
|
|
border-radius: 10px; border: 1px solid var(--border);
|
|
background: var(--surface); color: var(--text);
|
|
}
|
|
#join-code::placeholder { text-transform: none; letter-spacing: 0; font-family: system-ui, sans-serif; font-weight: 400; font-size: 1rem; }
|
|
#join-code:focus { outline: 2px solid var(--o); outline-offset: -1px; }
|
|
|
|
.error { color: var(--error); min-height: 1.5em; margin: 12px 0 0; }
|
|
|
|
.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
.code-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
.label { color: var(--muted); font-size: 0.875rem; }
|
|
.code {
|
|
font: 700 1.3rem ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.1em;
|
|
min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
}
|
|
.code-wrap button, .bar > button { flex-shrink: 0; }
|
|
|
|
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 24px 0 8px; }
|
|
.player {
|
|
display: flex; align-items: center; gap: 10px;
|
|
padding: 10px 12px; border-radius: 10px;
|
|
border: 1px solid var(--border); background: var(--surface);
|
|
font-size: 0.9rem; color: var(--muted);
|
|
transition: border-color 0.15s;
|
|
}
|
|
.player.active { border-color: var(--text); color: var(--text); }
|
|
.player.empty { border-style: dashed; }
|
|
.player.gone { border-style: dashed; }
|
|
.player.gone .who { color: var(--error); }
|
|
.player .mark { font-weight: 800; font-size: 1.1rem; }
|
|
.mark.x { color: var(--x); }
|
|
.mark.o { color: var(--o); }
|
|
|
|
button.player {
|
|
font: inherit; font-size: 0.9rem; font-weight: 400;
|
|
text-align: left; width: 100%; cursor: pointer;
|
|
}
|
|
button.player[aria-pressed="true"] .who { font-weight: 600; }
|
|
.page-title { font-size: 1.4rem; margin: 0; }
|
|
.hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }
|
|
|
|
.difficulty { margin-top: 24px; }
|
|
.difficulty label { display: flex; justify-content: space-between; font-weight: 600; }
|
|
.difficulty output { font-variant-numeric: tabular-nums; }
|
|
.difficulty input { width: 100%; margin: 10px 0 0; accent-color: var(--text); }
|
|
|
|
.spoiler {
|
|
margin-top: 20px; padding: 10px 12px;
|
|
border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
|
|
}
|
|
.spoiler summary { cursor: pointer; font-weight: 600; }
|
|
.spoiler p { margin: 8px 0 0; color: var(--muted); }
|
|
.spoiler strong { color: var(--text); }
|
|
|
|
.toggle { display: flex; align-items: center; gap: 8px; margin-top: 12px; cursor: pointer; user-select: none; }
|
|
.toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); cursor: pointer; }
|
|
|
|
.status { font-size: 1.15rem; font-weight: 600; text-align: center; margin: 20px 0 16px; min-height: 1.5em; }
|
|
|
|
.board {
|
|
/* minmax(0, 1fr) and absolutely positioned marks keep cell sizes independent of content */
|
|
display: grid; gap: 8px;
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
aspect-ratio: 1; width: min(100%, 60vh); margin: 0 auto;
|
|
touch-action: manipulation;
|
|
user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; /* no long-press selection or menu */
|
|
}
|
|
.cell {
|
|
position: relative;
|
|
padding: 0; border-radius: var(--radius);
|
|
border: 1px solid var(--border); background: var(--surface);
|
|
display: grid; place-items: center;
|
|
cursor: default;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
.cell.playable { cursor: pointer; }
|
|
.cell.playable:active { border-color: var(--muted); background: color-mix(in srgb, var(--border) 40%, var(--surface)); }
|
|
.cell.win { background: color-mix(in srgb, var(--win) 30%, var(--surface)); border-color: var(--win); }
|
|
.cell svg { position: absolute; inset: 21%; width: 58%; height: 58%; overflow: visible; }
|
|
.cell svg * { fill: none; stroke-width: 12; stroke-linecap: round; }
|
|
.cell .x-mark * { stroke: var(--x); }
|
|
.cell .o-mark * { stroke: var(--o); }
|
|
/* Freshness view: newest piece solid, older ones fading toward the doomed look */
|
|
.board.freshness .cell[data-age="1"] svg { opacity: 0.65; }
|
|
.board.freshness .cell[data-age="2"] svg { opacity: 0.3; }
|
|
.cell.doomed svg { opacity: 0.3; animation: fade 1.6s ease-in-out infinite; }
|
|
.cell.placed svg { animation: pop 0.18s ease-out; }
|
|
|
|
@keyframes fade { 50% { opacity: 0.12; } }
|
|
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.cell.doomed svg, .cell.placed svg { animation: none; }
|
|
}
|
|
|
|
#game.offline .board,
|
|
#game.offline .players { opacity: 0.4; pointer-events: none; }
|
|
#game.offline .status { color: var(--error); }
|
|
|
|
.footer { margin-top: 20px; }
|
|
.actions { display: flex; gap: 8px; }
|
|
.actions > button { flex: 1; }
|
|
.actions > button.primary { flex: 2; }
|
|
.actions > button:disabled { opacity: 0.45; cursor: default; border-color: var(--border); }
|
|
/* Fixed bottom-right button to the other mode (multiplayer <-> practice) */
|
|
.mode-switch {
|
|
position: fixed;
|
|
right: calc(16px + env(safe-area-inset-right, 0px));
|
|
bottom: calc(16px + env(safe-area-inset-bottom, 0px));
|
|
padding: 8px 16px;
|
|
border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
|
|
box-shadow: 0 2px 10px rgb(0 0 0 / 0.12);
|
|
color: var(--text); font-size: 0.875rem; font-weight: 600; text-decoration: none;
|
|
touch-action: manipulation;
|
|
}
|
|
@media (hover: hover) { .mode-switch:hover { border-color: var(--muted); } }
|
|
|
|
.meta { color: var(--muted); font-size: 0.875rem; text-align: center; margin: 12px 0 0; min-height: 1.5em; }
|