Files
website-collection/chess/public/styles.css
T

1204 lines
20 KiB
CSS

:root {
color-scheme: dark light;
--bg-body: #0f172a;
--bg-panel: rgba(30, 41, 59, 0.72);
--bg-input: rgba(15, 23, 42, 0.72);
--border-subtle: rgba(255, 255, 255, 0.12);
--border-strong: rgba(255, 255, 255, 0.2);
--glass-shadow:
0 8px 32px rgba(0, 0, 0, 0.28),
inset 0 1px 1px rgba(255, 255, 255, 0.06);
--border-focus: #10b981;
--text-main: #f8fafc;
--text-muted: #94a3b8;
--text-soft: #cbd5e1;
--primary: #10b981;
--primary-hover: #059669;
--secondary: rgba(255, 255, 255, 0.09);
--secondary-hover: rgba(255, 255, 255, 0.16);
--danger: #ef4444;
--board-light: #ebecd0;
--board-dark: #739552;
--radius-sm: 5px;
--radius-md: 8px;
--radius-lg: 10px;
--content-width: 1280px;
}
/* =========================================================
LIGHT THEME
========================================================= */
@media (prefers-color-scheme: light) {
:root {
--bg-body: #eef2f3;
--bg-panel: rgba(255, 255, 255, 0.78);
--bg-input: rgba(255, 255, 255, 0.82);
--border-subtle: rgba(15, 23, 42, 0.12);
--border-strong: rgba(15, 23, 42, 0.2);
--glass-shadow:
0 8px 28px rgba(15, 23, 42, 0.12),
inset 0 1px 1px rgba(255, 255, 255, 0.7);
--text-main: #172033;
--text-muted: #64748b;
--text-soft: #334155;
--secondary: rgba(15, 23, 42, 0.06);
--secondary-hover: rgba(15, 23, 42, 0.11);
}
body {
background-color: #eef2f3;
}
.main-header h1,
h2,
h3 {
color: var(--text-main);
text-shadow: none;
}
.piece.white {
color: #ffffff;
}
input[type="text"],
select {
color: var(--text-main);
}
input::placeholder {
color: rgba(15, 23, 42, 0.4);
}
.mode-button.active {
color: var(--text-main);
}
.secondary-button,
.icon-button {
color: var(--text-main);
}
}
/* =========================================================
RESET
========================================================= */
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
min-height: 100%;
scroll-behavior: smooth;
}
body {
margin: 0;
min-height: 100vh;
background-color: var(--bg-body);
background-image:
linear-gradient(
rgba(15, 23, 42, 0.48),
rgba(15, 23, 42, 0.62)
),
url("https://images.unsplash.com/photo-1529699211952-734e80c4d42b?q=70&w=1600&auto=format&fit=crop");
background-size: cover;
background-position: center;
background-attachment: fixed;
color: var(--text-main);
font-family:
Inter,
ui-sans-serif,
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
sans-serif;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
padding: 20px;
}
button,
input,
select {
font: inherit;
}
button {
cursor: pointer;
}
button:disabled {
cursor: not-allowed;
opacity: 0.55;
}
.hidden {
display: none !important;
}
/* =========================================================
PAGE
========================================================= */
.page-shell {
width: 100%;
max-width: var(--content-width);
margin: 0 auto;
}
.main-header {
margin-bottom: 24px;
text-align: left;
}
.main-header h1 {
margin: 0;
display: flex;
align-items: center;
gap: 12px;
font-size: clamp(24px, 3vw, 30px);
font-weight: 800;
color: #fff;
text-shadow:
0 2px 10px rgba(0, 0, 0, 0.5);
}
.chess-icon {
color: var(--primary);
font-size: 32px;
line-height: 1;
}
/* =========================================================
MAIN GRID
========================================================= */
.app-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) 360px;
gap: 24px;
align-items: start;
}
/* =========================================================
PANELS
========================================================= */
.panel {
background: var(--bg-panel);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
padding: 24px;
box-shadow: var(--glass-shadow);
}
.panel + .panel {
margin-top: 20px;
}
.panel-head {
margin-bottom: 20px;
}
.label {
margin: 0 0 4px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.06em;
font-weight: 700;
color: var(--text-muted);
}
h2,
h3 {
margin: 0;
}
h2 {
font-size: 20px;
font-weight: 700;
}
h3 {
font-size: 18px;
font-weight: 600;
color: var(--text-main);
}
/* =========================================================
BUTTONS
========================================================= */
button {
border: none;
border-radius: var(--radius-sm);
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 16px;
font-size: 14px;
font-weight: 600;
transition:
background-color 0.16s ease,
border-color 0.16s ease,
transform 0.16s ease,
box-shadow 0.16s ease;
-webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
outline: 2px solid var(--primary);
outline-offset: 2px;
}
.primary-button {
width: 100%;
padding: 12px;
background: var(--primary);
color: #fff;
font-size: 15px;
box-shadow:
0 4px 12px rgba(16, 185, 129, 0.25);
}
.primary-button:hover {
background: var(--primary-hover);
transform: translateY(-1px);
box-shadow:
0 6px 16px rgba(16, 185, 129, 0.3);
}
.secondary-button {
background: var(--secondary);
border: 1px solid var(--border-subtle);
color: var(--text-main);
}
.secondary-button:hover {
background: var(--secondary-hover);
border-color: var(--border-strong);
}
.ghost-button {
width: 100%;
background: transparent;
color: #ff5c5c;
border: 1px solid rgba(255, 92, 92, 0.5);
}
.ghost-button:hover {
background: rgba(255, 92, 92, 0.12);
color: #ff7676;
}
.icon-button {
min-width: 42px;
background: var(--secondary);
border: 1px solid var(--border-subtle);
color: var(--text-main);
}
.icon-button:hover {
background: var(--secondary-hover);
}
/* =========================================================
HEADER TOOLBAR
========================================================= */
.board-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
margin-bottom: 24px;
padding-bottom: 16px;
border-bottom: 1px solid var(--border-subtle);
}
.toolbar-actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
/* =========================================================
MODE SWITCHER
========================================================= */
.mode-switcher {
display: flex;
padding: 4px;
margin-bottom: 20px;
background: rgba(0, 0, 0, 0.16);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-sm);
}
.mode-button {
flex: 1;
padding: 8px;
background: transparent;
color: var(--text-muted);
border: none;
}
.mode-button.active {
background: var(--secondary-hover);
color: var(--text-main);
box-shadow:
0 2px 8px rgba(0, 0, 0, 0.15);
}
/* =========================================================
FORMS
========================================================= */
.field {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 20px;
}
.field span {
font-size: 13px;
font-weight: 500;
color: var(--text-muted);
}
.field-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
input[type="text"],
select {
width: 100%;
background: var(--bg-input);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-sm);
color: var(--text-main);
padding: 12px;
outline: none;
font-size: 14px;
transition:
border-color 0.16s ease,
background-color 0.16s ease;
}
input[type="text"]:focus,
select:focus {
border-color: var(--border-focus);
}
input::placeholder {
color: rgba(255, 255, 255, 0.35);
}
.join-row {
display: flex;
gap: 8px;
}
.join-row input {
flex: 1;
min-width: 0;
}
.muted-copy {
margin: 12px 0 0;
font-size: 12px;
color: var(--text-muted);
text-align: center;
}
/* =========================================================
CHESS BOARD
========================================================= */
.board-stage {
width: 100%;
max-width: 640px;
margin: 0 auto;
padding: 12px;
background: rgba(0, 0, 0, 0.18);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-md);
box-shadow:
inset 0 2px 10px rgba(0, 0, 0, 0.35);
}
.board {
width: 100%;
aspect-ratio: 1 / 1;
display: grid;
grid-template-columns: repeat(8, 1fr);
grid-template-rows: repeat(8, 1fr);
overflow: hidden;
border: 4px solid rgba(15, 23, 42, 0.8);
border-radius: var(--radius-sm);
contain: layout paint;
}
.square {
width: 100%;
height: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
border: none;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.square.light {
background-color: var(--board-light);
}
.square.dark {
background-color: var(--board-dark);
}
.square.selected {
background-color: rgba(234, 230, 93, 0.72);
}
.square.last-move {
background-color: rgba(234, 230, 93, 0.42);
}
.square.check-square {
background-color: rgba(239, 68, 68, 0.62);
}
.square.legal-target::after {
content: "";
position: absolute;
width: 25%;
height: 25%;
border-radius: 50%;
background: rgba(0, 0, 0, 0.25);
pointer-events: none;
}
.square.capture-target::after {
content: "";
position: absolute;
width: 80%;
height: 80%;
border-radius: 50%;
border: 5px solid rgba(0, 0, 0, 0.25);
background: transparent;
pointer-events: none;
}
.piece {
position: relative;
z-index: 10;
font-size: clamp(28px, 6vw, 65px);
line-height: 1;
user-select: none;
pointer-events: none;
}
.piece.white {
color: #fff;
text-shadow:
0 2px 4px rgba(0, 0, 0, 0.65);
}
.piece.black {
color: #000;
text-shadow:
0 2px 4px rgba(255, 255, 255, 0.4);
}
/* =========================================================
STATUS
========================================================= */
.status-strip {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
margin-top: 24px;
padding: 16px;
background: var(--bg-panel);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-md);
}
.status-message {
margin: 0;
font-size: 15px;
font-weight: 500;
}
.status-meta {
display: flex;
gap: 8px;
flex-wrap: wrap;
justify-content: flex-end;
}
.status-chip {
padding: 4px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.4px;
}
.turn-white {
background: rgba(255, 255, 255, 0.9);
color: #000;
}
.turn-black {
background: rgba(0, 0, 0, 0.8);
color: #fff;
border: 1px solid var(--border-subtle);
}
.connection-solo {
background: var(--secondary);
color: var(--text-main);
}
.connection-party {
background: var(--primary);
color: #fff;
}
/* =========================================================
PLAYERS
========================================================= */
.roster-grid {
display: grid;
grid-template-columns: 1fr;
gap: 12px;
margin-bottom: 20px;
}
.roster-card {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: rgba(0, 0, 0, 0.16);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-sm);
}
.roster-card.white-player {
border-left: 4px solid rgba(255, 255, 255, 0.8);
}
.roster-card.black-player {
border-left: 4px solid rgba(0, 0, 0, 0.8);
}
.roster-info {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.roster-role {
font-size: 11px;
text-transform: uppercase;
color: var(--text-muted);
}
.roster-card strong {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.player-clock {
min-width: 80px;
padding: 6px 12px;
background: rgba(0, 0, 0, 0.4);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-sm);
color: var(--text-main);
font-family:
ui-monospace,
SFMono-Regular,
Menlo,
Monaco,
Consolas,
monospace;
font-size: 20px;
font-weight: 700;
letter-spacing: 1px;
text-align: center;
transition:
border-color 0.2s ease,
background-color 0.2s ease;
}
.player-clock.active {
background: rgba(16, 185, 129, 0.18);
border-color: var(--primary);
color: var(--primary);
box-shadow:
0 0 10px rgba(16, 185, 129, 0.25);
}
.player-clock.low {
color: var(--danger);
border-color: var(--danger);
background: rgba(239, 68, 68, 0.1);
}
/* =========================================================
SPECTATORS
========================================================= */
.spectator-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.badge {
padding: 2px 8px;
background: var(--bg-input);
border: 1px solid var(--border-subtle);
border-radius: 12px;
color: var(--text-muted);
font-size: 11px;
font-weight: 600;
}
.spectator-list {
margin: 0;
padding: 0;
list-style: none;
font-size: 13px;
color: var(--text-muted);
}
.empty-state {
font-style: italic;
opacity: 0.7;
}
/* =========================================================
MODAL
========================================================= */
.modal {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
background: rgba(0, 0, 0, 0.62);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
}
.modal-card {
width: min(100%, 420px);
padding: 32px;
background: var(--bg-panel);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
box-shadow: var(--glass-shadow);
text-align: center;
}
.promotion-options {
display: flex;
justify-content: center;
gap: 16px;
margin-top: 24px;
}
.promotion-options button {
padding: 16px;
background: rgba(0, 0, 0, 0.25);
border: 1px solid var(--border-subtle);
color: #fff;
font-size: 32px;
}
.promotion-options button:hover {
background: var(--primary);
border-color: var(--primary);
}
/* =========================================================
TOAST
========================================================= */
.toast-host {
position: fixed;
right: 20px;
bottom: 20px;
z-index: 9999;
display: flex;
flex-direction: column;
gap: 10px;
max-width: min(420px, calc(100vw - 40px));
}
.toast {
padding: 12px 20px;
background: var(--bg-panel);
border: 1px solid var(--border-subtle);
border-radius: var(--radius-md);
color: var(--text-main);
font-size: 14px;
font-weight: 500;
box-shadow:
0 4px 12px rgba(0, 0, 0, 0.25);
animation: slide-up 0.25s ease-out;
}
.toast.success {
border-color: var(--primary);
}
.toast.error {
border-color: var(--danger);
}
@keyframes slide-up {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* =========================================================
FOOTER
========================================================= */
.site-footer {
margin-top: 28px;
padding: 22px 8px 8px;
border-top: 1px solid var(--border-subtle);
display: flex;
justify-content: center;
}
.repository-link {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
color: var(--text-muted);
text-decoration: none;
border-radius: var(--radius-md);
transition:
color 0.16s ease,
background-color 0.16s ease,
transform 0.16s ease;
}
.repository-link:hover {
color: var(--text-main);
background: var(--secondary);
transform: translateY(-1px);
}
.repository-logo {
display: block;
width: 34px;
height: 34px;
object-fit: contain;
border-radius: 7px;
}
.repository-name {
font-size: 13px;
font-weight: 600;
}
/* =========================================================
RESPONSIVE
========================================================= */
@media (max-width: 960px) {
body {
padding: 14px;
}
.app-grid {
grid-template-columns: 1fr;
}
.board-toolbar {
flex-direction: column;
align-items: stretch;
}
.toolbar-actions {
width: 100%;
}
.toolbar-actions button {
flex: 1;
}
}
@media (max-width: 600px) {
body {
padding: 10px;
}
.main-header {
margin-bottom: 16px;
}
.main-header h1 {
font-size: 24px;
}
.chess-icon {
font-size: 28px;
}
.panel {
padding: 16px;
}
.app-grid {
gap: 14px;
}
.board-stage {
padding: 6px;
}
.board {
border-width: 3px;
}
.piece {
font-size: clamp(25px, 11vw, 50px);
}
.status-strip {
flex-direction: column;
align-items: stretch;
}
.status-meta {
justify-content: flex-start;
}
.field-grid {
grid-template-columns: 1fr;
gap: 0;
}
.toolbar-actions {
display: grid;
grid-template-columns: 1fr 1fr;
}
#copyInviteButton {
grid-column: span 2;
}
.join-row {
flex-direction: column;
}
.toast-host {
right: 10px;
bottom: 10px;
max-width: calc(100vw - 20px);
}
}
@media (max-width: 380px) {
.panel {
padding: 12px;
}
.toolbar-actions {
grid-template-columns: 1fr;
}
#copyInviteButton {
grid-column: auto;
}
.player-clock {
min-width: 70px;
font-size: 17px;
}
}
/* =========================================================
REDUCED MOTION
========================================================= */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* =========================================================
LOW POWER / TOUCH DEVICES
========================================================= */
@media (hover: none) {
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.repository-link:hover {
transform: none;
}
}