Merge pull request 'niklas' (#2) from niklas into master

Reviewed-on: #2
This commit is contained in:
Luca Jakob 2026-05-31 18:24:01 +02:00
commit ba05fb6298
22 changed files with 1889 additions and 2078 deletions

View File

@ -1,92 +0,0 @@
[
{
"name": "Switzerland",
"hint": "Alpine country in Central Europe",
"cities": [
{ "name": "Bern", "x": 48, "y": 58 },
{ "name": "Zürich", "x": 58, "y": 38 },
{ "name": "Geneva", "x": 22, "y": 72 }
]
},
{
"name": "Norway",
"hint": "Scandinavian country with long coastline",
"cities": [
{ "name": "Oslo", "x": 55, "y": 72 },
{ "name": "Bergen", "x": 32, "y": 60 },
{ "name": "Tromsø", "x": 62, "y": 18 }
]
},
{
"name": "Italy",
"hint": "Boot-shaped peninsula in Southern Europe",
"cities": [
{ "name": "Rome", "x": 52, "y": 58 },
{ "name": "Milan", "x": 42, "y": 22 },
{ "name": "Naples", "x": 58, "y": 72 }
]
},
{
"name": "Japan",
"hint": "Island nation in East Asia",
"cities": [
{ "name": "Tokyo", "x": 72, "y": 48 },
{ "name": "Osaka", "x": 58, "y": 58 },
{ "name": "Sapporo", "x": 70, "y": 22 }
]
},
{
"name": "Brazil",
"hint": "Largest country in South America",
"cities": [
{ "name": "Brasília", "x": 58, "y": 52 },
{ "name": "São Paulo", "x": 60, "y": 68 },
{ "name": "Manaus", "x": 38, "y": 38 }
]
},
{
"name": "Australia",
"hint": "Continent and country in the Southern Hemisphere",
"cities": [
{ "name": "Canberra", "x": 72, "y": 72 },
{ "name": "Sydney", "x": 78, "y": 68 },
{ "name": "Perth", "x": 22, "y": 65 }
]
},
{
"name": "France",
"hint": "Country in Western Europe, hexagonal shape",
"cities": [
{ "name": "Paris", "x": 50, "y": 32 },
{ "name": "Lyon", "x": 58, "y": 55 },
{ "name": "Marseille", "x": 58, "y": 72 }
]
},
{
"name": "India",
"hint": "Large peninsula in South Asia",
"cities": [
{ "name": "New Delhi", "x": 46, "y": 28 },
{ "name": "Mumbai", "x": 32, "y": 55 },
{ "name": "Chennai", "x": 52, "y": 72 }
]
},
{
"name": "Canada",
"hint": "Second largest country in the world",
"cities": [
{ "name": "Ottawa", "x": 62, "y": 52 },
{ "name": "Vancouver", "x": 22, "y": 55 },
{ "name": "Toronto", "x": 60, "y": 58 }
]
},
{
"name": "Germany",
"hint": "Central European country",
"cities": [
{ "name": "Berlin", "x": 58, "y": 28 },
{ "name": "Munich", "x": 48, "y": 68 },
{ "name": "Hamburg", "x": 42, "y": 18 }
]
}
]

View File

@ -8,13 +8,16 @@
<link rel="stylesheet" href="./styles/game.css" /> <link rel="stylesheet" href="./styles/game.css" />
</head> </head>
<body> <body>
<noscript>
<p class="noscript-msg">GeoDraw requires JavaScript. Please enable it in your browser settings.</p>
</noscript>
<div class="wrap"> <div class="wrap">
<header class="header"> <header class="header">
<div class="container header__inner"> <div class="container header__inner">
<a href="./index.html" class="logo"> <a href="./index.html" class="logo">
<div class="logo__mark"> <div class="logo__mark">
<svg viewBox="0 0 24 24" fill="none"> <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/> <circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/>
<path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/> <path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/>
<path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/> <path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/>
@ -22,7 +25,7 @@
</div> </div>
<span class="logo__text">GeoDraw</span> <span class="logo__text">GeoDraw</span>
</a> </a>
<nav class="nav"> <nav class="nav" aria-label="Main navigation">
<a href="lobby.html" class="nav__link">← Back to lobby</a> <a href="lobby.html" class="nav__link">← Back to lobby</a>
</nav> </nav>
</div> </div>
@ -63,7 +66,7 @@
<div class="canvas-area"> <div class="canvas-area">
<div class="canvas-wrap" id="canvas-wrap"> <div class="canvas-wrap" id="canvas-wrap">
<canvas id="draw-canvas"></canvas> <canvas id="draw-canvas" role="application" aria-label="Drawing canvas sketch the country border here"></canvas>
<div id="score-feedback"></div> <div id="score-feedback"></div>
</div> </div>
@ -105,7 +108,7 @@
<!-- ── Controls ── --> <!-- ── Controls ── -->
<div class="game-controls"> <div class="game-controls">
<button id="btn-clear" class="btn btn--ghost btn--sm"> <button id="btn-clear" class="btn btn--ghost btn--sm">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"> <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
<path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/> <path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
</svg> </svg>
Clear Clear

View File

@ -4,18 +4,19 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GeoDraw</title> <title>GeoDraw</title>
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="stylesheet" href="styles/main.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles/index.css" /> <link rel="stylesheet" href="styles/index.css" />
</head> </head>
<body> <body>
<noscript>
<p class="noscript-msg">GeoDraw requires JavaScript. Please enable it in your browser settings.</p>
</noscript>
<div class="wrap"> <div class="wrap">
<header class="header"> <header class="header">
<div class="container header__inner"> <div class="container header__inner">
<a href="#hero" class="logo"> <a href="#hero" class="logo">
<div class="logo__mark"> <div class="logo__mark">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/> <circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/>
<path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/> <path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/>
<path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/> <path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/>
@ -24,7 +25,7 @@
<span class="logo__text">GeoDraw</span> <span class="logo__text">GeoDraw</span>
</a> </a>
<nav class="nav"> <nav class="nav" aria-label="Main navigation">
<a href="#hero" class="nav__link">Play</a> <a href="#hero" class="nav__link">Play</a>
<a href="#about" class="nav__link">How to play</a> <a href="#about" class="nav__link">How to play</a>
<a href="#register" class="nav__cta">Login / Register</a> <a href="#register" class="nav__cta">Login / Register</a>
@ -53,7 +54,7 @@
<div class="hero__actions reveal reveal-delay-3"> <div class="hero__actions reveal reveal-delay-3">
<a href="#register" class="btn btn--primary"> <a href="#register" class="btn btn--primary">
Start Playing Start Playing
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
</a> </a>
<a href="#about" class="btn btn--ghost">How it works</a> <a href="#about" class="btn btn--ghost">How it works</a>
</div> </div>
@ -171,7 +172,7 @@
<button type="button" class="btn btn--primary btn--full" id="reg-btn"> <button type="button" class="btn btn--primary btn--full" id="reg-btn">
Create game Create game
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button> </button>
<p class="form-footer"><a href="#" style="color:var(--sea);font-weight:600;">Join a game instead</a></p> <p class="form-footer"><a href="#" style="color:var(--sea);font-weight:600;">Join a game instead</a></p>

View File

@ -6,16 +6,19 @@
<title>GeoDraw — Leaderboard</title> <title>GeoDraw — Leaderboard</title>
<link rel="stylesheet" href="./styles/main.css" /> <link rel="stylesheet" href="./styles/main.css" />
<link rel="stylesheet" href="./styles/leader.css" /> <link rel="stylesheet" href="./styles/leader.css" />
</head> </head>
<body> <body>
<noscript>
<p class="noscript-msg">GeoDraw requires JavaScript. Please enable it in your browser settings.</p>
</noscript>
<div class="wrap"> <div class="wrap">
<header class="header"> <header class="header">
<div class="container header__inner"> <div class="container header__inner">
<a href="index.html" class="logo"> <a href="index.html" class="logo">
<div class="logo__mark"> <div class="logo__mark">
<svg viewBox="0 0 24 24" fill="none"> <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/> <circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/>
<path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/> <path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/>
<path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/> <path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/>
@ -23,7 +26,7 @@
</div> </div>
<span class="logo__text">GeoDraw</span> <span class="logo__text">GeoDraw</span>
</a> </a>
<nav class="nav"> <nav class="nav" aria-label="Main navigation">
<a href="index.html" class="nav__link">Home</a> <a href="index.html" class="nav__link">Home</a>
<a href="lobby.html" class="nav__cta">Play again →</a> <a href="lobby.html" class="nav__cta">Play again →</a>
</nav> </nav>
@ -87,68 +90,6 @@
</div> </div>
<script src="scripts/storage.js"></script> <script src="scripts/storage.js"></script>
<script> <script src="scripts/leaderboard.js"></script>
document.addEventListener("DOMContentLoaded", () => {
const currentPlayer = Storage.getPlayerName();
const body = document.getElementById("lb-body");
function render() {
const board = Storage.getLeaderboard();
body.innerHTML = "";
if (!board.length) {
body.innerHTML = `
<div class="lb-empty">
<div class="lb-empty__icon">🏁</div>
<p class="lb-empty__text">No games played yet. Be the first on the board!</p>
<a href="lobby.html" class="btn btn--primary btn--sm">Play now →</a>
</div>`;
return;
}
const medals = ["🥇","🥈","🥉"];
const scoreClasses = ["gold","silver","bronze"];
board.forEach((entry, i) => {
const rank = i + 1;
const isYou = entry.name === currentPlayer;
const date = entry.date
? new Date(entry.date).toLocaleDateString("en-CH", { day:"2-digit", month:"short" })
: "—";
const rounds = (entry.scores || []).join(" · ") || "—";
const row = document.createElement("div");
row.className = `lb-row${rank <= 3 ? ` rank-${rank}` : ""}`;
row.style.animationDelay = `${i * 0.05}s`;
row.innerHTML = `
<span class="lb-rank">${rank <= 3 ? `<span class="lb-medal">${medals[rank-1]}</span>` : rank}</span>
<span class="lb-name${isYou ? " is-you" : ""}">${escHtml(entry.name)}</span>
<span class="lb-rounds hide-sm">${escHtml(rounds)}</span>
<span class="lb-date hide-sm">${date}</span>
<span class="lb-score${rank <= 3 ? " " + scoreClasses[rank-1] : ""}">${entry.totalScore}</span>
`;
body.appendChild(row);
});
// Your latest score bar
const latest = board.find(e => e.name === currentPlayer);
if (latest) {
document.getElementById("your-bar").style.display = "flex";
document.getElementById("your-bar-name").textContent = latest.name;
document.getElementById("your-bar-score").textContent = latest.totalScore;
}
}
function escHtml(str) {
return String(str)
.replace(/&/g,"&amp;")
.replace(/</g,"&lt;")
.replace(/>/g,"&gt;");
}
render();
});
</script>
</body> </body>
</html> </html>

View File

@ -8,13 +8,16 @@
<link rel="stylesheet" href="./styles/lobby.css" /> <link rel="stylesheet" href="./styles/lobby.css" />
</head> </head>
<body> <body>
<noscript>
<p class="noscript-msg">GeoDraw requires JavaScript. Please enable it in your browser settings.</p>
</noscript>
<div class="wrap"> <div class="wrap">
<header class="header"> <header class="header">
<div class="container header__inner"> <div class="container header__inner">
<a href="index.html" class="logo"> <a href="index.html" class="logo">
<div class="logo__mark"> <div class="logo__mark">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/> <circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/>
<path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/> <path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/>
<path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/> <path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/>
@ -22,7 +25,7 @@
</div> </div>
<span class="logo__text">GeoDraw</span> <span class="logo__text">GeoDraw</span>
</a> </a>
<nav class="nav"> <nav class="nav" aria-label="Main navigation">
<a href="index.html" class="nav__link">Home</a> <a href="index.html" class="nav__link">Home</a>
<a href="leaderboard.html" class="nav__link">Leaderboard</a> <a href="leaderboard.html" class="nav__link">Leaderboard</a>
</nav> </nav>
@ -80,7 +83,7 @@
<button id="btn-start" class="btn btn--primary btn--full"> <button id="btn-start" class="btn btn--primary btn--full">
Start Game Start Game
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/> <path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>
</button> </button>
@ -99,7 +102,7 @@
</div> </div>
<div class="footer__center"> <div class="footer__center">
<a href="html" class="footer__brand">GeoDraw</a> <a href="index.html" class="footer__brand">GeoDraw</a>
<p class="footer__sub">Browser geography game</p> <p class="footer__sub">Browser geography game</p>
</div> </div>

View File

@ -5,209 +5,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GeoDraw — Results</title> <title>GeoDraw — Results</title>
<link rel="stylesheet" href="styles/main.css" /> <link rel="stylesheet" href="styles/main.css" />
<style> <link rel="stylesheet" href="styles/results.css" />
.results-page {
min-height: calc(100vh - var(--hh));
display: grid;
place-items: center;
padding: 60px 0;
}
.results-inner {
width: 100%;
max-width: 680px;
display: grid;
gap: 24px;
}
.results-header {
text-align: center;
}
.results-emoji {
font-size: 3.5rem;
margin-bottom: 16px;
display: block;
animation: popIn .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes popIn {
from { transform: scale(0); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
.results-title {
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: clamp(2rem, 5vw, 3.4rem);
letter-spacing: -.03em;
line-height: 1.05;
margin-bottom: 8px;
}
.results-player {
font-size: 1rem;
color: var(--ink-soft);
}
.results-player strong { color: var(--ink); }
/* Total score */
.score-total-card {
background: linear-gradient(135deg, var(--sea) 0%, #159fd4 50%, var(--leaf) 100%);
border-radius: var(--r-xl);
padding: 36px 40px;
text-align: center;
color: var(--white);
box-shadow: 0 16px 40px rgba(26,127,196,.3);
animation: slideUp .5s .1s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideUp {
from { transform: translateY(30px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.score-total-label {
font-size: .78rem;
font-weight: 700;
letter-spacing: .1em;
text-transform: uppercase;
opacity: .78;
margin-bottom: 8px;
}
.score-total-num {
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: clamp(4rem, 10vw, 6rem);
line-height: 1;
letter-spacing: -.04em;
}
.score-total-max {
font-size: 1.4rem;
opacity: .6;
font-weight: 400;
}
.score-grade {
display: inline-block;
margin-top: 12px;
padding: 4px 18px;
border-radius: 999px;
background: rgba(255,255,255,.22);
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: 1.1rem;
letter-spacing: .04em;
}
/* Round breakdown */
.rounds-card {
background: var(--white);
border: 1px solid var(--line);
border-radius: var(--r-xl);
padding: 28px 32px;
box-shadow: var(--shadow-sm);
animation: slideUp .5s .2s cubic-bezier(.34,1.56,.64,1) both;
}
.rounds-card-title {
font-family: 'Syne', sans-serif;
font-weight: 700;
font-size: 1rem;
letter-spacing: -.01em;
margin-bottom: 20px;
color: var(--ink-soft);
}
.round-rows { display: grid; gap: 14px; }
.round-row {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 16px;
}
.round-row__label {
font-size: .82rem;
font-weight: 600;
color: var(--ink-soft);
white-space: nowrap;
}
.round-row__bar-wrap {
height: 8px;
background: var(--cream);
border-radius: 999px;
overflow: hidden;
}
.round-row__bar {
height: 100%;
border-radius: 999px;
background: linear-gradient(90deg, var(--sea), var(--leaf));
transition: width .8s cubic-bezier(.34,1.56,.64,1);
}
.round-row__score {
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: .9rem;
color: var(--sea);
min-width: 36px;
text-align: right;
}
/* Country list */
.countries-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.country-tag {
padding: 5px 12px;
border-radius: 999px;
background: var(--sea-dim);
color: var(--sea);
font-size: .8rem;
font-weight: 600;
}
/* Actions */
.results-actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
animation: slideUp .5s .3s cubic-bezier(.34,1.56,.64,1) both;
}
.results-actions .btn { flex: 1 1 180px; }
@media (max-width: 600px) {
.results-page { padding: 40px 0; }
.score-total-card { padding: 28px 24px; }
.rounds-card { padding: 22px 20px; }
.results-actions .btn { flex-basis: 100%; }
}
@media (max-width: 360px) {
.score-total-num { font-size: 3.4rem; }
}
</style>
</head> </head>
<body> <body>
<noscript>
<p class="noscript-msg">GeoDraw requires JavaScript. Please enable it in your browser settings.</p>
</noscript>
<div class="wrap"> <div class="wrap">
<header class="header"> <header class="header">
<div class="container header__inner"> <div class="container header__inner">
<a href="index.html" class="logo"> <a href="index.html" class="logo">
<div class="logo__mark"> <div class="logo__mark">
<svg viewBox="0 0 24 24" fill="none"> <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/> <circle cx="12" cy="12" r="9" stroke="white" stroke-width="1.6"/>
<path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/> <path d="M3 12 Q8 8 12 12 Q16 16 21 12" stroke="white" stroke-width="1.4" fill="none"/>
<path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/> <path d="M12 3 Q14 8 12 12 Q10 16 12 21" stroke="white" stroke-width="1.4" fill="none"/>
@ -215,7 +25,7 @@
</div> </div>
<span class="logo__text">GeoDraw</span> <span class="logo__text">GeoDraw</span>
</a> </a>
<nav class="nav"> <nav class="nav" aria-label="Main navigation">
<a href="index.html" class="nav__link">Home</a> <a href="index.html" class="nav__link">Home</a>
<a href="leaderboard.html" class="nav__link">Leaderboard</a> <a href="leaderboard.html" class="nav__link">Leaderboard</a>
<a href="lobby.html" class="nav__cta">Play again →</a> <a href="lobby.html" class="nav__cta">Play again →</a>
@ -288,69 +98,6 @@
<script src="scripts/storage.js"></script> <script src="scripts/storage.js"></script>
<script src="scripts/scoring.js"></script> <script src="scripts/scoring.js"></script>
<script> <script src="scripts/results.js"></script>
document.addEventListener("DOMContentLoaded", () => {
const state = Storage.getGameState();
const name = Storage.getPlayerName();
document.getElementById("results-player").textContent = name;
if (!state) {
document.getElementById("results-title").textContent = "No game found.";
document.getElementById("total-score").textContent = "—";
return;
}
const { scores, totalScore, countries } = state;
// Emoji + title based on score
const avg = totalScore / 3;
let emoji = "🌍", title = "Not bad!";
if (avg >= 85) { emoji = "🔥"; title = "Incredible!"; }
else if (avg >= 70) { emoji = "🎉"; title = "Well done!"; }
else if (avg >= 50) { emoji = "👏"; title = "Good effort!"; }
else { emoji = "😅"; title = "Keep practising!"; }
document.getElementById("results-emoji").textContent = emoji;
document.getElementById("results-title").textContent = title;
document.getElementById("total-score").textContent = totalScore;
// Grade
const grade = Scoring.getGrade(avg);
const gradeEl = document.getElementById("total-grade");
gradeEl.textContent = `Grade ${grade.label}`;
// Round rows
const rowsContainer = document.getElementById("round-rows");
(scores || []).forEach((s, i) => {
const row = document.createElement("div");
row.className = "round-row";
row.innerHTML = `
<span class="round-row__label">Round ${i + 1}</span>
<div class="round-row__bar-wrap">
<div class="round-row__bar" style="width:0%" data-target="${s}"></div>
</div>
<span class="round-row__score">${s}%</span>
`;
rowsContainer.appendChild(row);
});
// Animate bars
requestAnimationFrame(() => {
document.querySelectorAll(".round-row__bar").forEach(bar => {
bar.style.width = bar.dataset.target + "%";
});
});
// Country tags
const tagsContainer = document.getElementById("countries-row");
(countries || []).forEach(c => {
const tag = document.createElement("span");
tag.className = "country-tag";
tag.textContent = c;
tagsContainer.appendChild(tag);
});
});
</script>
</body> </body>
</html> </html>

View File

@ -1,116 +1,136 @@
// countries.js — country data helpers (inline, no fetch needed) // countries.js — country data and helpers
/**
* @typedef {{ name: string, x: number, y: number }} City
* @typedef {{ name: string, hint: string, cities: City[] }} Country
*/
const Countries = (() => { const Countries = (() => {
const COUNTRIES_DATA = [ /** @type {Country[]} */
{ const COUNTRIES_DATA = [
"name": "Switzerland", {
"hint": "Alpine country in Central Europe", name: "Switzerland",
"cities": [ hint: "Alpine country in Central Europe",
{ "name": "Bern", "x": 48, "y": 58 }, cities: [
{ "name": "Zürich", "x": 58, "y": 38 }, { name: "Bern", x: 48, y: 58 },
{ "name": "Geneva", "x": 22, "y": 72 } { name: "Zürich", x: 58, y: 38 },
] { name: "Geneva", x: 22, y: 72 },
}, ],
{ },
"name": "Norway", {
"hint": "Scandinavian country with long coastline", name: "Norway",
"cities": [ hint: "Scandinavian country with long coastline",
{ "name": "Oslo", "x": 55, "y": 72 }, cities: [
{ "name": "Bergen", "x": 32, "y": 60 }, { name: "Oslo", x: 55, y: 72 },
{ "name": "Tromsø", "x": 62, "y": 18 } { name: "Bergen", x: 32, y: 60 },
] { name: "Tromsø", x: 62, y: 18 },
}, ],
{ },
"name": "Italy", {
"hint": "Boot-shaped peninsula in Southern Europe", name: "Italy",
"cities": [ hint: "Boot-shaped peninsula in Southern Europe",
{ "name": "Rome", "x": 52, "y": 58 }, cities: [
{ "name": "Milan", "x": 42, "y": 22 }, { name: "Rome", x: 52, y: 58 },
{ "name": "Naples", "x": 58, "y": 72 } { name: "Milan", x: 42, y: 22 },
] { name: "Naples", x: 58, y: 72 },
}, ],
{ },
"name": "Japan", {
"hint": "Island nation in East Asia", name: "Japan",
"cities": [ hint: "Island nation in East Asia",
{ "name": "Tokyo", "x": 72, "y": 48 }, cities: [
{ "name": "Osaka", "x": 58, "y": 58 }, { name: "Tokyo", x: 72, y: 48 },
{ "name": "Sapporo", "x": 70, "y": 22 } { name: "Osaka", x: 58, y: 58 },
] { name: "Sapporo", x: 70, y: 22 },
}, ],
{ },
"name": "Brazil", {
"hint": "Largest country in South America", name: "Brazil",
"cities": [ hint: "Largest country in South America",
{ "name": "Brasília", "x": 58, "y": 52 }, cities: [
{ "name": "São Paulo", "x": 60, "y": 68 }, { name: "Brasília", x: 58, y: 52 },
{ "name": "Manaus", "x": 38, "y": 38 } { name: "São Paulo", x: 60, y: 68 },
] { name: "Manaus", x: 38, y: 38 },
}, ],
{ },
"name": "Australia", {
"hint": "Continent and country in the Southern Hemisphere", name: "Australia",
"cities": [ hint: "Continent and country in the Southern Hemisphere",
{ "name": "Canberra", "x": 72, "y": 72 }, cities: [
{ "name": "Sydney", "x": 78, "y": 68 }, { name: "Canberra", x: 72, y: 72 },
{ "name": "Perth", "x": 22, "y": 65 } { name: "Sydney", x: 78, y: 68 },
] { name: "Perth", x: 22, y: 65 },
}, ],
{ },
"name": "France", {
"hint": "Western Europe, roughly hexagonal shape", name: "France",
"cities": [ hint: "Western Europe, roughly hexagonal shape",
{ "name": "Paris", "x": 50, "y": 32 }, cities: [
{ "name": "Lyon", "x": 58, "y": 55 }, { name: "Paris", x: 50, y: 32 },
{ "name": "Marseille", "x": 58, "y": 72 } { name: "Lyon", x: 58, y: 55 },
] { name: "Marseille", x: 58, y: 72 },
}, ],
{ },
"name": "India", {
"hint": "Large peninsula in South Asia", name: "India",
"cities": [ hint: "Large peninsula in South Asia",
{ "name": "New Delhi", "x": 46, "y": 28 }, cities: [
{ "name": "Mumbai", "x": 32, "y": 55 }, { name: "New Delhi", x: 46, y: 28 },
{ "name": "Chennai", "x": 52, "y": 72 } { name: "Mumbai", x: 32, y: 55 },
] { name: "Chennai", x: 52, y: 72 },
}, ],
{ },
"name": "Canada", {
"hint": "Second largest country in the world", name: "Canada",
"cities": [ hint: "Second largest country in the world",
{ "name": "Ottawa", "x": 62, "y": 52 }, cities: [
{ "name": "Vancouver", "x": 22, "y": 55 }, { name: "Ottawa", x: 62, y: 52 },
{ "name": "Toronto", "x": 60, "y": 58 } { name: "Vancouver", x: 22, y: 55 },
] { name: "Toronto", x: 60, y: 58 },
}, ],
{ },
"name": "Germany", {
"hint": "Central European country", name: "Germany",
"cities": [ hint: "Central European country",
{ "name": "Berlin", "x": 58, "y": 28 }, cities: [
{ "name": "Munich", "x": 48, "y": 68 }, { name: "Berlin", x: 58, y: 28 },
{ "name": "Hamburg", "x": 42, "y": 18 } { name: "Munich", x: 48, y: 68 },
] { name: "Hamburg", x: 42, y: 18 },
} ],
]; },
];
let _data = []; /** @type {Country[]} */
let _data = [];
async function loadCountries() { /**
if (_data.length) return _data; * Load country data into memory. Safe to call multiple times.
_data = COUNTRIES_DATA; * Returns a Promise for future compatibility with a real API fetch.
return _data; * @returns {Promise<Country[]>}
} */
function loadCountries() {
if (!_data.length) _data = COUNTRIES_DATA;
return Promise.resolve(_data);
}
function getRandomCountries(count = 3) { /**
const shuffled = [..._data].sort(() => Math.random() - 0.5); * Return a random subset of countries.
return shuffled.slice(0, count); * @param {number} count
} * @returns {Country[]}
*/
function getRandomCountries(count = 3) {
return [..._data].sort(() => Math.random() - 0.5).slice(0, count);
}
function getCities(countryName) { /**
const c = _data.find(c => c.name === countryName); * Get city list for a specific country by name.
return c ? c.cities : []; * @param {string} countryName
} * @returns {City[]}
*/
function getCities(countryName) {
const country = _data.find((c) => c.name === countryName);
return country ? country.cities : [];
}
return { loadCountries, getRandomCountries, getCities }; return { loadCountries, getRandomCountries, getCities };
})(); })();

View File

@ -1,148 +1,172 @@
// drawing.js — canvas drawing module // drawing.js — canvas drawing module
const Drawing = (() => { const Drawing = (() => {
let canvas, ctx; /** @type {HTMLCanvasElement} */
let isDrawing = false; let canvas;
let points = []; // [{x, y}, ...] /** @type {CanvasRenderingContext2D} */
let cities = []; // [{name, x, y}, ...] (% coords) let ctx;
const STROKE_COLOR = "#1a7fc4"; let isDrawing = false;
const STROKE_WIDTH = 2.5; /** @type {{ x: number, y: number }[]} */
let points = [];
/** @type {{ name: string, x: number, y: number }[]} */
let cities = [];
function init(canvasEl) { const STROKE_COLOR = "#1a7fc4";
canvas = canvasEl; const STROKE_WIDTH = 2.5;
ctx = canvas.getContext("2d");
// Pointer events (mouse + touch) /**
canvas.addEventListener("pointerdown", onDown); * Initialise the drawing module on a canvas element.
canvas.addEventListener("pointermove", onMove); * @param {HTMLCanvasElement} canvasEl
canvas.addEventListener("pointerup", onUp); */
canvas.addEventListener("pointerleave", onUp); function init(canvasEl) {
canvas.style.touchAction = "none"; canvas = canvasEl;
ctx = canvas.getContext("2d");
_resize(); canvas.addEventListener("pointerdown", onDown);
window.addEventListener("resize", _resize); canvas.addEventListener("pointermove", onMove);
} canvas.addEventListener("pointerup", onUp);
canvas.addEventListener("pointerleave", onUp);
canvas.style.touchAction = "none";
function _resize() { _resize();
if (!canvas) return; window.addEventListener("resize", _resize);
const { width, height } = canvas.getBoundingClientRect(); }
canvas.width = width * window.devicePixelRatio;
canvas.height = height * window.devicePixelRatio;
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
_redraw();
}
function _pos(e) { /** Resize canvas to match its CSS size, accounting for device pixel ratio. */
const r = canvas.getBoundingClientRect(); function _resize() {
return { if (!canvas) return;
x: (e.clientX - r.left), const { width, height } = canvas.getBoundingClientRect();
y: (e.clientY - r.top), canvas.width = width * window.devicePixelRatio;
}; canvas.height = height * window.devicePixelRatio;
} ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
_redraw();
}
function onDown(e) { /**
e.preventDefault(); * Convert a pointer event to canvas-local coordinates.
isDrawing = true; * @param {PointerEvent} e
const p = _pos(e); * @returns {{ x: number, y: number }}
points.push(p); */
ctx.beginPath(); function _pos(e) {
ctx.moveTo(p.x, p.y); const rect = canvas.getBoundingClientRect();
} return { x: e.clientX - rect.left, y: e.clientY - rect.top };
}
function onMove(e) { /** @param {PointerEvent} e */
if (!isDrawing) return; function onDown(e) {
e.preventDefault(); e.preventDefault();
const p = _pos(e); isDrawing = true;
points.push(p); const p = _pos(e);
ctx.lineTo(p.x, p.y); points.push(p);
ctx.strokeStyle = STROKE_COLOR; ctx.beginPath();
ctx.lineWidth = STROKE_WIDTH; ctx.moveTo(p.x, p.y);
ctx.lineJoin = "round"; }
ctx.lineCap = "round";
ctx.stroke();
}
function onUp(e) { /** @param {PointerEvent} e */
if (!isDrawing) return; function onMove(e) {
isDrawing = false; if (!isDrawing) return;
e.preventDefault(); e.preventDefault();
} const p = _pos(e);
points.push(p);
ctx.lineTo(p.x, p.y);
ctx.strokeStyle = STROKE_COLOR;
ctx.lineWidth = STROKE_WIDTH;
ctx.lineJoin = "round";
ctx.lineCap = "round";
ctx.stroke();
}
function clear() { /** @param {PointerEvent} e */
points = []; function onUp(e) {
if (!ctx) return; if (!isDrawing) return;
const w = canvas.getBoundingClientRect().width; isDrawing = false;
const h = canvas.getBoundingClientRect().height; e.preventDefault();
ctx.clearRect(0, 0, w, h); }
_drawCities();
}
function setCities(cityList) { /** Clear the canvas and redraw city markers. */
cities = cityList || []; function clear() {
_drawCities(); points = [];
} if (!ctx) return;
const { width, height } = canvas.getBoundingClientRect();
ctx.clearRect(0, 0, width, height);
_drawCities();
}
function _drawCities() { /**
if (!ctx || !cities.length) return; * Set city markers to display on the canvas.
const w = canvas.getBoundingClientRect().width; * @param {{ name: string, x: number, y: number }[]} cityList - Coords in percent (0100).
const h = canvas.getBoundingClientRect().height; */
function setCities(cityList) {
cities = cityList || [];
_drawCities();
}
cities.forEach(city => { /** Render all city markers with labels. */
const cx = (city.x / 100) * w; function _drawCities() {
const cy = (city.y / 100) * h; if (!ctx || !cities.length) return;
const { width, height } = canvas.getBoundingClientRect();
// Dot cities.forEach((city) => {
ctx.beginPath(); const cx = (city.x / 100) * width;
ctx.arc(cx, cy, 5, 0, Math.PI * 2); const cy = (city.y / 100) * height;
ctx.fillStyle = "rgba(240,180,40,0.9)";
ctx.fill();
ctx.strokeStyle = "rgba(255,255,255,0.9)";
ctx.lineWidth = 1.5;
ctx.stroke();
// Label // Dot
ctx.font = "bold 11px 'DM Sans', sans-serif"; ctx.beginPath();
ctx.fillStyle = "#0b1f2a"; ctx.arc(cx, cy, 5, 0, Math.PI * 2);
ctx.textAlign = "center"; ctx.fillStyle = "rgba(240,180,40,0.9)";
ctx.fill();
ctx.strokeStyle = "rgba(255,255,255,0.9)";
ctx.lineWidth = 1.5;
ctx.stroke();
// White pill background // White pill label background
const textW = ctx.measureText(city.name).width + 10; ctx.font = "bold 11px 'DM Sans', sans-serif";
const textH = 16; const textW = ctx.measureText(city.name).width + 10;
const tx = cx; const textH = 16;
const ty = cy - 14; const tx = cx;
const ty = cy - 14;
ctx.save(); ctx.save();
ctx.fillStyle = "rgba(255,255,255,0.88)"; ctx.fillStyle = "rgba(255,255,255,0.88)";
ctx.beginPath(); ctx.beginPath();
ctx.roundRect(tx - textW / 2, ty - textH / 2 - 1, textW, textH, 4); ctx.roundRect(tx - textW / 2, ty - textH / 2 - 1, textW, textH, 4);
ctx.fill(); ctx.fill();
ctx.restore(); ctx.restore();
ctx.fillStyle = "#0b1f2a"; ctx.fillStyle = "#0b1f2a";
ctx.fillText(city.name, tx, ty + 4); ctx.textAlign = "center";
}); ctx.fillText(city.name, tx, ty + 4);
} });
}
function _redraw() { /** Redraw the full stroke from stored points. */
_drawCities(); function _redraw() {
if (!points.length) return; _drawCities();
ctx.beginPath(); if (!points.length) return;
ctx.strokeStyle = STROKE_COLOR; ctx.beginPath();
ctx.lineWidth = STROKE_WIDTH; ctx.strokeStyle = STROKE_COLOR;
ctx.lineJoin = "round"; ctx.lineWidth = STROKE_WIDTH;
ctx.lineCap = "round"; ctx.lineJoin = "round";
points.forEach((p, i) => i === 0 ? ctx.moveTo(p.x, p.y) : ctx.lineTo(p.x, p.y)); ctx.lineCap = "round";
ctx.stroke(); points.forEach((p, i) =>
} i === 0 ? ctx.moveTo(p.x, p.y) : ctx.lineTo(p.x, p.y),
);
ctx.stroke();
}
function getPoints() { /**
return [...points]; * Return a copy of the current drawn points.
} * @returns {{ x: number, y: number }[]}
*/
function getPoints() {
return [...points];
}
function destroy() { /** Remove event listeners and clean up. */
window.removeEventListener("resize", _resize); function destroy() {
} window.removeEventListener("resize", _resize);
}
return { init, clear, setCities, getPoints, destroy }; return { init, clear, setCities, getPoints, destroy };
})(); })();

View File

@ -1,153 +1,158 @@
// game.js — round management, timer, submit // game.js — round management, timer, submit
const TOTAL_ROUNDS = 3; const TOTAL_ROUNDS = 3;
const ROUND_DURATION = 60; // seconds const ROUND_DURATION = 60; // seconds
/** @type {import('./countries.js').Country[]} */
let roundCountries = []; let roundCountries = [];
let currentRound = 0; let currentRound = 0;
let scores = []; /** @type {number[]} */
let timerInterval = null; let scores = [];
let timeLeft = ROUND_DURATION; let timerInterval = null;
let timeLeft = ROUND_DURATION;
// ── DOM refs // ── DOM refs
const elCountryName = document.getElementById("country-name"); const elCountryName = document.getElementById("country-name");
const elCountryHint = document.getElementById("country-hint"); const elCountryHint = document.getElementById("country-hint");
const elRoundNum = document.getElementById("round-num"); const elRoundNum = document.getElementById("round-num");
const elTimerNum = document.getElementById("timer-num"); const elTimerNum = document.getElementById("timer-num");
const elTimerBar = document.getElementById("timer-bar"); const elTimerBar = document.getElementById("timer-bar");
const elBtnClear = document.getElementById("btn-clear"); const elTimerWrap = document.querySelector(".game-timer");
const elBtnSubmit = document.getElementById("btn-submit"); const elBtnClear = document.getElementById("btn-clear");
const elCanvas = document.getElementById("draw-canvas"); const elBtnSubmit = document.getElementById("btn-submit");
// ── Init // ── Init
/** Load countries and start the first round. */
async function initGame() { async function initGame() {
await Countries.loadCountries(); await Countries.loadCountries();
roundCountries = Countries.getRandomCountries(TOTAL_ROUNDS); roundCountries = Countries.getRandomCountries(TOTAL_ROUNDS);
currentRound = 0; currentRound = 0;
scores = []; scores = [];
startRound(); startRound();
} }
// ── Round // ── Round
/** Set up UI and timer for the current round. */
function startRound() { function startRound() {
const country = roundCountries[currentRound]; const country = roundCountries[currentRound];
// Update UI elRoundNum.textContent = currentRound + 1;
elRoundNum.textContent = currentRound + 1; elCountryName.textContent = country.name;
elCountryName.textContent = country.name; elCountryHint.textContent = country.hint || "";
elCountryHint.textContent = country.hint || "";
// Round pips if (typeof window.updateRoundPips === "function") {
if (typeof window.updateRoundPips === "function") { window.updateRoundPips(currentRound + 1);
window.updateRoundPips(currentRound + 1); }
}
// Reset canvas placeholder document.getElementById("canvas-wrap")?.classList.remove("has-drawing");
document.getElementById("canvas-wrap")?.classList.remove("has-drawing");
// Cities on canvas Drawing.clear();
Drawing.clear(); Drawing.setCities(country.cities || []);
Drawing.setCities(country.cities || []);
// Timer timeLeft = ROUND_DURATION;
timeLeft = ROUND_DURATION; updateTimerUI();
updateTimerUI(); clearInterval(timerInterval);
clearInterval(timerInterval); timerInterval = setInterval(tickTimer, 1000);
timerInterval = setInterval(tickTimer, 1000);
// Button state elBtnSubmit.disabled = false;
elBtnSubmit.disabled = false; elBtnSubmit.textContent =
elBtnSubmit.textContent = currentRound < TOTAL_ROUNDS - 1 currentRound < TOTAL_ROUNDS - 1
? "Submit & Next Round →" ? "Submit & Next Round →"
: "Submit & See Results →"; : "Submit & See Results →";
} }
/** Decrement timer by one second and auto-submit when time runs out. */
function tickTimer() { function tickTimer() {
timeLeft--; timeLeft--;
updateTimerUI(); updateTimerUI();
if (timeLeft <= 0) { if (timeLeft <= 0) {
clearInterval(timerInterval); clearInterval(timerInterval);
submitRound(true); // auto-submit submitRound(true);
} }
} }
/**
* Sync timer bar width and apply urgency CSS classes.
* Uses `.timer--warning` and `.timer--danger` instead of inline styles.
*/
function updateTimerUI() { function updateTimerUI() {
elTimerNum.textContent = timeLeft; elTimerNum.textContent = timeLeft;
const pct = (timeLeft / ROUND_DURATION) * 100; elTimerBar.style.width = `${(timeLeft / ROUND_DURATION) * 100}%`;
elTimerBar.style.width = pct + "%";
// Colour shift elTimerWrap.classList.toggle("timer--danger", timeLeft <= 10);
if (timeLeft <= 10) { elTimerWrap.classList.toggle(
elTimerBar.style.background = "#e05c5c"; "timer--warning",
elTimerNum.style.color = "#e05c5c"; timeLeft > 10 && timeLeft <= 20,
} else if (timeLeft <= 20) { );
elTimerBar.style.background = "#f0b429";
elTimerNum.style.color = "#f0b429";
} else {
elTimerBar.style.background = "";
elTimerNum.style.color = "";
}
} }
/**
* Submit the current round, record the score, and advance or finish.
* @param {boolean} [auto=false] - True when triggered by timer expiry.
*/
function submitRound(auto = false) { function submitRound(auto = false) {
clearInterval(timerInterval); clearInterval(timerInterval);
elBtnSubmit.disabled = true; elBtnSubmit.disabled = true;
const points = Drawing.getPoints(); const points = Drawing.getPoints();
const score = Scoring.calculateScore(points); const score = Scoring.calculateScore(points);
scores.push(score); scores.push(score);
// Update sidebar score row if (typeof window.updateScoreDisplay === "function") {
if (typeof window.updateScoreDisplay === "function") { window.updateScoreDisplay(currentRound, score);
window.updateScoreDisplay(currentRound, score); }
}
// Flash score feedback showScoreFeedback(score);
showScoreFeedback(score);
const delay = auto ? 400 : 1200; setTimeout(
setTimeout(() => { () => {
if (currentRound < TOTAL_ROUNDS - 1) { if (currentRound < TOTAL_ROUNDS - 1) {
currentRound++; currentRound++;
startRound(); startRound();
} else { } else {
finishGame(); finishGame();
} }
}, delay); },
auto ? 400 : 1200,
);
} }
/**
* Briefly display the score grade overlay on the canvas.
* @param {number} score
*/
function showScoreFeedback(score) { function showScoreFeedback(score) {
const grade = Scoring.getGrade(score); const grade = Scoring.getGrade(score);
const el = document.getElementById("score-feedback"); const el = document.getElementById("score-feedback");
el.textContent = `${score}% ${grade.label}`; el.textContent = `${score}% ${grade.label}`;
el.style.color = grade.color; el.style.color = grade.color;
el.style.opacity = "1"; el.style.opacity = "1";
el.style.transform = "translateY(0)"; el.style.transform = "translateY(0)";
setTimeout(() => { setTimeout(() => {
el.style.opacity = "0"; el.style.opacity = "0";
el.style.transform = "translateY(-10px)"; el.style.transform = "translateY(-10px)";
}, 900); }, 900);
} }
/** Persist game state, update leaderboard, and navigate to results. */
function finishGame() { function finishGame() {
const totalScore = scores.reduce((a, b) => a + b, 0); const totalScore = scores.reduce((sum, s) => sum + s, 0);
const state = { const state = {
currentRound: TOTAL_ROUNDS, currentRound: TOTAL_ROUNDS,
scores, scores,
totalScore, totalScore,
countries: roundCountries.map(c => c.name), countries: roundCountries.map((c) => c.name),
}; };
Storage.saveGameState(state); Storage.saveGameState(state);
Storage.saveLeaderboard({
// Save to leaderboard name: Storage.getPlayerName(),
Storage.saveLeaderboard({ totalScore,
name: Storage.getPlayerName(), scores,
totalScore, date: new Date().toISOString(),
scores, });
date: new Date().toISOString(), location.href = "results.html";
});
location.href = "results.html";
} }
// ── Events // ── Events

View File

@ -1,6 +1,15 @@
// index.js — landing page logic
/**
* Handle the "Create game" button click.
* Validates the lobby name, persists it, and navigates to the lobby page.
*/
document.getElementById("reg-btn")?.addEventListener("click", () => { document.getElementById("reg-btn")?.addEventListener("click", () => {
const lobbyInput = document.getElementById("username"); const lobbyInput = /** @type {HTMLInputElement|null} */ (
document.getElementById("username")
);
const lobbyName = lobbyInput ? lobbyInput.value.trim() : ""; const lobbyName = lobbyInput ? lobbyInput.value.trim() : "";
if (lobbyName) { if (lobbyName) {
Storage.saveLobbyName(lobbyName); Storage.saveLobbyName(lobbyName);
window.location.href = "lobby.html"; window.location.href = "lobby.html";
@ -9,19 +18,18 @@ document.getElementById("reg-btn")?.addEventListener("click", () => {
} }
}); });
// Scroll reveal — animate elements into view as they enter the viewport
const reveals = document.querySelectorAll(".reveal"); const reveals = document.querySelectorAll(".reveal");
const io = new IntersectionObserver( const observer = new IntersectionObserver(
(entries) => { (entries) => {
entries.forEach((entry) => { entries.forEach((entry) => {
if (entry.isIntersecting) { if (entry.isIntersecting) {
entry.target.classList.add("visible"); entry.target.classList.add("visible");
io.unobserve(entry.target); observer.unobserve(entry.target);
} }
}); });
}, },
{ threshold: 0.12 }, { threshold: 0.12 },
); );
reveals.forEach((el) => { reveals.forEach((el) => observer.observe(el));
io.observe(el);
});

View File

@ -0,0 +1,72 @@
// leaderboard.js — leaderboard page logic
document.addEventListener("DOMContentLoaded", () => {
const currentPlayer = Storage.getPlayerName();
const body = document.getElementById("lb-body");
/**
* Escape HTML special characters to prevent XSS.
* @param {string} str - Raw user-provided string.
* @returns {string} HTML-safe string.
*/
function escHtml(str) {
return String(str)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
/** Render the leaderboard from localStorage data. */
function render() {
const board = Storage.getLeaderboard();
body.innerHTML = "";
if (!board.length) {
body.innerHTML = `
<div class="lb-empty">
<div class="lb-empty__icon">🏁</div>
<p class="lb-empty__text">No games played yet. Be the first on the board!</p>
<a href="lobby.html" class="btn btn--primary btn--sm">Play now </a>
</div>`;
return;
}
const medals = ["🥇", "🥈", "🥉"];
const scoreClasses = ["gold", "silver", "bronze"];
board.forEach((entry, index) => {
const rank = index + 1;
const isYou = entry.name === currentPlayer;
const date = entry.date
? new Date(entry.date).toLocaleDateString("en-CH", {
day: "2-digit",
month: "short",
})
: "—";
const rounds = (entry.scores || []).join(" · ") || "—";
const row = document.createElement("div");
row.className = `lb-row${rank <= 3 ? ` rank-${rank}` : ""}`;
row.style.animationDelay = `${index * 0.05}s`;
row.innerHTML = `
<span class="lb-rank">${rank <= 3 ? `<span class="lb-medal">${medals[rank - 1]}</span>` : rank}</span>
<span class="lb-name${isYou ? " is-you" : ""}">${escHtml(entry.name)}</span>
<span class="lb-rounds hide-sm">${escHtml(rounds)}</span>
<span class="lb-date hide-sm">${date}</span>
<span class="lb-score${rank <= 3 ? ` ${scoreClasses[rank - 1]}` : ""}">${entry.totalScore}</span>
`;
body.appendChild(row);
});
// Show the current player's latest score bar
const latest = board.find((entry) => entry.name === currentPlayer);
if (latest) {
document.getElementById("your-bar").style.display = "flex";
document.getElementById("your-bar-name").textContent = latest.name;
document.getElementById("your-bar-score").textContent = latest.totalScore;
}
}
render();
});

View File

@ -1,47 +1,55 @@
// lobby.js // lobby.js — lobby page logic
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
const input = document.getElementById("username"); const input = document.getElementById("username");
const btn = document.getElementById("btn-start"); const btn = document.getElementById("btn-start");
const errMsg = document.getElementById("name-error"); const errMsg = document.getElementById("name-error");
// Show lobby name // Display the current lobby name
const lobbyNameEl = document.getElementById("lobby-name-display"); const lobbyNameEl = document.getElementById("lobby-name-display");
if (lobbyNameEl) { if (lobbyNameEl) {
lobbyNameEl.textContent = Storage.getLobbyName(); lobbyNameEl.textContent = Storage.getLobbyName();
} }
btn.addEventListener("click", () => { /**
const name = input.value.trim(); * Validate the username input and navigate to the game.
if (!name) { * Shows an inline error message on invalid input.
errMsg.textContent = "Please enter a username to continue."; */
input.classList.add("input--error"); btn.addEventListener("click", () => {
input.focus(); const name = input.value.trim();
return;
}
if (name.length < 2) {
errMsg.textContent = "Username must be at least 2 characters.";
input.classList.add("input--error");
input.focus();
return;
}
Storage.savePlayerName(name);
Storage.clearGameState();
location.href = "game.html";
});
input.addEventListener("input", () => { if (!name) {
errMsg.textContent = ""; errMsg.textContent = "Please enter a username to continue.";
input.classList.remove("input--error"); input.classList.add("input--error");
}); input.focus();
return;
}
if (name.length < 2) {
errMsg.textContent = "Username must be at least 2 characters.";
input.classList.add("input--error");
input.focus();
return;
}
input.addEventListener("keydown", (e) => { Storage.savePlayerName(name);
if (e.key === "Enter") btn.click(); Storage.clearGameState();
}); location.href = "game.html";
});
// Pre-fill if returning player // Clear validation state on every keystroke
const existing = Storage.getPlayerName(); input.addEventListener("input", () => {
if (existing && existing !== "Anonymous") { errMsg.textContent = "";
input.value = existing; input.classList.remove("input--error");
} });
// Allow form submission via Enter key
input.addEventListener("keydown", (e) => {
if (e.key === "Enter") btn.click();
});
// Pre-fill username if the player has played before
const existing = Storage.getPlayerName();
if (existing && existing !== "Anonymous") {
input.value = existing;
}
}); });

View File

@ -1,36 +0,0 @@
// main.js — index.html
document.addEventListener("DOMContentLoaded", () => {
// Smooth scroll for nav links
document.querySelectorAll('a[href^="#"]').forEach(link => {
link.addEventListener("click", e => {
const id = link.getAttribute("href").slice(1);
const target = document.getElementById(id);
if (!target) return;
e.preventDefault();
const headerH = document.querySelector(".header")?.offsetHeight || 0;
const top = target.getBoundingClientRect().top + window.scrollY - headerH - 16;
window.scrollTo({ top, behavior: "smooth" });
});
});
// Register button stub
const regBtn = document.getElementById("reg-btn");
if (regBtn) {
regBtn.addEventListener("click", () => {
alert("Frontend skeleton only. Backend will be connected later.");
});
}
// Scroll reveal
const reveals = document.querySelectorAll(".reveal");
const io = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
io.unobserve(entry.target);
}
});
}, { threshold: 0.12 });
reveals.forEach(el => io.observe(el));
});

View File

@ -0,0 +1,74 @@
// results.js — results page logic
document.addEventListener("DOMContentLoaded", () => {
const state = Storage.getGameState();
const name = Storage.getPlayerName();
document.getElementById("results-player").textContent = name;
if (!state) {
document.getElementById("results-title").textContent = "No game found.";
document.getElementById("total-score").textContent = "—";
return;
}
const { scores, totalScore, countries } = state;
// Determine emoji and title based on average score
const avg = totalScore / 3;
let emoji = "🌍";
let title = "Not bad!";
if (avg >= 85) {
emoji = "🔥";
title = "Incredible!";
} else if (avg >= 70) {
emoji = "🎉";
title = "Well done!";
} else if (avg >= 50) {
emoji = "👏";
title = "Good effort!";
} else {
emoji = "😅";
title = "Keep practising!";
}
document.getElementById("results-emoji").textContent = emoji;
document.getElementById("results-title").textContent = title;
document.getElementById("total-score").textContent = totalScore;
// Grade badge
const grade = Scoring.getGrade(avg);
const gradeEl = document.getElementById("total-grade");
gradeEl.textContent = `Grade ${grade.label}`;
// Round breakdown rows
const rowsContainer = document.getElementById("round-rows");
(scores || []).forEach((score, index) => {
const row = document.createElement("div");
row.className = "round-row";
row.innerHTML = `
<span class="round-row__label">Round ${index + 1}</span>
<div class="round-row__bar-wrap">
<div class="round-row__bar" style="width:0%" data-target="${score}"></div>
</div>
<span class="round-row__score">${score}%</span>
`;
rowsContainer.appendChild(row);
});
// Animate score bars on next frame so CSS transition fires
requestAnimationFrame(() => {
document.querySelectorAll(".round-row__bar").forEach((bar) => {
bar.style.width = `${bar.dataset.target}%`;
});
});
// Country tags
const tagsContainer = document.getElementById("countries-row");
(countries || []).forEach((country) => {
const tag = document.createElement("span");
tag.className = "country-tag";
tag.textContent = country;
tagsContainer.appendChild(tag);
});
});

View File

@ -1,41 +1,46 @@
// scoring.js — accuracy calculation // scoring.js — accuracy calculation
const Scoring = (() => { const Scoring = (() => {
/**
* Calculate a score from the drawn path points.
* NOTE: Currently uses an effort-based approximation.
* TODO: Replace with real polygon comparison (IoU or Hausdorff distance).
* @param {{ x: number, y: number }[]} drawnPoints
* @returns {number} Score between 0 and 100.
*/
function calculateScore(drawnPoints) {
if (!drawnPoints || drawnPoints.length < 10) return 0;
/** const effort = Math.min(drawnPoints.length / 300, 1); // 01
* Calculate score from drawn path points. const base = 40 + Math.round(effort * 45); // 4085
* MVP: fake score based on number of points drawn (effort-based). const jitter = Math.round((Math.random() - 0.5) * 14); // ±7
* TODO: replace with real compareShapes() using polygon overlap. return Math.max(0, Math.min(100, base + jitter));
*/ }
function calculateScore(drawnPoints) {
if (!drawnPoints || drawnPoints.length < 10) return 0;
// Fake scoring: reward effort + randomness so it feels real /**
const effort = Math.min(drawnPoints.length / 300, 1); // 01 * Compare a drawn polygon against a reference polygon.
const base = 40 + Math.round(effort * 45); // 4085 * Stub reserved for future IoU / Hausdorff implementation.
const jitter = Math.round((Math.random() - 0.5) * 14); // ±7 * @param {{ x: number, y: number }[]} _drawnPoints
const score = Math.max(0, Math.min(100, base + jitter)); * @param {{ x: number, y: number }[]} _referencePolygon - Normalised 01 coords.
return score; * @returns {number} Score between 0 and 100.
} */
function compareShapes(_drawnPoints, _referencePolygon) {
// TODO: implement real shape comparison
return 0;
}
/** /**
* Stub for real shape comparison (future). * Map a numeric score to a letter grade with colour.
* drawnPoints: [{x,y}, ...] * @param {number} score
* referencePolygon: [{x,y}, ...] (normalised 01 coords) * @returns {{ label: string, color: string }}
*/ */
function compareShapes(_drawnPoints, _referencePolygon) { function getGrade(score) {
// TODO: implement IoU (Intersection over Union) or if (score >= 90) return { label: "S", color: "#f0b429" };
// Hausdorff distance for polygon comparison. if (score >= 75) return { label: "A", color: "#41b869" };
return 0; if (score >= 60) return { label: "B", color: "#1a7fc4" };
} if (score >= 40) return { label: "C", color: "#7a9aaa" };
return { label: "D", color: "#e05c5c" };
}
function getGrade(score) { return { calculateScore, compareShapes, getGrade };
if (score >= 90) return { label: "S", color: "#f0b429" };
if (score >= 75) return { label: "A", color: "#41b869" };
if (score >= 60) return { label: "B", color: "#1a7fc4" };
if (score >= 40) return { label: "C", color: "#7a9aaa" };
return { label: "D", color: "#e05c5c" };
}
return { calculateScore, compareShapes, getGrade };
})(); })();

View File

@ -1,75 +1,105 @@
// storage.js — localStorage helpers // storage.js — localStorage helpers
const Storage = (() => { const Storage = (() => {
const KEYS = { const KEYS = {
PLAYER_NAME: "gd_playerName", PLAYER_NAME: "gd_playerName",
LOBBY_NAME: "gd_lobbyName", LOBBY_NAME: "gd_lobbyName",
GAME_STATE: "gd_gameState", GAME_STATE: "gd_gameState",
LEADERBOARD: "gd_leaderboard", LEADERBOARD: "gd_leaderboard",
}; };
function savePlayerName(name) { /**
localStorage.setItem(KEYS.PLAYER_NAME, name.trim()); * Safely write a value to localStorage.
} * Silently fails if storage quota is exceeded or unavailable.
* @param {string} key
* @param {string} value
*/
function _set(key, value) {
try {
localStorage.setItem(key, value);
} catch {
console.warn(`Storage: could not write key "${key}"`);
}
}
function getPlayerName() { /** @param {string} name */
return localStorage.getItem(KEYS.PLAYER_NAME) || "Anonymous"; function savePlayerName(name) {
} _set(KEYS.PLAYER_NAME, name.trim());
}
function saveLobbyName(name) { /** @returns {string} */
localStorage.setItem(KEYS.LOBBY_NAME, name.trim()); function getPlayerName() {
} return localStorage.getItem(KEYS.PLAYER_NAME) || "Anonymous";
}
function getLobbyName() { /** @param {string} name */
return localStorage.getItem(KEYS.LOBBY_NAME) || "My Lobby"; function saveLobbyName(name) {
} _set(KEYS.LOBBY_NAME, name.trim());
}
function saveGameState(state) { /** @returns {string} */
localStorage.setItem(KEYS.GAME_STATE, JSON.stringify(state)); function getLobbyName() {
} return localStorage.getItem(KEYS.LOBBY_NAME) || "My Lobby";
}
function getGameState() { /**
try { * @param {{ scores: number[], totalScore: number, countries: string[] }} state
return JSON.parse(localStorage.getItem(KEYS.GAME_STATE)) || null; */
} catch { function saveGameState(state) {
return null; _set(KEYS.GAME_STATE, JSON.stringify(state));
} }
}
function clearGameState() { /**
localStorage.removeItem(KEYS.GAME_STATE); * @returns {{ scores: number[], totalScore: number, countries: string[] } | null}
} */
function getGameState() {
try {
return JSON.parse(localStorage.getItem(KEYS.GAME_STATE)) || null;
} catch {
return null;
}
}
function saveLeaderboard(entry) { function clearGameState() {
const board = getLeaderboard(); localStorage.removeItem(KEYS.GAME_STATE);
board.push(entry); }
board.sort((a, b) => b.totalScore - a.totalScore);
const top20 = board.slice(0, 20);
localStorage.setItem(KEYS.LEADERBOARD, JSON.stringify(top20));
}
function getLeaderboard() { /**
try { * Add an entry to the leaderboard and keep the top 20.
return JSON.parse(localStorage.getItem(KEYS.LEADERBOARD)) || []; * @param {{ name: string, totalScore: number, scores: number[], date: string }} entry
} catch { */
return []; function saveLeaderboard(entry) {
} const board = getLeaderboard();
} board.push(entry);
board.sort((a, b) => b.totalScore - a.totalScore);
_set(KEYS.LEADERBOARD, JSON.stringify(board.slice(0, 20)));
}
function clearLeaderboard() { /**
localStorage.removeItem(KEYS.LEADERBOARD); * @returns {{ name: string, totalScore: number, scores: number[], date: string }[]}
} */
function getLeaderboard() {
try {
return JSON.parse(localStorage.getItem(KEYS.LEADERBOARD)) || [];
} catch {
return [];
}
}
return { function clearLeaderboard() {
savePlayerName, localStorage.removeItem(KEYS.LEADERBOARD);
getPlayerName, }
saveLobbyName,
getLobbyName, return {
saveGameState, savePlayerName,
getGameState, getPlayerName,
clearGameState, saveLobbyName,
saveLeaderboard, getLobbyName,
getLeaderboard, saveGameState,
clearLeaderboard, getGameState,
}; clearGameState,
saveLeaderboard,
getLeaderboard,
clearLeaderboard,
};
})(); })();

View File

@ -1,282 +1,339 @@
/* game.css */ /* game.css */
.game-layout { .game-layout {
min-height: calc(100vh - var(--hh)); min-height: calc(100vh - var(--hh));
display: grid; display: grid;
grid-template-rows: auto 1fr auto; grid-template-rows: auto 1fr auto;
padding: 20px 0 28px; padding: 20px 0 28px;
gap: 16px; gap: 16px;
} }
/* ── Top bar */ /* ── Top bar */
.game-topbar { .game-topbar {
display: grid; display: grid;
grid-template-columns: 1fr auto 1fr; grid-template-columns: 1fr auto 1fr;
align-items: center; align-items: center;
gap: 16px; gap: 16px;
} }
.game-round { .game-round {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
} }
.round-pip { .round-pip {
width: 10px; width: 10px;
height: 10px; height: 10px;
border-radius: 50%; border-radius: 50%;
background: var(--line); background: var(--line);
transition: background .3s; transition: background 0.3s;
} }
.round-pip.active { background: var(--sea); } .round-pip.active {
.round-pip.done { background: var(--leaf); } background: var(--sea);
}
.round-pip.done {
background: var(--leaf);
}
.round-label { .round-label {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-size: .82rem; font-size: 0.82rem;
font-weight: 700; font-weight: 700;
color: var(--ink-muted); color: var(--ink-muted);
letter-spacing: .06em; letter-spacing: 0.06em;
text-transform: uppercase; text-transform: uppercase;
} }
.round-label span { .round-label span {
color: var(--ink); color: var(--ink);
} }
/* Country name */ /* Country name */
.game-country { .game-country {
text-align: center; text-align: center;
} }
.country-name { .country-name {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: clamp(1.5rem, 3vw, 2.4rem); font-size: clamp(1.5rem, 3vw, 2.4rem);
letter-spacing: -.03em; letter-spacing: -0.03em;
line-height: 1.1; line-height: 1.1;
} }
.country-hint { .country-hint {
font-size: .82rem; font-size: 0.82rem;
color: var(--ink-muted); color: var(--ink-muted);
margin-top: 4px; margin-top: 4px;
} }
/* Timer */ /* Timer */
.game-timer { .game-timer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
gap: 6px; gap: 6px;
} }
.timer-display { .timer-display {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
gap: 4px; gap: 4px;
} }
.timer-num { .timer-num {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: 2rem; font-size: 2rem;
line-height: 1; line-height: 1;
color: var(--ink); color: var(--ink);
transition: color .3s; transition: color 0.3s;
min-width: 2ch; min-width: 2ch;
text-align: right; text-align: right;
} }
.timer-unit { .timer-unit {
font-size: .78rem; font-size: 0.78rem;
font-weight: 600; font-weight: 600;
color: var(--ink-muted); color: var(--ink-muted);
} }
.timer-track { .timer-track {
width: 120px; width: 120px;
height: 4px; height: 4px;
background: var(--line); background: var(--line);
border-radius: 999px; border-radius: 999px;
overflow: hidden; overflow: hidden;
} }
.timer-bar { .timer-bar {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: linear-gradient(90deg, var(--sea), var(--leaf)); background: linear-gradient(90deg, var(--sea), var(--leaf));
border-radius: 999px; border-radius: 999px;
transition: width 1s linear, background .4s ease; transition:
width 1s linear,
background 0.4s ease;
}
/* Timer urgency states — applied via JS classList */
.timer--warning .timer-bar,
.timer--warning .timer-num {
color: var(--gold);
}
.timer--warning .timer-bar {
background: var(--gold);
}
.timer--danger .timer-bar,
.timer--danger .timer-num {
color: var(--danger);
}
.timer--danger .timer-bar {
background: var(--danger);
} }
/* ── Canvas area */ /* ── Canvas area */
.canvas-area { .canvas-area {
display: grid; display: grid;
grid-template-columns: 1fr 220px; grid-template-columns: 1fr 220px;
gap: 16px; gap: 16px;
min-height: 0; min-height: 0;
} }
.canvas-wrap { .canvas-wrap {
position: relative; position: relative;
background: var(--white); background: var(--white);
border: 1.5px solid var(--line); border: 1.5px solid var(--line);
border-radius: var(--r-xl); border-radius: var(--r-xl);
box-shadow: var(--shadow); box-shadow: var(--shadow);
overflow: hidden; overflow: hidden;
cursor: crosshair; cursor: crosshair;
} }
.canvas-wrap::before { .canvas-wrap::before {
content: 'Draw the border here'; content: "Draw the border here";
position: absolute; position: absolute;
inset: 0; inset: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: .9rem; font-size: 0.9rem;
font-weight: 500; font-weight: 500;
color: var(--ink-muted); color: var(--ink-muted);
pointer-events: none; pointer-events: none;
opacity: 1; opacity: 1;
transition: opacity .3s; transition: opacity 0.3s;
} }
.canvas-wrap.has-drawing::before { opacity: 0; } .canvas-wrap.has-drawing::before {
opacity: 0;
}
#draw-canvas { #draw-canvas {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
touch-action: none; touch-action: none;
} }
/* Score feedback overlay */ /* Score feedback overlay */
#score-feedback { #score-feedback {
position: absolute; position: absolute;
top: 20px; top: 20px;
left: 50%; left: 50%;
transform: translateX(-50%) translateY(-10px); transform: translateX(-50%) translateY(-10px);
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-size: 2rem; font-size: 2rem;
font-weight: 800; font-weight: 800;
opacity: 0; opacity: 0;
transition: opacity .4s ease, transform .4s ease; transition:
pointer-events: none; opacity 0.4s ease,
text-shadow: 0 2px 8px rgba(0,0,0,.12); transform 0.4s ease;
white-space: nowrap; pointer-events: none;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
white-space: nowrap;
} }
/* Sidebar */ /* Sidebar */
.game-sidebar { .game-sidebar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: 12px;
} }
.sidebar-card { .sidebar-card {
background: var(--glass); background: var(--glass);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,.85); border: 1px solid rgba(255, 255, 255, 0.85);
border-radius: var(--r-lg); border-radius: var(--r-lg);
padding: 18px 20px; padding: 18px 20px;
box-shadow: var(--shadow-sm); box-shadow: var(--shadow-sm);
} }
.sidebar-card__label { .sidebar-card__label {
font-size: .72rem; font-size: 0.72rem;
font-weight: 700; font-weight: 700;
letter-spacing: .08em; letter-spacing: 0.08em;
text-transform: uppercase; text-transform: uppercase;
color: var(--ink-muted); color: var(--ink-muted);
margin-bottom: 10px; margin-bottom: 10px;
} }
/* Round scores */ /* Round scores */
.round-scores { display: grid; gap: 8px; } .round-scores {
display: grid;
gap: 8px;
}
.rscore-row { .rscore-row {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 8px; gap: 8px;
} }
.rscore-label { .rscore-label {
font-size: .82rem; font-size: 0.82rem;
color: var(--ink-soft); color: var(--ink-soft);
font-weight: 500; font-weight: 500;
} }
.rscore-val { .rscore-val {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: .9rem; font-size: 0.9rem;
color: var(--ink-muted); color: var(--ink-muted);
} }
.rscore-val.filled { color: var(--sea); } .rscore-val.filled {
color: var(--sea);
}
/* Player name in sidebar */ /* Player name in sidebar */
.player-name-display { .player-name-display {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 700; font-weight: 700;
font-size: 1rem; font-size: 1rem;
color: var(--ink); color: var(--ink);
word-break: break-word; word-break: break-word;
} }
/* Controls */ /* Controls */
.game-controls { .game-controls {
display: flex; display: flex;
gap: 10px; gap: 10px;
} }
/* ─── Responsive ─── */ /* ─── Responsive ─── */
@media (max-width: 900px) { @media (max-width: 900px) {
.canvas-area { .canvas-area {
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: 1fr auto; grid-template-rows: 1fr auto;
} }
.game-sidebar { .game-sidebar {
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
} }
.sidebar-card { flex: 1 1 140px; } .sidebar-card {
flex: 1 1 140px;
}
.canvas-wrap { min-height: 340px; } .canvas-wrap {
min-height: 340px;
}
.game-topbar { .game-topbar {
grid-template-columns: auto 1fr auto; grid-template-columns: auto 1fr auto;
} }
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.game-layout { padding: 14px 0 20px; gap: 12px; } .game-layout {
padding: 14px 0 20px;
gap: 12px;
}
.game-topbar { .game-topbar {
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: auto auto auto; grid-template-rows: auto auto auto;
gap: 10px; gap: 10px;
} }
.game-country { text-align: left; } .game-country {
.game-timer { align-items: flex-start; } text-align: left;
.timer-track { width: 100%; } }
.game-timer {
align-items: flex-start;
}
.timer-track {
width: 100%;
}
.canvas-wrap { min-height: 280px; } .canvas-wrap {
min-height: 280px;
}
.game-controls { flex-direction: column; } .game-controls {
.game-controls .btn { width: 100%; } flex-direction: column;
}
.game-controls .btn {
width: 100%;
}
} }
@media (max-width: 360px) { @media (max-width: 360px) {
.country-name { font-size: 1.4rem; } .country-name {
.timer-num { font-size: 1.6rem; } font-size: 1.4rem;
.canvas-wrap { min-height: 240px; } }
.timer-num {
font-size: 1.6rem;
}
.canvas-wrap {
min-height: 240px;
}
} }

View File

@ -1,206 +1,6 @@
:root { /* index.css — landing page specific styles */
--ink: #0b1f2a;
--ink-soft: #3d5563;
--ink-muted: #7a9aaa;
--sea: #1a7fc4;
--sea-light: #4faae0;
--sea-dim: rgba(26, 127, 196, 0.12);
--leaf: #41b869;
--leaf-dim: rgba(65, 184, 105, 0.13);
--cream: #f4f9f6;
--white: #ffffff;
--glass: rgba(255, 255, 255, 0.72);
--line: rgba(11, 31, 42, 0.09);
--shadow: 0 24px 60px rgba(11, 31, 42, 0.1);
--r-xl: 32px;
--r-lg: 22px;
--r-md: 14px;
--hh: 80px;
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
font-family: "DM Sans", sans-serif;
color: var(--ink);
background: var(--cream);
overflow-x: hidden;
position: relative;
}
body::before {
content: "";
position: fixed;
inset: 0;
background:
radial-gradient(
ellipse 60% 50% at 10% 0%,
rgba(65, 184, 105, 0.12) 0%,
transparent 60%
),
radial-gradient(
ellipse 50% 60% at 90% 100%,
rgba(26, 127, 196, 0.12) 0%,
transparent 60%
);
pointer-events: none;
z-index: 0;
}
body::after {
content: "";
position: fixed;
inset: 0;
background-image:
linear-gradient(var(--line) 1px, transparent 1px),
linear-gradient(90deg, var(--line) 1px, transparent 1px);
background-size: 60px 60px;
pointer-events: none;
z-index: 0;
}
a {
color: inherit;
text-decoration: none;
}
img,
svg {
display: block;
max-width: 100%;
}
button,
input {
font: inherit;
}
.wrap {
position: relative;
z-index: 1;
}
.container {
width: 100%;
max-width: 1280px;
margin: 0 auto;
padding: 0 28px;
}
/* ─── HEADER ─── */
.header {
position: sticky;
top: 0;
z-index: 100;
height: var(--hh);
display: flex;
align-items: center;
backdrop-filter: blur(16px) saturate(1.4);
-webkit-backdrop-filter: blur(16px) saturate(1.4);
background: rgba(244, 249, 246, 0.82);
border-bottom: 1px solid var(--line);
}
.header__inner {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
}
.logo {
display: inline-flex;
align-items: center;
gap: 12px;
}
.logo__mark {
width: 44px;
height: 44px;
border-radius: 50%;
background: linear-gradient(135deg, var(--sea) 0%, var(--leaf) 100%);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
position: relative;
overflow: hidden;
}
.logo__mark svg {
width: 22px;
height: 22px;
}
.logo__text {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: 1.25rem;
letter-spacing: -0.02em;
}
.nav {
display: flex;
align-items: center;
gap: 4px;
}
.nav__link {
padding: 9px 16px;
border-radius: 999px;
font-size: 0.92rem;
font-weight: 500;
color: var(--ink-soft);
transition:
background 0.18s,
color 0.18s;
}
.nav__link:hover {
background: var(--sea-dim);
color: var(--sea);
}
.nav__cta {
margin-left: 8px;
padding: 9px 20px;
border-radius: 999px;
font-size: 0.92rem;
font-weight: 600;
color: var(--white);
background: var(--ink);
transition:
opacity 0.18s,
transform 0.18s;
}
.nav__cta:hover {
opacity: 0.82;
transform: translateY(-1px);
}
/* ─── HERO ─── */
.hero {
min-height: calc(100vh - var(--hh));
display: grid;
place-items: center;
padding: 80px 0 60px;
}
.hero__inner {
display: grid;
grid-template-columns: 1fr minmax(320px, 500px);
gap: 64px;
align-items: center;
}
/* ─── EYEBROW ─── */
.eyebrow { .eyebrow {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -237,6 +37,21 @@ input {
} }
} }
/* ─── HERO ─── */
.hero {
min-height: calc(100vh - var(--hh));
display: grid;
place-items: center;
padding: 80px 0 60px;
}
.hero__inner {
display: grid;
grid-template-columns: 1fr minmax(320px, 500px);
gap: 64px;
align-items: center;
}
.hero__title { .hero__title {
font-family: "Syne", sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
@ -269,73 +84,7 @@ input {
flex-wrap: wrap; flex-wrap: wrap;
} }
.btn { /* ─── GLOBE CARD ─── */
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 16px 30px;
border-radius: var(--r-lg);
font-family: "DM Sans", sans-serif;
font-size: 1rem;
font-weight: 600;
border: none;
cursor: pointer;
transition:
transform 0.2s,
box-shadow 0.2s,
opacity 0.2s;
}
.btn:hover {
transform: translateY(-2px);
}
.btn--primary {
color: var(--white);
background: linear-gradient(
135deg,
var(--sea) 0%,
#159fd4 50%,
var(--leaf) 100%
);
background-size: 200% 200%;
box-shadow: 0 8px 24px rgba(26, 127, 196, 0.3);
animation: gradShift 4s ease infinite;
}
@keyframes gradShift {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.btn--primary:hover {
box-shadow: 0 12px 32px rgba(26, 127, 196, 0.4);
}
.btn--ghost {
color: var(--ink-soft);
background: transparent;
border: 1.5px solid var(--line);
}
.btn--ghost:hover {
border-color: var(--ink-muted);
color: var(--ink);
}
.btn--full {
width: 100%;
}
/* Globe card */
.globe-card { .globe-card {
background: var(--glass); background: var(--glass);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
@ -494,7 +243,6 @@ input {
height: 8px; height: 8px;
border-radius: 50%; border-radius: 50%;
} }
.gb__dot--green { .gb__dot--green {
background: var(--leaf); background: var(--leaf);
} }
@ -514,28 +262,6 @@ input {
align-items: center; align-items: center;
} }
.section-label {
display: inline-block;
padding: 6px 14px;
border-radius: 999px;
background: var(--sea-dim);
color: var(--sea);
font-size: 0.82rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
margin-bottom: 20px;
}
.section-title {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: clamp(2.4rem, 4.5vw, 4rem);
line-height: 1.04;
letter-spacing: -0.03em;
margin-bottom: 20px;
}
.about__desc { .about__desc {
font-size: 1.05rem; font-size: 1.05rem;
line-height: 1.75; line-height: 1.75;
@ -543,7 +269,35 @@ input {
margin-bottom: 36px; margin-bottom: 36px;
} }
/* Steps */ .mini-globe-wrap {
background: var(--glass);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: var(--r-xl);
box-shadow: var(--shadow);
padding: 32px;
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 1;
max-width: 340px;
position: relative;
overflow: hidden;
}
.mini-globe-wrap::before {
content: "";
position: absolute;
inset: 0;
border-radius: var(--r-xl);
background: radial-gradient(
circle at 60% 40%,
rgba(26, 127, 196, 0.1),
transparent 50%
);
}
/* ─── STEPS ─── */
.steps { .steps {
display: grid; display: grid;
gap: 16px; gap: 16px;
@ -633,48 +387,6 @@ input {
margin-bottom: 30px; margin-bottom: 30px;
} }
.form {
display: grid;
gap: 20px;
}
.field {
display: grid;
gap: 8px;
}
.field label {
font-size: 0.86rem;
font-weight: 600;
color: var(--ink-soft);
letter-spacing: 0.02em;
}
.field input {
width: 100%;
height: 54px;
padding: 0 18px;
border: 1.5px solid var(--line);
border-radius: var(--r-md);
background: var(--cream);
color: var(--ink);
font-size: 0.98rem;
transition:
border-color 0.18s,
box-shadow 0.18s;
}
.field input::placeholder {
color: var(--ink-muted);
}
.field input:focus {
outline: none;
border-color: var(--sea-light);
box-shadow: 0 0 0 3px rgba(26, 127, 196, 0.12);
background: var(--white);
}
.form-footer { .form-footer {
margin-top: 8px; margin-top: 8px;
font-size: 0.84rem; font-size: 0.84rem;
@ -682,94 +394,6 @@ input {
text-align: center; text-align: center;
} }
.mini-globe-wrap {
background: var(--glass);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: var(--r-xl);
box-shadow: var(--shadow);
padding: 32px;
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 1;
max-width: 340px;
position: relative;
overflow: hidden;
}
.mini-globe-wrap::before {
content: "";
position: absolute;
inset: 0;
border-radius: var(--r-xl);
background: radial-gradient(
circle at 60% 40%,
rgba(26, 127, 196, 0.1),
transparent 50%
);
}
/* ─── FOOTER ─── */
.footer {
border-top: 1px solid var(--line);
background: rgba(255, 255, 255, 0.5);
backdrop-filter: blur(12px);
padding: 40px 0;
}
.footer__inner {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 24px;
}
.footer__brand {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: 1.5rem;
letter-spacing: -0.02em;
}
.footer__sub {
font-size: 0.86rem;
color: var(--ink-muted);
margin-top: 4px;
}
.footer__center {
text-align: center;
}
.footer__label {
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--ink-muted);
margin-bottom: 10px;
}
.footer__right {
justify-self: end;
display: flex;
gap: 22px;
flex-wrap: wrap;
justify-content: flex-end;
}
.footer__link {
font-size: 0.9rem;
color: var(--ink-muted);
transition: color 0.18s;
}
.footer__link:hover {
color: var(--ink);
}
/* ─── RESPONSIVE ─── */ /* ─── RESPONSIVE ─── */
@media (max-width: 960px) { @media (max-width: 960px) {
.hero__inner, .hero__inner,
@ -782,30 +406,12 @@ input {
.globe-card { .globe-card {
min-height: 360px; min-height: 360px;
} }
.footer__inner {
grid-template-columns: 1fr;
}
.footer__center,
.footer__right {
justify-self: start;
text-align: left;
}
.socials {
justify-content: flex-start;
}
.footer__right {
justify-content: flex-start;
}
.mini-globe-wrap { .mini-globe-wrap {
max-width: 260px; max-width: 260px;
} }
} }
@media (max-width: 680px) { @media (max-width: 680px) {
.container {
padding: 0 18px;
}
.hero { .hero {
padding: 50px 0 40px; padding: 50px 0 40px;
} }
@ -813,9 +419,6 @@ input {
.register { .register {
padding: 70px 0; padding: 70px 0;
} }
.nav__link {
display: none;
}
.register__card { .register__card {
padding: 28px 22px; padding: 28px 22px;
} }
@ -823,52 +426,15 @@ input {
padding: 24px; padding: 24px;
min-height: 280px; min-height: 280px;
} }
.header {
height: auto;
padding: 14px 0;
}
:root {
--hh: 64px;
}
} }
@media (max-width: 420px) { @media (max-width: 420px) {
.hero__title { .hero__title {
font-size: 3rem; font-size: 3rem;
} }
.section-title {
font-size: 2.2rem;
}
.btn {
padding: 14px 22px;
font-size: 0.95rem;
}
} }
@media (max-width: 360px) { @media (max-width: 360px) {
:root {
--r-xl: 22px;
--r-lg: 16px;
}
.container {
padding: 0 14px;
}
.logo__mark {
width: 36px;
height: 36px;
}
.logo__text {
font-size: 1.05rem;
}
.nav__cta {
padding: 8px 14px;
font-size: 0.84rem;
margin-left: 0;
}
.hero { .hero {
padding: 36px 0 32px; padding: 36px 0 32px;
min-height: auto; min-height: auto;
@ -881,7 +447,6 @@ input {
font-size: 0.95rem; font-size: 0.95rem;
margin-bottom: 28px; margin-bottom: 28px;
} }
.globe-card { .globe-card {
padding: 16px; padding: 16px;
min-height: 240px; min-height: 240px;
@ -890,18 +455,13 @@ input {
padding: 7px 10px; padding: 7px 10px;
font-size: 0.72rem; font-size: 0.72rem;
} }
.about, .about,
.register { .register {
padding: 52px 0; padding: 52px 0;
} }
.section-title {
font-size: 2rem;
}
.about__desc { .about__desc {
font-size: 0.95rem; font-size: 0.95rem;
} }
.step { .step {
padding: 16px 18px; padding: 16px 18px;
gap: 14px; gap: 14px;
@ -912,7 +472,6 @@ input {
font-size: 0.88rem; font-size: 0.88rem;
border-radius: 12px; border-radius: 12px;
} }
.register__card { .register__card {
padding: 22px 16px; padding: 22px 16px;
border-radius: var(--r-lg); border-radius: var(--r-lg);
@ -921,54 +480,8 @@ input {
font-size: 1.25rem; font-size: 1.25rem;
margin-bottom: 22px; margin-bottom: 22px;
} }
.field input {
height: 48px;
font-size: 0.92rem;
}
.btn--full { .btn--full {
padding: 14px 18px; padding: 14px 18px;
font-size: 0.95rem; font-size: 0.95rem;
} }
.footer {
padding: 30px 0;
}
.footer__brand {
font-size: 1.25rem;
}
.social {
width: 36px;
height: 36px;
font-size: 0.8rem;
}
.socials {
gap: 8px;
}
.footer__right {
gap: 14px;
}
}
/* ─── SCROLL REVEAL ─── */
.reveal {
opacity: 0;
transform: translateY(28px);
transition:
opacity 0.6s ease,
transform 0.6s ease;
}
.reveal.visible {
opacity: 1;
transform: translateY(0);
}
.reveal-delay-1 {
transition-delay: 0.1s;
}
.reveal-delay-2 {
transition-delay: 0.2s;
}
.reveal-delay-3 {
transition-delay: 0.32s;
} }

View File

@ -1,196 +1,247 @@
/* leader.css — leaderboard page styles */
.lb-page { .lb-page {
min-height: calc(100vh - var(--hh)); min-height: calc(100vh - var(--hh));
padding: 60px 0; padding: 60px 0;
} }
.lb-inner { .lb-inner {
max-width: 760px; max-width: 760px;
margin: 0 auto; margin: 0 auto;
} }
.lb-head { .lb-head {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: space-between; justify-content: space-between;
gap: 20px; gap: 20px;
margin-bottom: 32px; margin-bottom: 32px;
flex-wrap: wrap; flex-wrap: wrap;
} }
.lb-title { .lb-title {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: clamp(2rem, 5vw, 3.2rem); font-size: clamp(2rem, 5vw, 3.2rem);
letter-spacing: -.03em; letter-spacing: -0.03em;
line-height: 1; line-height: 1;
} }
.lb-title em { .lb-title em {
font-style: normal; font-style: normal;
background: linear-gradient(135deg, var(--sea), var(--leaf)); background: linear-gradient(135deg, var(--sea), var(--leaf));
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
background-clip: text; background-clip: text;
} }
.lb-actions { display: flex; gap: 10px; flex-wrap: wrap; } .lb-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
/* Table */ /* ─── TABLE ─── */
.lb-table { .lb-table {
background: var(--white); background: var(--white);
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: var(--r-xl); border-radius: var(--r-xl);
overflow: hidden; overflow: hidden;
box-shadow: var(--shadow); box-shadow: var(--shadow);
} }
.lb-table-head { .lb-table-head {
display: grid; display: grid;
grid-template-columns: 56px 1fr 90px 90px 90px; grid-template-columns: 56px 1fr 90px 90px 90px;
gap: 0; padding: 14px 24px;
padding: 14px 24px; background: var(--cream);
background: var(--cream); border-bottom: 1px solid var(--line);
border-bottom: 1px solid var(--line); }
}
.lb-th { .lb-th {
font-size: .72rem; font-size: 0.72rem;
font-weight: 700; font-weight: 700;
letter-spacing: .08em; letter-spacing: 0.08em;
text-transform: uppercase; text-transform: uppercase;
color: var(--ink-muted); color: var(--ink-muted);
} }
.lb-th.right { text-align: right; } .lb-th.right {
text-align: right;
}
.lb-body { display: grid; } .lb-body {
display: grid;
}
.lb-row { .lb-row {
display: grid; display: grid;
grid-template-columns: 56px 1fr 90px 90px 90px; grid-template-columns: 56px 1fr 90px 90px 90px;
align-items: center; align-items: center;
padding: 16px 24px; padding: 16px 24px;
border-bottom: 1px solid var(--line); border-bottom: 1px solid var(--line);
transition: background .15s; transition: background 0.15s;
animation: fadeRow .4s ease both; animation: fadeRow 0.4s ease both;
} }
.lb-row:last-child { border-bottom: none; } .lb-row:last-child {
border-bottom: none;
}
.lb-row:hover {
background: var(--cream);
}
.lb-row:hover { background: var(--cream); } @keyframes fadeRow {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeRow { /* ─── TOP 3 HIGHLIGHT ─── */
from { opacity: 0; transform: translateY(8px); } .lb-row.rank-1 {
to { opacity: 1; transform: translateY(0); } background: rgba(240, 180, 40, 0.07);
} }
.lb-row.rank-2 {
background: rgba(180, 180, 195, 0.06);
}
.lb-row.rank-3 {
background: rgba(205, 130, 70, 0.05);
}
/* Top 3 highlight */ .lb-rank {
.lb-row.rank-1 { background: rgba(240,180,40,.07); } font-family: "Syne", sans-serif;
.lb-row.rank-2 { background: rgba(180,180,195,.06); } font-weight: 800;
.lb-row.rank-3 { background: rgba(205,130,70,.05); } font-size: 1rem;
color: var(--ink-muted);
}
.lb-rank { .lb-row.rank-1 .lb-rank {
font-family: 'Syne', sans-serif; color: var(--gold);
font-weight: 800; }
font-size: 1rem; .lb-row.rank-2 .lb-rank {
color: var(--ink-muted); color: #a0a0b0;
} }
.lb-row.rank-3 .lb-rank {
color: #c07840;
}
.lb-row.rank-1 .lb-rank { color: var(--gold); } .lb-medal {
.lb-row.rank-2 .lb-rank { color: #a0a0b0; } font-size: 1.1rem;
.lb-row.rank-3 .lb-rank { color: #c07840; } }
.lb-medal { font-size: 1.1rem; } .lb-name {
font-family: "Syne", sans-serif;
font-weight: 700;
font-size: 0.96rem;
color: var(--ink);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lb-name { .lb-name.is-you::after {
font-family: 'Syne', sans-serif; content: " (you)";
font-weight: 700; font-weight: 400;
font-size: .96rem; font-family: "DM Sans", sans-serif;
color: var(--ink); color: var(--ink-muted);
overflow: hidden; font-size: 0.8rem;
text-overflow: ellipsis; }
white-space: nowrap;
}
.lb-name.is-you::after { .lb-rounds {
content: ' (you)'; font-size: 0.82rem;
font-weight: 400; color: var(--ink-muted);
font-family: 'DM Sans', sans-serif; text-align: right;
color: var(--ink-muted); }
font-size: .8rem;
}
.lb-rounds { .lb-date {
font-size: .82rem; font-size: 0.78rem;
color: var(--ink-muted); color: var(--ink-muted);
text-align: right; text-align: right;
} }
.lb-date { .lb-score {
font-size: .78rem; font-family: "Syne", sans-serif;
color: var(--ink-muted); font-weight: 800;
text-align: right; font-size: 1.05rem;
} color: var(--sea);
text-align: right;
}
.lb-score { .lb-score.gold {
font-family: 'Syne', sans-serif; color: var(--gold);
font-weight: 800; }
font-size: 1.05rem; .lb-score.silver {
color: var(--sea); color: #888898;
text-align: right; }
} .lb-score.bronze {
color: #c07840;
}
.lb-score.gold { color: var(--gold); } /* ─── EMPTY STATE ─── */
.lb-score.silver { color: #888898; } .lb-empty {
.lb-score.bronze { color: #c07840; } padding: 64px 24px;
text-align: center;
}
/* Empty state */ .lb-empty__icon {
.lb-empty { font-size: 3rem;
padding: 64px 24px; margin-bottom: 12px;
text-align: center; }
}
.lb-empty__icon { font-size: 3rem; margin-bottom: 12px; } .lb-empty__text {
font-size: 1rem;
color: var(--ink-soft);
margin-bottom: 20px;
}
.lb-empty__text { /* ─── CURRENT PLAYER BAR ─── */
font-size: 1rem; .your-score-bar {
color: var(--ink-soft); margin-top: 20px;
margin-bottom: 20px; padding: 16px 24px;
} background: linear-gradient(135deg, var(--sea-dim), var(--leaf-dim));
border: 1px solid rgba(26, 127, 196, 0.18);
border-radius: var(--r-lg);
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
}
/* Current player highlight bar */ .your-score-bar__text {
.your-score-bar { font-size: 0.9rem;
margin-top: 20px; color: var(--ink-soft);
padding: 16px 24px; }
background: linear-gradient(135deg, var(--sea-dim), var(--leaf-dim)); .your-score-bar__text strong {
border: 1px solid rgba(26,127,196,.18); color: var(--ink);
border-radius: var(--r-lg); }
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
}
.your-score-bar__text { /* ─── RESPONSIVE ─── */
font-size: .9rem; @media (max-width: 640px) {
color: var(--ink-soft); .lb-page {
} padding: 40px 0;
}
.your-score-bar__text strong { color: var(--ink); } .lb-table-head,
.lb-row {
grid-template-columns: 44px 1fr 72px;
}
@media (max-width: 640px) { .lb-th.hide-sm,
.lb-page { padding: 40px 0; } .lb-rounds,
.lb-table-head, .lb-date {
.lb-row { display: none;
grid-template-columns: 44px 1fr 72px; }
} }
.lb-th.hide-sm,
.lb-rounds,
.lb-date { display: none; }
}
@media (max-width: 360px) { @media (max-width: 360px) {
.lb-table-head, .lb-table-head,
.lb-row { padding: 12px 16px; } .lb-row {
} padding: 12px 16px;
}
}

View File

@ -1,202 +1,180 @@
/* lobby.css */ /* lobby.css */
.lobby { .lobby {
min-height: calc(100vh - var(--hh)); min-height: calc(100vh - var(--hh));
display: grid; display: grid;
place-items: center; place-items: center;
padding: 60px 0; padding: 60px 0;
} }
.lobby__inner { .lobby__inner {
display: grid; display: grid;
grid-template-columns: 1fr minmax(300px, 480px); grid-template-columns: 1fr minmax(300px, 480px);
gap: 64px; gap: 64px;
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
/* ─── Lobby name badge ─── */ /* ─── Lobby name badge ─── */
.lobby__name-badge { .lobby__name-badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 10px 18px; padding: 10px 18px;
border-radius: var(--r-lg); border-radius: var(--r-lg);
background: var(--glass); background: var(--glass);
border: 1px solid rgba(255,255,255,.9); border: 1px solid rgba(255, 255, 255, 0.9);
box-shadow: var(--shadow-sm); box-shadow: var(--shadow-sm);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
margin-bottom: 20px; margin-bottom: 20px;
} }
.lobby__name-icon { font-size: 1.1rem; } .lobby__name-icon {
font-size: 1.1rem;
}
#lobby-name-display { #lobby-name-display {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 700; font-weight: 700;
font-size: 1rem; font-size: 1rem;
color: var(--ink); color: var(--ink);
letter-spacing: -.01em; letter-spacing: -0.01em;
} }
/* Left side promo */ /* ─── EYEBROW ─── */
.lobby__promo {}
.eyebrow { .eyebrow {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 6px 14px 6px 10px; padding: 6px 14px 6px 10px;
border-radius: 999px; border-radius: 999px;
border: 1px solid var(--leaf-dim); border: 1px solid var(--leaf-dim);
background: rgba(65,184,105,.08); background: rgba(65, 184, 105, 0.08);
color: #289149; color: #289149;
font-size: .78rem; font-size: 0.78rem;
font-weight: 600; font-weight: 600;
letter-spacing: .05em; letter-spacing: 0.05em;
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 22px; margin-bottom: 22px;
} }
.eyebrow__dot { .eyebrow__dot {
width: 7px; width: 7px;
height: 7px; height: 7px;
border-radius: 50%; border-radius: 50%;
background: var(--leaf); background: var(--leaf);
animation: pulse 2s ease-in-out infinite; animation: pulse 2s ease-in-out infinite;
} }
@keyframes pulse { @keyframes pulse {
0%, 100% { transform: scale(1); opacity: 1; } 0%,
50% { transform: scale(1.45); opacity: .7; } 100% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.45);
opacity: 0.7;
}
} }
.lobby__title { .lobby__title {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: clamp(2.8rem, 5.5vw, 5rem); font-size: clamp(2.8rem, 5.5vw, 5rem);
line-height: .94; line-height: 0.94;
letter-spacing: -.04em; letter-spacing: -0.04em;
margin-bottom: 20px; margin-bottom: 20px;
} }
.lobby__title em { .lobby__title em {
font-style: normal; font-style: normal;
background: linear-gradient(135deg, var(--sea), var(--leaf)); background: linear-gradient(135deg, var(--sea), var(--leaf));
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
background-clip: text; background-clip: text;
} }
.lobby__desc { .lobby__desc {
font-size: 1.02rem; font-size: 1.02rem;
line-height: 1.72; line-height: 1.72;
color: var(--ink-soft); color: var(--ink-soft);
max-width: 420px; max-width: 420px;
margin-bottom: 32px; margin-bottom: 32px;
} }
.lobby__badges { .lobby__badges {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 10px; gap: 10px;
} }
.badge { .badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
padding: 8px 14px; padding: 8px 14px;
border-radius: 999px; border-radius: 999px;
background: var(--glass); background: var(--glass);
border: 1px solid rgba(255,255,255,.9); border: 1px solid rgba(255, 255, 255, 0.9);
box-shadow: var(--shadow-sm); box-shadow: var(--shadow-sm);
font-size: .82rem; font-size: 0.82rem;
font-weight: 600; font-weight: 600;
color: var(--ink-soft); color: var(--ink-soft);
backdrop-filter: blur(8px); backdrop-filter: blur(8px);
} }
.badge__icon { font-size: 1rem; } .badge__icon {
font-size: 1rem;
}
/* Right side card */ /* Right side card */
.lobby__card { .lobby__card {
background: var(--white); background: var(--white);
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: var(--r-xl); border-radius: var(--r-xl);
padding: 44px; padding: 44px;
box-shadow: var(--shadow); box-shadow: var(--shadow);
} }
.lobby__card-title { .lobby__card-title {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: 1.5rem; font-size: 1.5rem;
letter-spacing: -.02em; letter-spacing: -0.02em;
margin-bottom: 8px; margin-bottom: 8px;
} }
.lobby__card-sub { .lobby__card-sub {
font-size: .9rem; font-size: 0.9rem;
color: var(--ink-muted); color: var(--ink-muted);
margin-bottom: 30px; margin-bottom: 30px;
} }
.form { display: grid; gap: 20px; } /* Form and field styles are defined in main.css */
.field { display: grid; gap: 8px; }
.field label {
font-size: .84rem;
font-weight: 600;
color: var(--ink-soft);
letter-spacing: .02em;
}
.field input {
width: 100%;
height: 54px;
padding: 0 18px;
border: 1.5px solid var(--line);
border-radius: var(--r-md);
background: var(--cream);
color: var(--ink);
font-size: .98rem;
transition: border-color .18s, box-shadow .18s;
}
.field input::placeholder { color: var(--ink-muted); }
.field input:focus {
outline: none;
border-color: var(--sea-light);
box-shadow: 0 0 0 3px rgba(26,127,196,.12);
background: var(--white);
}
.field input.input--error {
border-color: var(--danger);
box-shadow: 0 0 0 3px rgba(224,92,92,.12);
}
.field-error {
font-size: .82rem;
color: var(--danger);
min-height: 1.2em;
transition: opacity .18s;
}
/* ─── Responsive ─── */ /* ─── Responsive ─── */
@media (max-width: 900px) { @media (max-width: 900px) {
.lobby__inner { grid-template-columns: 1fr; gap: 40px; } .lobby__inner {
grid-template-columns: 1fr;
gap: 40px;
}
} }
@media (max-width: 680px) { @media (max-width: 680px) {
.lobby { padding: 44px 0; } .lobby {
.lobby__card { padding: 28px 22px; } padding: 44px 0;
}
.lobby__card {
padding: 28px 22px;
}
} }
@media (max-width: 360px) { @media (max-width: 360px) {
.lobby__card { padding: 22px 16px; } .lobby__card {
.lobby__title { font-size: 2.4rem; } padding: 22px 16px;
}
.lobby__title {
font-size: 2.4rem;
}
} }

View File

@ -1,78 +1,107 @@
/* main.css — shared design tokens & base */ /* main.css — shared design tokens & base */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600&display=swap'); @import url("https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600&display=swap");
:root { :root {
--ink: #0b1f2a; --ink: #0b1f2a;
--ink-soft: #3d5563; --ink-soft: #3d5563;
--ink-muted: #7a9aaa; --ink-muted: #7a9aaa;
--sea: #1a7fc4; --sea: #1a7fc4;
--sea-light: #4faae0; --sea-light: #4faae0;
--sea-dim: rgba(26,127,196,.12); --sea-dim: rgba(26, 127, 196, 0.12);
--leaf: #41b869; --leaf: #41b869;
--leaf-dim: rgba(65,184,105,.13); --leaf-dim: rgba(65, 184, 105, 0.13);
--gold: #f0b429; --gold: #f0b429;
--danger: #e05c5c; --danger: #e05c5c;
--cream: #f4f9f6; --cream: #f4f9f6;
--white: #ffffff; --white: #ffffff;
--glass: rgba(255,255,255,.72); --glass: rgba(255, 255, 255, 0.72);
--line: rgba(11,31,42,.09); --line: rgba(11, 31, 42, 0.09);
--shadow: 0 24px 60px rgba(11,31,42,.10); --shadow: 0 24px 60px rgba(11, 31, 42, 0.1);
--shadow-sm: 0 4px 20px rgba(11,31,42,.07); --shadow-sm: 0 4px 20px rgba(11, 31, 42, 0.07);
--r-xl: 32px; --r-xl: 32px;
--r-lg: 22px; --r-lg: 22px;
--r-md: 14px; --r-md: 14px;
--r-sm: 8px; --r-sm: 8px;
--hh: 72px; --hh: 72px;
} }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } *,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html { scroll-behavior: smooth; } html {
scroll-behavior: smooth;
}
body { body {
font-family: 'DM Sans', sans-serif; font-family: "DM Sans", sans-serif;
color: var(--ink); color: var(--ink);
background: var(--cream); background: var(--cream);
overflow-x: hidden; overflow-x: hidden;
position: relative; position: relative;
min-width: 320px; min-width: 320px;
} }
body::before { body::before {
content: ''; content: "";
position: fixed; position: fixed;
inset: 0; inset: 0;
background: background:
radial-gradient(ellipse 60% 50% at 10% 0%, rgba(65,184,105,.10) 0%, transparent 60%), radial-gradient(
radial-gradient(ellipse 50% 60% at 90% 100%, rgba(26,127,196,.10) 0%, transparent 60%); ellipse 60% 50% at 10% 0%,
pointer-events: none; rgba(65, 184, 105, 0.1) 0%,
z-index: 0; transparent 60%
),
radial-gradient(
ellipse 50% 60% at 90% 100%,
rgba(26, 127, 196, 0.1) 0%,
transparent 60%
);
pointer-events: none;
z-index: 0;
} }
body::after { body::after {
content: ''; content: "";
position: fixed; position: fixed;
inset: 0; inset: 0;
background-image: background-image:
linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(var(--line) 1px, transparent 1px),
linear-gradient(90deg, var(--line) 1px, transparent 1px); linear-gradient(90deg, var(--line) 1px, transparent 1px);
background-size: 60px 60px; background-size: 60px 60px;
pointer-events: none; pointer-events: none;
z-index: 0; z-index: 0;
} }
a { color: inherit; text-decoration: none; } a {
img, svg { display: block; max-width: 100%; } color: inherit;
button, input { font: inherit; } text-decoration: none;
}
img,
svg {
display: block;
max-width: 100%;
}
button,
input {
font: inherit;
}
.wrap { position: relative; z-index: 1; } .wrap {
position: relative;
z-index: 1;
}
.container { .container {
width: 100%; width: 100%;
max-width: 1280px; max-width: 1280px;
margin: 0 auto; margin: 0 auto;
padding: 0 28px; padding: 0 28px;
} }
.header { .header {
@ -166,91 +195,174 @@ button, input { font: inherit; }
transform: translateY(-1px); transform: translateY(-1px);
} }
/* ─── BUTTONS ─── */ /* ─── BUTTONS ─── */
.btn { .btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8px; gap: 8px;
padding: 15px 28px; padding: 15px 28px;
border-radius: var(--r-lg); border-radius: var(--r-lg);
font-family: 'DM Sans', sans-serif; font-family: "DM Sans", sans-serif;
font-size: 1rem; font-size: 1rem;
font-weight: 600; font-weight: 600;
border: none; border: none;
cursor: pointer; cursor: pointer;
transition: transform .2s, box-shadow .2s, opacity .2s; transition:
line-height: 1; transform 0.2s,
box-shadow 0.2s,
opacity 0.2s;
line-height: 1;
} }
.btn:hover:not(:disabled) { transform: translateY(-2px); } .btn:hover:not(:disabled) {
.btn:disabled { opacity: .45; cursor: not-allowed; } transform: translateY(-2px);
}
.btn:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.btn--primary { .btn--primary {
color: var(--white); color: var(--white);
background: linear-gradient(135deg, var(--sea) 0%, #159fd4 50%, var(--leaf) 100%); background: linear-gradient(
background-size: 200% 200%; 135deg,
box-shadow: 0 8px 24px rgba(26,127,196,.28); var(--sea) 0%,
animation: gradShift 4s ease infinite; #159fd4 50%,
var(--leaf) 100%
);
background-size: 200% 200%;
box-shadow: 0 8px 24px rgba(26, 127, 196, 0.28);
animation: gradShift 4s ease infinite;
} }
.btn--primary:hover:not(:disabled) { box-shadow: 0 12px 32px rgba(26,127,196,.4); } .btn--primary:hover:not(:disabled) {
box-shadow: 0 12px 32px rgba(26, 127, 196, 0.4);
}
@keyframes gradShift { @keyframes gradShift {
0% { background-position: 0% 50%; } 0% {
50% { background-position: 100% 50%; } background-position: 0% 50%;
100% { background-position: 0% 50%; } }
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
} }
.btn--ghost { .btn--ghost {
color: var(--ink-soft); color: var(--ink-soft);
background: transparent; background: transparent;
border: 1.5px solid var(--line); border: 1.5px solid var(--line);
} }
.btn--ghost:hover:not(:disabled) { border-color: var(--ink-muted); color: var(--ink); } .btn--ghost:hover:not(:disabled) {
border-color: var(--ink-muted);
color: var(--ink);
}
.btn--danger { .btn--danger {
color: var(--white); color: var(--white);
background: var(--danger); background: var(--danger);
box-shadow: 0 6px 18px rgba(224,92,92,.25); box-shadow: 0 6px 18px rgba(224, 92, 92, 0.25);
} }
.btn--full { width: 100%; } .btn--full {
width: 100%;
}
.btn--sm { padding: 10px 20px; font-size: .88rem; border-radius: var(--r-md); } .btn--sm {
padding: 10px 20px;
font-size: 0.88rem;
border-radius: var(--r-md);
}
/* ─── CARD ─── */ /* ─── CARD ─── */
.card { .card {
background: var(--glass); background: var(--glass);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,.8); border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: var(--r-xl); border-radius: var(--r-xl);
box-shadow: var(--shadow); box-shadow: var(--shadow);
} }
/* ─── SECTION LABELS ─── */ /* ─── SECTION LABELS ─── */
.section-label { .section-label {
display: inline-block; display: inline-block;
padding: 5px 13px; padding: 5px 13px;
border-radius: 999px; border-radius: 999px;
background: var(--sea-dim); background: var(--sea-dim);
color: var(--sea); color: var(--sea);
font-size: .78rem; font-size: 0.78rem;
font-weight: 600; font-weight: 600;
letter-spacing: .06em; letter-spacing: 0.06em;
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 16px; margin-bottom: 16px;
} }
.section-title { .section-title {
font-family: 'Syne', sans-serif; font-family: "Syne", sans-serif;
font-weight: 800; font-weight: 800;
font-size: clamp(2rem, 4vw, 3.6rem); font-size: clamp(2rem, 4vw, 3.6rem);
line-height: 1.04; line-height: 1.04;
letter-spacing: -.03em; letter-spacing: -0.03em;
margin-bottom: 16px; margin-bottom: 16px;
}
/* ─── FORM ─── */
.form {
display: grid;
gap: 20px;
}
.field {
display: grid;
gap: 8px;
}
.field label {
font-size: 0.84rem;
font-weight: 600;
color: var(--ink-soft);
letter-spacing: 0.02em;
}
.field input {
width: 100%;
height: 54px;
padding: 0 18px;
border: 1.5px solid var(--line);
border-radius: var(--r-md);
background: var(--cream);
color: var(--ink);
font-size: 0.98rem;
transition:
border-color 0.18s,
box-shadow 0.18s;
}
.field input::placeholder {
color: var(--ink-muted);
}
.field input:focus {
outline: none;
border-color: var(--sea-light);
box-shadow: 0 0 0 3px rgba(26, 127, 196, 0.12);
background: var(--white);
}
.field input.input--error {
border-color: var(--danger);
box-shadow: 0 0 0 3px rgba(224, 92, 92, 0.12);
}
.field-error {
font-size: 0.82rem;
color: var(--danger);
min-height: 1.2em;
} }
/* ─── FOOTER ─── */ /* ─── FOOTER ─── */
@ -285,7 +397,6 @@ button, input { font: inherit; }
text-align: center; text-align: center;
} }
.footer__label { .footer__label {
font-size: 0.7rem; font-size: 0.7rem;
font-weight: 700; font-weight: 700;
@ -315,30 +426,88 @@ button, input { font: inherit; }
/* ─── SCROLL REVEAL ─── */ /* ─── SCROLL REVEAL ─── */
.reveal { .reveal {
opacity: 0; opacity: 0;
transform: translateY(24px); transform: translateY(24px);
transition: opacity .55s ease, transform .55s ease; transition:
opacity 0.55s ease,
transform 0.55s ease;
} }
.reveal.visible { opacity: 1; transform: translateY(0); } .reveal.visible {
.reveal-delay-1 { transition-delay: .1s; } opacity: 1;
.reveal-delay-2 { transition-delay: .2s; } transform: translateY(0);
.reveal-delay-3 { transition-delay: .32s; } }
.reveal-delay-1 {
transition-delay: 0.1s;
}
.reveal-delay-2 {
transition-delay: 0.2s;
}
.reveal-delay-3 {
transition-delay: 0.32s;
}
/* ─── NOSCRIPT ─── */
.noscript-msg {
padding: 1.5rem 2rem;
background: var(--danger);
color: var(--white);
font-weight: 600;
text-align: center;
}
/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* ─── RESPONSIVE BASE ─── */ /* ─── RESPONSIVE BASE ─── */
@media (max-width: 680px) { @media (max-width: 680px) {
.container { padding: 0 18px; } .container {
.nav__link { display: none; } padding: 0 18px;
.footer__inner { grid-template-columns: 1fr; } }
.footer__center, .footer__right { justify-self: start; text-align: left; } .nav__link {
.socials { justify-content: flex-start; } display: none;
.footer__right { justify-content: flex-start; } }
.footer__inner {
grid-template-columns: 1fr;
}
.footer__center,
.footer__right {
justify-self: start;
text-align: left;
}
.socials {
justify-content: flex-start;
}
.footer__right {
justify-content: flex-start;
}
} }
@media (max-width: 360px) { @media (max-width: 360px) {
:root { --r-xl: 22px; --r-lg: 16px; } :root {
.container { padding: 0 14px; } --r-xl: 22px;
.logo__mark { width: 34px; height: 34px; } --r-lg: 16px;
.logo__text { font-size: 1.05rem; } }
.nav__cta { padding: 7px 12px; font-size: .82rem; } .container {
padding: 0 14px;
}
.logo__mark {
width: 34px;
height: 34px;
}
.logo__text {
font-size: 1.05rem;
}
.nav__cta {
padding: 7px 12px;
font-size: 0.82rem;
}
} }

230
frontend/styles/results.css Normal file
View File

@ -0,0 +1,230 @@
/* results.css — results page styles */
.results-page {
min-height: calc(100vh - var(--hh));
display: grid;
place-items: center;
padding: 60px 0;
}
.results-inner {
width: 100%;
max-width: 680px;
display: grid;
gap: 24px;
}
/* ─── HEADER ─── */
.results-header {
text-align: center;
}
.results-emoji {
font-size: 3.5rem;
margin-bottom: 16px;
display: block;
animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn {
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.results-title {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: clamp(2rem, 5vw, 3.4rem);
letter-spacing: -0.03em;
line-height: 1.05;
margin-bottom: 8px;
}
.results-player {
font-size: 1rem;
color: var(--ink-soft);
}
.results-player strong {
color: var(--ink);
}
/* ─── TOTAL SCORE ─── */
.score-total-card {
background: linear-gradient(
135deg,
var(--sea) 0%,
#159fd4 50%,
var(--leaf) 100%
);
border-radius: var(--r-xl);
padding: 36px 40px;
text-align: center;
color: var(--white);
box-shadow: 0 16px 40px rgba(26, 127, 196, 0.3);
animation: slideUp 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes slideUp {
from {
transform: translateY(30px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.score-total-label {
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
opacity: 0.78;
margin-bottom: 8px;
}
.score-total-num {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: clamp(4rem, 10vw, 6rem);
line-height: 1;
letter-spacing: -0.04em;
}
.score-total-max {
font-size: 1.4rem;
opacity: 0.6;
font-weight: 400;
}
.score-grade {
display: inline-block;
margin-top: 12px;
padding: 4px 18px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.22);
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: 1.1rem;
letter-spacing: 0.04em;
}
/* ─── ROUND BREAKDOWN ─── */
.rounds-card {
background: var(--white);
border: 1px solid var(--line);
border-radius: var(--r-xl);
padding: 28px 32px;
box-shadow: var(--shadow-sm);
animation: slideUp 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.rounds-card-title {
font-family: "Syne", sans-serif;
font-weight: 700;
font-size: 1rem;
letter-spacing: -0.01em;
margin-bottom: 20px;
color: var(--ink-soft);
}
.round-rows {
display: grid;
gap: 14px;
}
.round-row {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 16px;
}
.round-row__label {
font-size: 0.82rem;
font-weight: 600;
color: var(--ink-soft);
white-space: nowrap;
}
.round-row__bar-wrap {
height: 8px;
background: var(--cream);
border-radius: 999px;
overflow: hidden;
}
.round-row__bar {
height: 100%;
border-radius: 999px;
background: linear-gradient(90deg, var(--sea), var(--leaf));
transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.round-row__score {
font-family: "Syne", sans-serif;
font-weight: 800;
font-size: 0.9rem;
color: var(--sea);
min-width: 36px;
text-align: right;
}
/* ─── COUNTRY TAGS ─── */
.countries-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.country-tag {
padding: 5px 12px;
border-radius: 999px;
background: var(--sea-dim);
color: var(--sea);
font-size: 0.8rem;
font-weight: 600;
}
/* ─── ACTIONS ─── */
.results-actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
animation: slideUp 0.5s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.results-actions .btn {
flex: 1 1 180px;
}
/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
.results-page {
padding: 40px 0;
}
.score-total-card {
padding: 28px 24px;
}
.rounds-card {
padding: 22px 20px;
}
.results-actions .btn {
flex-basis: 100%;
}
}
@media (max-width: 360px) {
.score-total-num {
font-size: 3.4rem;
}
}