:root{
  --bg:#0b0f10; --panel:#0f1719; --ink:#f5deb3; --muted:#cfc4a6;
  --teal:#55A1B3; --sky:#69D5FF; --red:#e11d48; --green:#22c55e; --card:#0e1416;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:#fff;
  font-family:'Nunito Sans',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  -webkit-tap-highlight-color:transparent;
}

/* ==================== HEADER ==================== */
.header{
  position:sticky; top:0; z-index:5;
  background:linear-gradient(180deg, rgba(11,15,16,.95), rgba(11,15,16,.75));
  backdrop-filter: blur(6px);
  border-bottom:1px solid rgba(85,161,179,.25);
}

.wrap{
  max-width:980px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

/* Logo - Clickable to home */
.yk-logo{
  display:inline-flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  color:inherit;
  user-select:none;
  transition:opacity 0.2s ease;
  cursor:pointer;
}
.yk-logo:hover{
  opacity:0.85;
}

.yk-mark{width:44px;height:44px;display:block}
.yk-word{display:flex;flex-direction:column;line-height:1}
.yk-you,.yk-know{
  font-family:'Barlow Condensed',sans-serif;
  font-weight:800;
  letter-spacing:.5px;
  font-size:clamp(22px,4.2vw,34px);
}
.yk-you{
  color:var(--ink);
  text-shadow:0 0 10px rgba(245,222,179,.15);
  transform:translateY(1px);
}
.yk-know{
  background:linear-gradient(90deg,var(--sky),var(--teal));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  text-shadow:0 0 18px rgba(105,213,255,.18);
  margin-top:-2px;
}
.yk-tag{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
  letter-spacing:.2px;
  opacity:.9;
}

/* Navigation Container */
.nav-container{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}

/* Navigation Buttons (Leaderboard, History) */
.nav-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:8px 14px;
  border-radius:8px;
  font-size:14px;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
  transition:all 0.2s ease;
  border:1px solid var(--teal);
  background:transparent;
  color:var(--ink);
  min-height:44px;
  white-space:nowrap;
}

.nav-button:hover{
  background:rgba(85,161,179,0.1);
  border-color:var(--sky);
}

.nav-button.active{
  background:var(--teal);
  color:var(--bg);
  border-color:var(--teal);
  box-shadow:0 0 12px rgba(105,213,255,0.3);
}

.nav-button svg{
  width:16px;
  height:16px;
}

/* Profile Button */
.profile-btn{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:8px 14px;
  border-radius:8px;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  border:none;
  min-height:44px;
  white-space:nowrap;
  transition:all 0.2s ease;
}

/* Profile button when logged in */
.profile-btn.logged-in{
  background:var(--teal);
  color:var(--bg);
}

.profile-btn.logged-in:hover{
  background:#4a8f9f;
}

/* Profile button when guest */
.profile-btn.guest{
  background:linear-gradient(90deg, var(--teal), var(--sky));
  color:var(--bg);
  box-shadow:0 4px 0 #2b7685;
}

.profile-btn.guest:active{
  transform:translateY(2px);
  box-shadow:0 2px 0 #2b7685;
}

.profile-btn svg{
  width:16px;
  height:16px;
}

/* Nickname Display */
.nickname-display{
  max-width:120px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Profile Dropdown */
.profile-dropdown{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  min-width:180px;
  background:var(--panel);
  border:1px solid var(--teal);
  border-radius:12px;
  padding:12px;
  box-shadow:0 8px 24px rgba(0,0,0,0.4);
  z-index:100;
  display:none;
}

.profile-dropdown.show{
  display:block;
  animation:dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide{
  from{
    opacity:0;
    transform:translateY(-8px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

.profile-dropdown-header{
  color:var(--ink);
  font-weight:700;
  padding:8px 12px;
  border-bottom:1px solid rgba(85,161,179,0.2);
  word-break:break-word;
}

.profile-dropdown-item{
  width:100%;
  background:transparent;
  border:none;
  color:var(--muted);
  padding:10px 12px;
  text-align:left;
  cursor:pointer;
  border-radius:6px;
  font-size:14px;
  margin-top:4px;
  transition:all 0.2s ease;
  display:flex;
  align-items:center;
  gap:8px;
}

.profile-dropdown-item:hover{
  background:rgba(85,161,179,0.1);
  color:var(--ink);
}

/* Mobile Responsive */
@media(max-width:640px){
  .yk-mark{width:36px;height:36px}
  .yk-tag{display:none}
  
  .nav-container{gap:6px}
  
  /* Abbreviated text on mobile */
  .nav-button .btn-text-full{display:none!important}
  .nav-button .btn-text-short{display:inline!important}
  
  .nav-button{
    padding:10px 12px;
    font-size:13px;
    min-width:44px;
  }
  
  .profile-btn{
    padding:10px!important;
    min-width:44px!important;
    max-width:44px!important;
  }
  
  /* Force hide all text content in profile button on mobile */
  .profile-btn .nickname-display{display:none!important;width:0!important;overflow:hidden!important}
  .profile-btn #profileBtnText{display:none!important;width:0!important;overflow:hidden!important}
  .profile-btn #profileChevron{display:none!important;width:0!important}
  
  /* Adjust dropdown for mobile */
  .profile-dropdown{
    right:0;
    left:auto;
    min-width:160px;
  }
}

@media(min-width:641px){
  .nav-button .btn-text-short{display:none}
  .nav-button .btn-text-full{display:inline}
}

/* ==================== LAYOUT ==================== */
.main{max-width:880px;margin:28px auto;padding:0 16px;display:grid;gap:18px}
.card{background:var(--panel);border:1px solid rgba(85,161,179,.18);border-radius:16px;padding:18px 16px;box-shadow:0 18px 48px rgba(0,0,0,.28)}
.hero{display:grid;align-items:center;padding:24px 20px}
.hero-title{font:800 40px/1 'Barlow Condensed',sans-serif;color:var(--ink);margin:0 0 6px}
.hero-sub{color:#cdefff;margin:0 0 12px;font-weight:700}
.cta-row{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 6px}
.meta{margin-top:2px;color:var(--muted);font-size:14px;display:flex;gap:10px;flex-wrap:wrap}
.muted{color:var(--muted)}
.tiny{font-size:12px}

/* ==================== BUTTONS ==================== */
.btn{
  border:none;
  border-radius:12px;
  padding:12px 14px;
  font-weight:900;
  cursor:pointer;
  background:linear-gradient(90deg,var(--teal),var(--sky));
  color:#0b0f10;
  box-shadow:0 6px 0 #2b7685;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:transform 0.1s ease;
}
.btn:active{
  transform:translateY(2px);
  box-shadow:0 4px 0 #2b7685;
}
.btn.outline{
  background:transparent;
  color:var(--ink);
  border:2px solid var(--teal);
  box-shadow:none;
}
.btn.outline:active{
  transform:scale(0.98);
}
.playBtn{font-size:16px}

/* ==================== LEADERBOARD ==================== */
.lb-card h2{margin:0 0 12px;font:800 28px/1 'Barlow Condensed',sans-serif;color:var(--ink)}
.lb-list{display:grid;gap:8px}
.lb-row{
  display:grid;
  grid-template-columns:32px minmax(100px,1fr) auto auto;
  gap:10px;
  align-items:center;
  background:#10171a;
  border:1px solid rgba(85,161,179,.18);
  border-radius:12px;
  padding:10px 12px;
}
.lb-row .rank{font-weight:800;color:#cdefff;opacity:.9;font-size:15px}
.lb-row .nickname{font-weight:800;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.lb-row .score{font-weight:800;color:#fff;white-space:nowrap}
.lb-row .time{color:#cdefff;font-size:14px;white-space:nowrap;opacity:.85}
.skeleton{height:36px;border-radius:12px;background:linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.08), rgba(255,255,255,.05));animation:sheen 1.2s linear infinite}
@keyframes sheen{from{background-position:-200px 0} to{background-position:200px 0}}

/* ==================== HOW IT WORKS ==================== */
.how h2{margin:0 0 8px;font:800 24px/1 'Barlow Condensed',sans-serif;color:var(--ink)}
.steps{margin:0;padding-left:18px}
.steps li{margin:6px 0;color:#cdefff}

/* ==================== FOOTER ==================== */
.footer{opacity:.8;border-top:1px solid rgba(85,161,179,.18);margin-top:24px}
.footer .wrap{justify-content:center}