Files
tictactics/styles.css

311 lines
4.7 KiB
CSS

:root {
color-scheme: light;
--ink: #161616;
--muted: #62635f;
--paper: #f9f6ee;
--panel: #fffdfa;
--line: #252525;
--grid: #d9d1bf;
--x: #cb3d3d;
--o: #216e8d;
--x-soft: #ffe1df;
--o-soft: #d9f1f8;
--focus: #6750a4;
--shadow: 0 20px 50px rgba(30, 25, 15, 0.12);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
color: var(--ink);
background:
linear-gradient(rgba(22, 22, 22, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(22, 22, 22, 0.035) 1px, transparent 1px),
var(--paper);
background-size: 32px 32px;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
font: inherit;
}
.app {
width: min(1120px, calc(100vw - 32px));
min-height: 100vh;
margin: 0 auto;
display: grid;
grid-template-columns: minmax(0, 1fr) 320px;
gap: 28px;
align-items: center;
padding: 32px 0;
}
.play-area,
.side-panel {
background: rgba(255, 253, 250, 0.86);
border: 1px solid rgba(37, 37, 37, 0.12);
box-shadow: var(--shadow);
}
.play-area {
padding: 24px;
}
.side-panel {
padding: 18px;
}
.topbar,
.status-row,
.score-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.eyebrow {
margin: 0 0 4px;
color: var(--muted);
font-size: 0.78rem;
font-weight: 800;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(2.2rem, 4.8rem, 5rem);
line-height: 0.92;
}
.icon-button {
width: 44px;
height: 44px;
display: inline-grid;
place-items: center;
border: 2px solid var(--line);
border-radius: 8px;
color: var(--ink);
background: var(--panel);
cursor: pointer;
transition: transform 150ms ease, background 150ms ease;
}
.icon-button:hover {
background: #eee6d6;
transform: translateY(-1px);
}
.icon-button:focus-visible,
.cell:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 3px;
}
.status-row {
margin: 24px 0 18px;
}
.turn-badge {
min-width: 104px;
padding: 9px 12px;
border: 2px solid currentColor;
border-radius: 8px;
font-weight: 900;
text-align: center;
}
.player-x {
color: var(--x);
background: var(--x-soft);
}
.player-o {
color: var(--o);
background: var(--o-soft);
}
.message {
color: var(--muted);
font-size: 0.95rem;
text-align: right;
}
.board {
aspect-ratio: 1;
width: min(100%, 620px);
margin: 0 auto;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(5, 1fr);
border: 3px solid var(--line);
background: var(--line);
gap: 3px;
}
.cell {
min-width: 0;
border: 0;
display: grid;
place-items: center;
background: var(--panel);
color: var(--ink);
cursor: pointer;
position: relative;
isolation: isolate;
}
.cell::before {
content: "";
position: absolute;
inset: 13%;
border: 2px dashed rgba(37, 37, 37, 0.14);
border-radius: 50%;
opacity: 0;
transition: opacity 120ms ease;
}
.cell:hover::before {
opacity: 1;
}
.cell[disabled] {
cursor: default;
}
.mark {
display: grid;
place-items: center;
width: 72%;
height: 72%;
border-radius: 50%;
font-size: clamp(2rem, 8vw, 4.4rem);
font-weight: 950;
line-height: 1;
transform: scale(0.96);
animation: pop 180ms ease-out;
}
.mark-x {
color: var(--x);
}
.mark-o {
color: var(--o);
}
.cell.captured {
animation: capture 360ms ease-out;
}
.cell.winning {
background: #fff0aa;
}
.score-row {
margin-bottom: 16px;
}
.score-box {
flex: 1;
padding: 14px;
border: 1px solid rgba(37, 37, 37, 0.14);
border-radius: 8px;
background: var(--panel);
}
.score-label {
display: block;
color: var(--muted);
font-size: 0.76rem;
font-weight: 800;
text-transform: uppercase;
}
.score-box strong {
display: block;
margin-top: 4px;
font-size: 2rem;
}
.rule-card {
padding: 14px;
border: 1px solid rgba(37, 37, 37, 0.14);
border-radius: 8px;
background: #f5efe2;
}
.rule-card h2 {
margin: 0 0 8px;
font-size: 1rem;
}
.rule-card p {
margin: 0;
color: var(--muted);
line-height: 1.45;
}
.move-list {
max-height: 320px;
margin: 16px 0 0;
padding: 0 0 0 24px;
overflow: auto;
color: var(--muted);
}
.move-list li {
margin-bottom: 8px;
padding-left: 4px;
}
@keyframes pop {
from {
opacity: 0;
transform: scale(0.66);
}
}
@keyframes capture {
35% {
background: #202020;
}
}
@media (max-width: 860px) {
.app {
min-height: auto;
grid-template-columns: 1fr;
align-items: start;
padding: 18px 0;
}
.play-area,
.side-panel {
padding: 16px;
}
.status-row {
align-items: flex-start;
flex-direction: column;
}
.message {
text-align: left;
}
h1 {
font-size: 3rem;
}
.move-list {
max-height: 180px;
}
}