You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tank-battle/src/styles.css

368 lines
6.4 KiB

:root {
color-scheme: dark;
--bg: #11150f;
--panel: #1d2319;
--panel-strong: #262d20;
--line: #48533b;
--line-bright: #879365;
--text: #f1f3dc;
--muted: #b4ba9b;
--olive: #8da04f;
--amber: #f0b646;
--danger: #d45d45;
--shadow: rgba(0, 0, 0, 0.45);
--radius: 8px;
}
* {
box-sizing: border-box;
}
html {
min-height: 100%;
background:
radial-gradient(circle at 20% 10%, rgba(141, 160, 79, 0.18), transparent 28rem),
linear-gradient(135deg, #161b13, #0c0f0b 70%);
}
body {
min-height: 100vh;
margin: 0;
color: var(--text);
font-family:
"Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
letter-spacing: 0;
}
button,
canvas,
kbd {
font: inherit;
}
button {
min-width: 0;
min-height: 44px;
border: 1px solid #c6d87b;
border-radius: 6px;
padding: 0.72rem 1rem;
background: linear-gradient(180deg, #a0b85a, #617434);
color: #10150d;
cursor: pointer;
font-weight: 900;
line-height: 1.1;
white-space: nowrap;
box-shadow: 0 8px 18px var(--shadow);
}
.secondary-action {
border-color: var(--line-bright);
background: #27301f;
color: var(--text);
}
.danger-action {
border-color: #f09d7e;
background: linear-gradient(180deg, #dc6d50, #883925);
color: var(--text);
}
button:focus-visible {
outline: 3px solid rgba(240, 182, 70, 0.65);
outline-offset: 2px;
}
.shell {
width: min(980px, calc(100vw - 32px));
min-height: 100vh;
margin: 0 auto;
padding: 18px 0;
display: grid;
place-items: center;
}
.game-panel {
width: 100%;
display: grid;
gap: 14px;
}
.topbar {
display: grid;
grid-template-columns: minmax(220px, 1fr) minmax(420px, 620px);
gap: 12px;
align-items: stretch;
}
.brand,
.hud-item,
.controls div {
border: 1px solid var(--line);
border-radius: var(--radius);
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
var(--panel);
box-shadow: 0 16px 36px var(--shadow);
}
.brand {
min-width: 0;
padding: 12px;
display: flex;
gap: 12px;
align-items: center;
}
.rank-mark {
width: 38px;
aspect-ratio: 1;
flex: 0 0 auto;
background:
linear-gradient(90deg, transparent 42%, #11150f 42% 58%, transparent 58%),
linear-gradient(#a0b85a 0 0) center / 100% 32% no-repeat,
#53672f;
border: 2px solid #c6d87b;
clip-path: polygon(50% 0, 100% 28%, 82% 100%, 18% 100%, 0 28%);
}
.eyebrow,
.status-label {
margin: 0;
color: var(--amber);
font-size: 0.78rem;
font-weight: 900;
letter-spacing: 0;
text-transform: uppercase;
}
h1,
h2,
p {
margin: 0;
}
h1 {
font-size: clamp(1.6rem, 4vw, 3rem);
line-height: 1;
}
.hud {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px;
}
.hud-item {
min-height: 70px;
padding: 10px 12px;
}
.hud-item span {
display: block;
color: var(--muted);
font-size: 0.76rem;
font-weight: 800;
text-transform: uppercase;
}
.hud-item strong {
display: block;
margin-top: 4px;
color: var(--amber);
font-family: Consolas, "Courier New", monospace;
font-size: clamp(1.3rem, 2.5vw, 2rem);
font-weight: 900;
line-height: 1;
overflow-wrap: anywhere;
}
.status-chip {
min-height: 70px;
border: 1px solid #d6c06c;
border-radius: var(--radius);
padding: 10px 12px;
display: grid;
place-items: center;
background: linear-gradient(180deg, #f0b646, #b9842a);
color: #10150d;
font-weight: 900;
text-align: center;
box-shadow: 0 16px 36px var(--shadow);
}
.stage-wrap {
position: relative;
width: 100%;
aspect-ratio: 4 / 3;
margin: 0 auto;
min-height: 280px;
overflow: hidden;
border: 2px solid var(--line-bright);
border-radius: var(--radius);
background:
linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
#0b0e0a;
box-shadow: inset 0 0 0 4px #171d13, 0 18px 42px var(--shadow);
}
canvas {
display: block;
width: 100%;
height: 100%;
image-rendering: pixelated;
}
.overlay {
position: absolute;
inset: 0;
z-index: 4;
display: grid;
place-items: center;
padding: 18px;
background: rgba(7, 9, 7, 0.72);
backdrop-filter: blur(2px);
}
.overlay.is-hidden {
display: none;
}
.overlay-content {
width: min(420px, 100%);
border: 1px solid var(--line-bright);
border-radius: var(--radius);
padding: clamp(18px, 4vw, 30px);
text-align: center;
background:
linear-gradient(180deg, rgba(240, 182, 70, 0.1), transparent 42%),
#181e14;
box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
}
.overlay-content h2 {
margin-top: 6px;
font-size: clamp(1.75rem, 5vw, 3rem);
line-height: 1;
}
#statusText {
margin-top: 12px;
color: var(--muted);
line-height: 1.55;
}
.overlay-actions {
margin-top: 18px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
}
.overlay-actions button {
width: min(180px, 100%);
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 8px;
color: var(--muted);
}
.controls div {
min-height: 38px;
padding: 7px 10px;
display: flex;
align-items: center;
gap: 7px;
}
.controls .action-group {
width: 100%;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
}
.controls .action-group button {
width: 100%;
padding-inline: 0.6rem;
}
kbd {
min-width: 30px;
min-height: 28px;
display: inline-grid;
place-items: center;
border: 1px solid #727b5a;
border-bottom-width: 3px;
border-radius: 4px;
padding: 0 7px;
background: #10150d;
color: var(--text);
font-family: Consolas, "Courier New", monospace;
font-size: 0.78rem;
font-weight: 900;
}
@media (max-width: 880px) {
.shell {
width: min(100vw - 20px, 760px);
padding: 10px 0;
place-items: start center;
}
.topbar {
grid-template-columns: 1fr;
}
.stage-wrap {
max-height: none;
}
}
@media (max-width: 560px) {
.hud {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.brand {
align-items: flex-start;
}
.rank-mark {
width: 32px;
}
.hud-item {
min-height: 62px;
padding: 8px;
}
.status-chip {
min-height: 52px;
}
.controls {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.controls div {
width: auto;
min-width: 0;
}
.controls .action-group {
grid-column: 1 / -1;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
button {
max-width: 100%;
padding-inline: 0.5rem;
}
}