semi working darkmode

This commit is contained in:
2025-08-16 21:44:29 +02:00
parent 68b7b81741
commit 57a7b0e68f
7 changed files with 928 additions and 456 deletions

View File

@@ -1,24 +1,47 @@
:root {
--bg: #f6f8fb;
--card: #fff;
--text: #0f172a;
--muted: #6b7280;
--accent: #2563eb;
--border: #e5e7eb;
--hover: #f3f4f6;
--shadow: 0 4px 12px rgba(16, 24, 40, 0.06);
--radius: 8px;
--mono: 'JetBrains Mono', monospace;
--mono: "JetBrains Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
/* Dark mode variables */
html.dark {
--bg: #0f172a;
--card: #1e293b;
--text: #f1f5f9;
--muted: #94a3b8;
--accent: #3b82f6;
--border: #334155;
--hover: #334155;
--shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
font-family: Inter, sans-serif;
background: var(--bg);
color: #0f172a;
color: var(--text);
padding: 16px;
display: flex;
justify-content: center;
align-items: center;
transition:
background-color 0.3s ease,
color 0.3s ease;
}
.wrap {
width: 100%;
@@ -27,15 +50,49 @@ body {
header {
margin-bottom: 14px;
}
.header-content {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
header h1 {
text-align: center;
font-size: 1.6rem;
color: #111827;
color: var(--text);
}
header p {
color: var(--muted);
font-size: 0.9rem;
}
.dark-mode-toggle {
position: absolute;
right: 0;
background: none;
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 6px 10px;
cursor: pointer;
color: var(--text);
font-size: 1.2rem;
transition: all 0.3s ease;
}
.dark-mode-toggle:hover {
background: var(--hover);
transform: scale(1.05);
}
html.dark .dark-mode-icon::before {
content: "☀️";
}
html:not(.dark) .dark-mode-icon::before {
content: "🌙";
}
.dark-mode-icon {
display: inline-block;
}
.dark-mode-icon::before {
font-size: 1em;
}
.content {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -59,32 +116,53 @@ header p {
.search-input {
flex: 1;
padding: 6px 10px;
border: 1px solid #e5e7eb;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 0.9rem;
background: var(--card);
color: var(--text);
transition: border-color 0.3s ease;
}
.search-input:focus {
outline: none;
border-color: var(--accent);
}
.filter-select {
padding: 6px 8px;
border: 1px solid #e5e7eb;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 0.9rem;
background: white;
background: var(--card);
color: var(--text);
transition: border-color 0.3s ease;
}
.filter-select:focus {
outline: none;
border-color: var(--accent);
}
/* Problems list */
.problems-list .problem-item {
padding: 8px;
border-bottom: 1px solid #e5e7eb;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
transition: background-color 0.3s ease;
}
.problem-item:hover {
background: var(--hover);
}
.problem-item:last-child {
border-bottom: none;
}
.problem-item a {
text-decoration: none;
color: #0077ff;
color: var(--accent);
font-weight: 600;
transition: color 0.3s ease;
}
.problem-item a:hover {
text-decoration: underline;
}
/* Difficulty badge */
.difficulty {
@@ -99,14 +177,14 @@ header p {
white-space: nowrap;
}
.difficulty[data-difficulty="easy"] {
background-color: #4CAF50; /* Green */
background-color: #4caf50; /* Green */
}
.difficulty[data-difficulty="medium"] {
background-color: #FFC107; /* Amber */
background-color: #ffc107; /* Amber */
color: #333;
}
.difficulty[data-difficulty="hard"] {
background-color: #F44336; /* Red */
background-color: #f44336; /* Red */
}
/* Leaderboard */
.leaderboard-head {
@@ -128,16 +206,16 @@ header p {
.leaderboard-table th,
.leaderboard-table td {
padding: 6px 8px;
border-bottom: 1px solid #e5e7eb;
border-bottom: 1px solid var(--border);
text-align: left;
}
.leaderboard-table th {
background: #f9fafb;
background: var(--hover);
font-weight: 600;
color: var(--muted);
}
.leaderboard-table tr:hover {
background: #f3f4f6;
background: var(--hover);
}
/* Sort indicators */
.sortable {
@@ -179,7 +257,9 @@ header p {
background: rgba(37, 99, 235, 0.15);
}
@media (max-width: 800px) {
.content { grid-template-columns: 1fr; }
.content {
grid-template-columns: 1fr;
}
.leaderboard-controls {
flex-direction: column;
}
@@ -187,21 +267,60 @@ header p {
/* Leaderboard horizontal collapse */
#leaderboardSection {
transition: max-width 0.35s ease, opacity 0.25s ease;
overflow: hidden;
max-width: 100%;
transition:
max-width 0.35s ease,
opacity 0.25s ease;
overflow: hidden;
max-width: 100%;
}
#leaderboardSection.hidden {
max-width: 0;
opacity: 0;
pointer-events: none;
max-width: 0;
opacity: 0;
pointer-events: none;
}
#leaderboardSection.visible {
max-width: 100%; /* take full available space in grid column */
opacity: 1;
max-width: 100%; /* take full available space in grid column */
opacity: 1;
}
#rankingExplanation {
transition: all 0.35s ease;
}
/* Pagination Controls */
.pagination-controls {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.pagination-btn {
background: var(--card);
border: 1px solid var(--border);
border-radius: 4px;
padding: 6px 12px;
cursor: pointer;
color: var(--text);
font-size: 0.9rem;
transition: all 0.3s ease;
}
.pagination-btn:hover:not(:disabled) {
background: var(--hover);
border-color: var(--accent);
}
.pagination-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.pagination-info {
color: var(--muted);
font-size: 0.9rem;
}
/* Hide pagination when not needed */
.pagination-controls.hidden {
display: none;
}