radical-chess/public/style.css
maverick 4f2676df1e Radical Chess — real-time online chess on Cloudflare
Play by shareable link, vs the Radical Bot, or pass-and-play. Server-authoritative
moves (chess.js) in a per-game Durable Object, clocks with idle flag-fall via DO
alarms, draw/resign/rematch/chat, D1 game archive, custom board UI (drag + click).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 21:29:02 +10:00

196 lines
10 KiB
CSS

:root {
--red: #FF2D55;
--red-hot: #FF6B82;
--red-deep: #c81e3a;
--bg: #0B0B09;
--raised: #12100d;
--raised-2: #1b1813;
--cream: #F0EDE6;
--muted: #9c948a;
--gold: #c9a84c;
--line: #2a2620;
--light-sq: #ece5d6;
--dark-sq: #7a6a55;
--sel: #ff2d5566;
--last: #c9a84c55;
--check: #ff2d5599;
--ok: #4caf7d;
--mono: 'IBM Plex Mono', ui-monospace, monospace;
--display: 'Syne', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
background: radial-gradient(1200px 600px at 70% -10%, #17140f 0%, var(--bg) 55%);
color: var(--cream);
font-family: system-ui, 'Segoe UI', Inter, sans-serif;
min-height: 100%;
display: flex;
flex-direction: column;
-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
/* ---------- top bar ---------- */
.topbar {
display: flex; align-items: center; justify-content: space-between;
padding: 14px 22px; border-bottom: 1px solid var(--line);
background: rgba(11,11,9,.7); backdrop-filter: blur(8px);
position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 26px; color: var(--red); filter: drop-shadow(0 0 10px #ff2d5566); }
.brand-word { font-family: var(--display); font-weight: 800; letter-spacing: .5px; font-size: 19px; }
.brand-accent { color: var(--red); }
.topnav { display: flex; gap: 18px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.topnav a:hover { color: var(--cream); }
main { flex: 1; width: 100%; }
.footsig { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; font-family: var(--mono); }
.footsig a { color: var(--gold); }
/* ---------- home ---------- */
.home { max-width: 1000px; margin: 0 auto; padding: 40px 22px 60px; }
.hero { text-align: center; margin-bottom: 38px; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 62px); line-height: 1; }
.hero h1 .g { color: var(--red); }
.hero p { color: var(--muted); margin-top: 14px; font-size: 16px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.card {
background: linear-gradient(180deg, var(--raised) 0%, var(--raised-2) 100%);
border: 1px solid var(--line); border-radius: 16px; padding: 22px;
}
.card h2 { font-family: var(--display); font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.tc {
border: 1px solid var(--line); background: #0e0c08; border-radius: 10px;
padding: 12px 6px; text-align: center; cursor: pointer; transition: .12s;
}
.tc:hover { border-color: var(--red); }
.tc.on { border-color: var(--red); background: #1a0d10; box-shadow: 0 0 0 1px var(--red) inset; }
.tc b { display: block; font-family: var(--mono); font-weight: 700; font-size: 18px; }
.tc span { color: var(--muted); font-size: 11px; }
.btn {
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
font-family: var(--display); font-weight: 700; font-size: 15px;
padding: 13px 18px; border-radius: 12px; border: 1px solid transparent;
cursor: pointer; width: 100%; transition: .14s; background: var(--raised-2); color: var(--cream);
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, var(--red) 0%, var(--red-deep) 100%); color: #fff; box-shadow: 0 6px 22px #ff2d5533; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--red); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.seg button {
flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
background: #0e0c08; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 13px;
}
.seg button.on { color: #fff; border-color: var(--red); background: #1a0d10; }
.diff { display: flex; gap: 8px; margin-bottom: 14px; }
.diff button { flex: 1; padding: 9px; border-radius: 9px; border: 1px solid var(--line); background: #0e0c08; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 12px; }
.diff button.on { color: #fff; border-color: var(--gold); }
/* ---------- game layout ---------- */
.game-wrap { max-width: 1120px; margin: 0 auto; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.board-col { display: flex; flex-direction: column; gap: 10px; }
.playerbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.pname { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pdot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.clock {
font-family: var(--mono); font-weight: 700; font-size: 26px; letter-spacing: 1px;
background: #0e0c08; border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; min-width: 108px; text-align: center;
}
.clock.active { border-color: var(--red); color: #fff; box-shadow: 0 0 0 1px var(--red) inset; }
.clock.low { color: var(--red-hot); }
/* board */
.board {
width: min(72vh, 100%); aspect-ratio: 1; margin: 0 auto;
display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
box-shadow: 0 18px 60px rgba(0,0,0,.5); touch-action: none; user-select: none;
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.light { background: var(--light-sq); }
.sq.dark { background: var(--dark-sq); }
.sq.last::after { content: ''; position: absolute; inset: 0; background: var(--last); }
.sq.sel::after { content: ''; position: absolute; inset: 0; background: var(--sel); }
.sq.check .piece { filter: drop-shadow(0 0 6px var(--red)); }
.sq .coord { position: absolute; font-size: 10px; font-family: var(--mono); opacity: .5; }
.sq .coord.file { bottom: 2px; right: 3px; }
.sq .coord.rank { top: 2px; left: 3px; }
.sq.light .coord { color: #6b5c46; }
.sq.dark .coord { color: #e6dcc8; }
.piece {
font-size: min(9vh, 12vw); line-height: 1; cursor: grab; z-index: 2;
position: relative; width: 100%; height: 100%;
display: flex; align-items: center; justify-content: center;
}
.piece.dragging { cursor: grabbing; opacity: .35; }
.piece.w { color: #f7f4ec; text-shadow: 0 1px 0 #0007, 0 0 1px #000, 1px 0 0 #0006, -1px 0 0 #0006, 0 2px 4px #0009; }
.piece.b { color: #1a1712; text-shadow: 0 1px 0 #fff5, 0 2px 4px #0008; }
.hint { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: #0003; z-index: 1; }
.sq.light .hint { background: #7a6a5555; }
.hint.cap { width: 100%; height: 100%; background: none; border-radius: 0; box-shadow: inset 0 0 0 6px #0002; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 100; transform: translate(-50%, -50%); }
/* promotion */
.promo { position: absolute; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 40; }
.promo-inner { display: flex; gap: 8px; background: var(--raised); padding: 14px; border-radius: 12px; border: 1px solid var(--red); }
.promo-inner .piece { font-size: 44px; cursor: pointer; width: 56px; height: 56px; border-radius: 8px; }
.promo-inner .piece:hover { background: #1a0d10; }
/* side panel */
.side { display: flex; flex-direction: column; gap: 16px; }
.box { background: var(--raised); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.box h3 { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 12px 14px 0; }
.status-msg { padding: 12px 14px; font-family: var(--display); font-weight: 700; }
.status-msg .reason { font-family: system-ui; font-weight: 400; color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
.moves { max-height: 260px; overflow-y: auto; padding: 10px 12px; font-family: var(--mono); font-size: 13px; line-height: 1.9; }
.moves .mv { display: inline-block; min-width: 62px; padding: 1px 5px; border-radius: 4px; cursor: default; }
.moves .num { color: var(--muted); display: inline-block; min-width: 26px; }
.moves .mv.cur { background: var(--red); color: #fff; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; }
.actions .btn.sm { width: 100%; }
.share { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.share .link { font-family: var(--mono); font-size: 12px; background: #0e0c08; border: 1px solid var(--line); border-radius: 8px; padding: 9px; word-break: break-all; color: var(--red-hot); }
.chat { display: flex; flex-direction: column; height: 220px; }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }
.chat-log .cm { line-height: 1.35; }
.chat-log .cm b { color: var(--gold); font-weight: 600; }
.chat-log .cm.w b { color: var(--cream); }
.chat-log .cm.b b { color: var(--muted); }
.chat-in { display: flex; border-top: 1px solid var(--line); }
.chat-in input { flex: 1; background: transparent; border: 0; color: var(--cream); padding: 11px 12px; font-family: var(--mono); font-size: 13px; outline: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--raised); border: 1px solid var(--red); color: var(--cream); padding: 12px 18px; border-radius: 12px; font-family: var(--mono); font-size: 13px; z-index: 80; box-shadow: 0 10px 30px #000a; }
.banner { background: #1a0d10; border: 1px solid var(--red); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* watch/list */
.list { max-width: 720px; margin: 0 auto; padding: 30px 22px; }
.list h1 { font-family: var(--display); font-weight: 800; font-size: 30px; margin-bottom: 18px; }
.grow-row { display: flex; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--raised); font-family: var(--mono); font-size: 13px; }
.grow-row .res { color: var(--gold); }
.empty { color: var(--muted); text-align: center; padding: 40px; font-family: var(--mono); }
@media (max-width: 900px) {
.game-wrap { grid-template-columns: 1fr; }
.board { width: min(94vw, 72vh); }
.side { order: 2; }
}