mirror of
https://github.com/tiennm99/loldle.git
synced 2026-09-10 14:20:16 +00:00
Vanilla JS web game with modular architecture: - data-loader: champion data fetching, seeded random selection - game-engine: mode-agnostic state machine with localStorage persistence - classic-mode: 7-attribute comparison logic (gender, genre, range, resource, region, lane, year) - ui-renderer: search autocomplete, colored feedback grid, stats display - Dark theme responsive UI with Data Dragon CDN champion images
404 lines
6.5 KiB
CSS
404 lines
6.5 KiB
CSS
/* LoLdle Classic — Dark theme, responsive grid */
|
|
|
|
:root {
|
|
--color-bg: #1a1a2e;
|
|
--color-surface: #16213e;
|
|
--color-surface-hover: #1a2745;
|
|
--color-text: #e0e0e0;
|
|
--color-text-muted: #8a8a9a;
|
|
--color-correct: #4ecb71;
|
|
--color-partial: #f4b35e;
|
|
--color-wrong: #d85b5b;
|
|
--color-header: #2a2a4a;
|
|
--color-input-bg: #0f3460;
|
|
--color-input-border: #533483;
|
|
--color-accent: #533483;
|
|
--radius: 8px;
|
|
--cell-size: 90px;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
|
|
background: var(--color-bg);
|
|
color: var(--color-text);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
/* Header */
|
|
.header {
|
|
text-align: center;
|
|
padding: 24px 16px 8px;
|
|
width: 100%;
|
|
max-width: 900px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 2rem;
|
|
font-weight: 700;
|
|
letter-spacing: 2px;
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.header h1 span {
|
|
color: var(--color-accent);
|
|
}
|
|
|
|
/* Mode toggle */
|
|
.mode-toggle {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 4px;
|
|
margin: 12px 0 16px;
|
|
background: var(--color-surface);
|
|
border-radius: var(--radius);
|
|
padding: 4px;
|
|
width: fit-content;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
|
|
.mode-btn {
|
|
padding: 8px 20px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
background: transparent;
|
|
color: var(--color-text-muted);
|
|
cursor: pointer;
|
|
font-size: 0.9rem;
|
|
font-weight: 500;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.mode-btn.active {
|
|
background: var(--color-accent);
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.mode-btn:hover:not(.active) {
|
|
color: var(--color-text);
|
|
background: var(--color-surface-hover);
|
|
}
|
|
|
|
/* Search */
|
|
.search-container {
|
|
position: relative;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
margin: 0 auto 20px;
|
|
padding: 0 16px;
|
|
}
|
|
|
|
#search-input {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
border: 2px solid var(--color-input-border);
|
|
border-radius: var(--radius);
|
|
background: var(--color-input-bg);
|
|
color: var(--color-text);
|
|
font-size: 1rem;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
#search-input:focus {
|
|
border-color: var(--color-accent);
|
|
}
|
|
|
|
#search-input:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
#search-input::placeholder {
|
|
color: var(--color-text-muted);
|
|
}
|
|
|
|
#search-dropdown {
|
|
position: absolute;
|
|
top: 100%;
|
|
left: 16px;
|
|
right: 16px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-input-border);
|
|
border-radius: 0 0 var(--radius) var(--radius);
|
|
max-height: 320px;
|
|
overflow-y: auto;
|
|
z-index: 100;
|
|
display: none;
|
|
}
|
|
|
|
#search-dropdown.visible {
|
|
display: block;
|
|
}
|
|
|
|
.dropdown-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 8px 12px;
|
|
cursor: pointer;
|
|
transition: background 0.15s;
|
|
}
|
|
|
|
.dropdown-item:hover,
|
|
.dropdown-item.active {
|
|
background: var(--color-surface-hover);
|
|
}
|
|
|
|
.dropdown-item img {
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 4px;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.dropdown-item span {
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
/* Guess counter */
|
|
.guess-counter {
|
|
text-align: center;
|
|
color: var(--color-text-muted);
|
|
font-size: 0.9rem;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
/* Grid */
|
|
.grid-container {
|
|
width: 100%;
|
|
max-width: 900px;
|
|
padding: 0 16px;
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.guess-row {
|
|
display: grid;
|
|
grid-template-columns: 130px repeat(7, var(--cell-size));
|
|
gap: 4px;
|
|
margin-bottom: 4px;
|
|
min-width: fit-content;
|
|
}
|
|
|
|
.guess-cell {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
padding: 8px 4px;
|
|
border-radius: 4px;
|
|
font-size: 0.8rem;
|
|
font-weight: 500;
|
|
min-height: 56px;
|
|
word-break: break-word;
|
|
animation: cellReveal 0.3s ease forwards;
|
|
opacity: 0;
|
|
}
|
|
|
|
/* Header row */
|
|
.header-row {
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.header-cell {
|
|
background: var(--color-header);
|
|
color: var(--color-text-muted);
|
|
font-weight: 600;
|
|
font-size: 0.75rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
opacity: 1;
|
|
animation: none;
|
|
}
|
|
|
|
/* Champion cell */
|
|
.champion-cell {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
justify-content: flex-start;
|
|
padding-left: 8px;
|
|
background: var(--color-surface);
|
|
}
|
|
|
|
.champion-cell img {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 4px;
|
|
object-fit: cover;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.champion-cell span {
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* Result colors */
|
|
.cell-correct {
|
|
background: var(--color-correct);
|
|
color: #1a1a2e;
|
|
}
|
|
|
|
.cell-partial {
|
|
background: var(--color-partial);
|
|
color: #1a1a2e;
|
|
}
|
|
|
|
.cell-wrong {
|
|
background: var(--color-wrong);
|
|
color: #fff;
|
|
}
|
|
|
|
/* Direction arrow */
|
|
.direction-arrow {
|
|
font-weight: 700;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
/* Cell animation */
|
|
@keyframes cellReveal {
|
|
from {
|
|
opacity: 0;
|
|
transform: scale(0.8);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: scale(1);
|
|
}
|
|
}
|
|
|
|
/* Game over */
|
|
.game-over {
|
|
text-align: center;
|
|
padding: 24px 16px;
|
|
margin: 16px auto;
|
|
max-width: 400px;
|
|
}
|
|
|
|
.game-over h2 {
|
|
font-size: 1.5rem;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.game-over.won h2 {
|
|
color: var(--color-correct);
|
|
}
|
|
|
|
.game-over.lost h2 {
|
|
color: var(--color-wrong);
|
|
}
|
|
|
|
.game-over p {
|
|
color: var(--color-text-muted);
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.game-over strong {
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.reveal-image {
|
|
width: 80px;
|
|
height: 80px;
|
|
border-radius: var(--radius);
|
|
object-fit: cover;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
/* New game button (unlimited) */
|
|
.new-game-btn {
|
|
display: inline-block;
|
|
margin-top: 16px;
|
|
padding: 10px 24px;
|
|
border: none;
|
|
border-radius: var(--radius);
|
|
background: var(--color-accent);
|
|
color: var(--color-text);
|
|
font-size: 0.95rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.new-game-btn:hover {
|
|
opacity: 0.85;
|
|
}
|
|
|
|
/* Stats */
|
|
.stats {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 24px;
|
|
padding: 12px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 1.3rem;
|
|
font-weight: 700;
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 0.7rem;
|
|
color: var(--color-text-muted);
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
:root {
|
|
--cell-size: 72px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.guess-row {
|
|
grid-template-columns: 100px repeat(7, var(--cell-size));
|
|
}
|
|
|
|
.guess-cell {
|
|
font-size: 0.7rem;
|
|
min-height: 48px;
|
|
padding: 6px 2px;
|
|
}
|
|
|
|
.champion-cell img {
|
|
width: 32px;
|
|
height: 32px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
:root {
|
|
--cell-size: 60px;
|
|
}
|
|
|
|
.guess-row {
|
|
grid-template-columns: 80px repeat(7, var(--cell-size));
|
|
}
|
|
|
|
.champion-cell span {
|
|
font-size: 0.65rem;
|
|
}
|
|
}
|