:root { --gold:#ffd23f; --blue:#0a1a7a; --blue2:#1e90ff; }
* { box-sizing: border-box; }
body {
    margin: 0; min-height: 100vh; color: #fff;
    font-family: "Trebuchet MS", Verdana, sans-serif;
    background: #1a9a2e url(../img/background.png) center top / cover fixed no-repeat;
    -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }

.topbar { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; }
.abbott { height: 26px; }
.logo { display:block; width: min(80vw, 340px); margin: 0 auto; }
.logo-sm { height: 44px; }

.container { width: min(94vw, 480px); margin: 0 auto; padding-bottom: 24px; }
.card {
    background: rgba(0,20,90,.85); border: 2px solid var(--blue2);
    border-radius: 18px; padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
label { display:block; font-weight:bold; margin-bottom:14px; }
input[type=text], input[type=password] {
    width:100%; padding:12px; border-radius:10px; border:none; font-size:16px; margin-top:6px;
}
.selfie-pick {
    text-align:center; padding:14px; border:2px dashed var(--blue2);
    border-radius:12px; cursor:pointer;
}
.preview {
    display:none; width:160px; height:160px; object-fit:cover; border-radius:50%;
    margin:12px auto; border:4px solid var(--gold);
}
.msg { color: var(--gold); text-align:center; min-height:20px; }
.opt { font-weight: normal; display:block; margin: 10px 0; }

.btn {
    display:block; width:100%; padding:14px; margin-top:12px; border:none; border-radius:999px;
    background: linear-gradient(#ffe066, #ffb703); color: var(--blue);
    font-size:18px; font-weight:bold; cursor:pointer; text-decoration:none; text-align:center;
}
.btn.alt { background: linear-gradient(#4cc9f0, #1e90ff); color:#fff; }
.btn:disabled { opacity:.6; }

/* HUD */
.hud {
    display:grid; grid-template-columns: repeat(5, 1fr); gap:6px;
    width: min(94vw, 480px); margin: 0 auto 12px;
}
.hud div {
    background: rgba(0,20,90,.85); border:1px solid var(--blue2); border-radius:12px;
    text-align:center; padding:6px 2px;
}
.hud span { display:block; font-size:11px; opacity:.85; }
.hud b { font-size:16px; }

/* Banner */
.banner {
    position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
    background: var(--gold); color: var(--blue); font-weight:bold;
    padding: 10px 18px; border-radius: 999px; z-index: 9;
    box-shadow: 0 4px 12px rgba(0,0,0,.3); max-width: 90vw; text-align:center;
}

/* Board */
.board {
    display:grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    width: min(94vw, 480px); margin: 0 auto; padding-bottom: 30px;
}
.tile {
    perspective: 800px; aspect-ratio: 1; width:100%; padding:0;
    border:0; background:none; cursor:pointer;
}
.inner {
    position:relative; width:100%; height:100%;
    transition: transform .45s; transform-style: preserve-3d;
}
.tile.flipped .inner { transform: rotateY(180deg); }
.face {
    position:absolute; inset:0; border-radius:12px;
    backface-visibility:hidden; -webkit-backface-visibility:hidden;
    display:flex; align-items:center; justify-content:center;
}
.back {
    background: linear-gradient(135deg, #0a1a7a, #1e3ab8);
    border: 2px solid var(--blue2);
}
.back::after { content:"★"; color: var(--gold); font-size: 26px; }
.front {
    background:#fff; border: 3px solid var(--gold); transform: rotateY(180deg);
}
.front img { width:70%; height:70%; object-fit:contain; }
.tile.matched .front { border-color:#4cff7a; box-shadow: 0 0 14px #4cff7a; }

/* Metrics */
.metrics { display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-bottom: 8px; }
.metric {
    background: rgba(255,255,255,.1); border-radius:12px; padding:12px; text-align:center;
}
.metric span { display:block; font-size:13px; opacity:.85; }
.metric b { display:block; font-size:24px; color: var(--gold); }

/* Leaderboard */
.lb li {
    list-style:none; display:flex; align-items:center; gap:10px;
    background: rgba(255,255,255,.1); padding:8px; border-radius:12px; margin-bottom:8px;
}
.lb img {
    width:48px; height:48px; border-radius:50%; object-fit:cover; border:2px solid var(--gold);
}
.rank { font-weight:bold; color: var(--gold); width: 36px; }

/* Tablet */
@media (min-width: 768px) {
    .container, .hud, .board { width: min(80vw, 600px); }
    .board { gap: 12px; }
    .hud b { font-size: 20px; }
}

/* Screenshot guard */
.no-capture { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.no-capture img { pointer-events: none; -webkit-user-drag: none; }
@media print { body { display: none !important; } }

.guard {
    position: fixed; inset: 0; z-index: 99;
    background: rgba(0, 0, 0, .95);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.guard-box {
    background: var(--blue); border: 2px solid var(--gold); border-radius: 18px;
    padding: 24px; text-align: center; max-width: 360px; width: 100%;
}
.guard-box h3 { margin: 0 0 10px; color: var(--gold); }

/* Hint and rank */
.hint { font-size: 13px; opacity: .85; text-align: center; margin: 6px 0 12px; }
.rank-banner {
    text-align: center; background: rgba(255, 210, 63, .15); border: 1px dashed var(--gold);
    border-radius: 12px; padding: 10px; margin: 12px 0; font-size: 16px;
}
.rank-banner b { color: var(--gold); font-size: 22px; }

/* Leaderboard: highlight the current player */
.lb { padding: 0; margin: 0; }
.lb li {
    list-style: none; display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, .1); padding: 8px; border-radius: 12px; margin-bottom: 8px;
}
.lb li.me {
    background: rgba(255, 210, 63, .25);
    outline: 3px solid var(--gold);
}
.lb img {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold);
}
.lb .who { flex: 1; min-width: 0; }
.lb .pts { text-align: right; }
.lb .pts b { color: var(--gold); display: block; }
.lb .rank { font-weight: bold; color: var(--gold); width: 36px; }

/* SVG icons on card faces */
.front img { width: 70%; height: 70%; object-fit: contain; }