body{

background:#111;

color:white;

font-family:Arial;

text-align:center;

}




#game{

position:relative;

width:400px;

height:400px;

margin:auto;

overflow:hidden;

border:2px solid white;

background:#222;

}





.note{
animation: spawn .15s;

position:absolute;

width:50px;

height:50px;

background:#ffcc00;

border-radius:50%;

line-height:50px;

color:black;

font-size:30px;

text-align:center;

}





#game:after{


content:"";


position:absolute;


bottom:70px;


left:0;


width:100%;


height:5px;


background:white;


}





#feedback{


position:fixed;


top:40%;


left:50%;


transform:
translate(-50%,-50%);


font-size:50px;


font-weight:bold;


animation:
pop .5s;


}




@keyframes pop{


0%{

transform:
translate(-50%,-50%)
scale(.5);

}


100%{

transform:
translate(-50%,-50%)
scale(1);

}


}




#score,
#opponent,
#countdown{

font-size:30px;

margin:10px;

}

/* =====================
   FEEDBACK V1
===================== */

#feedback {

    position: fixed;

    top: 35%;
    left: 50%;

    transform:
    translate(-50%, -50%);


    font-size: 55px;

    font-weight: bold;


    opacity: 0;

    pointer-events: none;

    z-index: 999;

}




#feedback.show {


    animation:
    feedbackPop 0.7s;


}




@keyframes feedbackPop {


    0% {

        opacity:0;

        transform:
        translate(-50%,-50%)
        scale(.5);

    }



    30% {

        opacity:1;

        transform:
        translate(-50%,-50%)
        scale(1.2);

    }



    100% {

        opacity:0;

        transform:
        translate(-50%,-50%)
        scale(1);

    }


}


@keyframes spawn{

    from{

        opacity:0;
        transform:
        scale(.5);

    }

    to{

        opacity:1;
        transform:
        scale(1);

    }

}


.note-hit{

    animation:
    noteHit .15s forwards;

}

@keyframes noteHit{

    to{

        opacity:0;

        transform:
        scale(1.6);

    }

}

.note-miss{

    animation:
    noteMiss .3s forwards;

}

@keyframes noteMiss{

    to{

        opacity:0;

        transform:
        translateY(30px);

    }

}

.flash{

animation:
flashEffect 1s;

}


@keyframes flashEffect{

0%{
filter:brightness(5);
}

100%{
filter:brightness(1);
}

}

.shake{

animation:
shakeAnimation 0.5s;

}


@keyframes shakeAnimation{


0%{
transform:translate(0);
}


25%{
transform:translate(10px,5px);
}


50%{
transform:translate(-10px,-5px);
}


75%{
transform:translate(10px,-5px);
}


100%{
transform:translate(0);
}

}

#shieldStatus{

  margin:10px;

  font-weight:bold;

}

/* =====================
   AUTH PANEL
===================== */

#authPanel {
  margin: 40px auto;
  width: 300px;
}

#authTabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 2px solid #444;
}

.tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  transition: color .2s;
}

.tab.active {
  color: #ffcc00;
  border-bottom: 2px solid #ffcc00;
  margin-bottom: -2px;
}

#authForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#authForm input {
  padding: 12px;
  background: #222;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  font-size: 16px;
  text-align: center;
  outline: none;
  transition: border-color .2s;
}

#authForm input:focus {
  border-color: #ffcc00;
}

#authSubmit {
  padding: 12px;
  background: #ffcc00;
  border: none;
  border-radius: 6px;
  color: black;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity .2s;
}

#authSubmit:hover {
  opacity: .85;
}

#authSubmit:disabled {
  opacity: .4;
  cursor: not-allowed;
}

#authError {
  color: #ff5555;
  font-size: 14px;
  min-height: 20px;
}

/* =====================
   USER BAR
===================== */

#userBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 16px;
}

#userBarName {
  font-weight: bold;
  color: #ffcc00;
}

#userBarElo {
  color: #aaa;
}

#logoutButton {
  padding: 4px 10px;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

#logoutButton:hover {
  border-color: #ff5555;
  color: #ff5555;
}


/* =====================
   PANELES PERFIL / LEADERBOARD
===================== */

#profilePanel,
#leaderboardPanel {
  max-width: 700px;
  margin: 20px auto;
  padding: 0 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 2px solid #333;
  padding-bottom: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 24px;
}

.close-btn {
  padding: 8px 16px;
  background: none;
  border: 1px solid #555;
  border-radius: 6px;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.close-btn:hover {
  border-color: #ffcc00;
  color: #ffcc00;
}

/* =====================
   PERFIL — HEADER
===================== */

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
}

.profile-rank-icon {
  font-size: 56px;
  line-height: 1;
}

.profile-username {
  margin: 0 0 4px;
  font-size: 26px;
  color: #ffcc00;
}

.profile-rank-name {
  color: #aaa;
  font-size: 14px;
  margin-bottom: 4px;
}

.profile-elo {
  font-size: 18px;
  font-weight: bold;
}

/* =====================
   STATS GRID
===================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: #1a1a1a;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
}

.stat-value {
  font-size: 26px;
  font-weight: bold;
  color: #ffcc00;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* =====================
   HISTORIAL
===================== */

.section-title {
  font-size: 16px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.history-table th {
  text-align: left;
  padding: 8px 10px;
  color: #666;
  border-bottom: 1px solid #333;
  font-weight: normal;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .5px;
}

.history-table td {
  padding: 10px;
  border-bottom: 1px solid #222;
}

.history-row.win td:first-child  { color: #4caf50; }
.history-row.loss td:first-child { color: #f44336; }
.history-row.draw td:first-child { color: #aaa; }

.no-data {
  color: #555;
  padding: 20px;
}

/* =====================
   LEADERBOARD
===================== */

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.leaderboard-table th {
  text-align: center;
  padding: 8px 12px;
  color: #666;
  border-bottom: 1px solid #333;
  font-weight: normal;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .5px;
}

.leaderboard-table td {
  padding: 12px;
  border-bottom: 1px solid #1e1e1e;
  text-align: center;
}

.leaderboard-me {
  background: #1f1a00;
}

.leaderboard-me .rank-username {
  color: #ffcc00;
}

.you-tag {
  font-size: 11px;
  color: #888;
}

.rank-pos {
  font-size: 20px;
  width: 40px;
}

.rank-icon {
  font-size: 20px;
  width: 32px;
}

.rank-username {
  font-weight: bold;
  text-align: left;
}

.loading {
  color: #555;
  padding: 40px;
  font-size: 16px;
}

/* =====================
   USER BAR — botones extra
===================== */

#profileButton,
#leaderboardButton {
  padding: 4px 10px;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

#profileButton:hover {
  border-color: #ffcc00;
  color: #ffcc00;
}

#leaderboardButton:hover {
  border-color: #ffcc00;
  color: #ffcc00;
}


/* =====================
   SONG SELECTOR
===================== */

/* Song selector — two columns side by side */
#songSelector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 12px auto;
  max-width: 640px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
}

.songs-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.songs-col:first-child {
  border-right: 1px solid #2a2a2a;
}

.songs-col-label {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 12px 6px;
  background: #161616;
  border-bottom: 1px solid #222;
  text-align: center;
  flex-shrink: 0;
}

.songs-col-scroll {
  overflow-y: auto;
  max-height: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.songs-col-scroll::-webkit-scrollbar {
  width: 4px;
}

.songs-col-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.songs-col-scroll::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

.songs-col-empty {
  text-align: center;
  color: #444;
  font-size: 12px;
  padding: 20px 10px;
  font-style: italic;
}

.song-card {
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: left;
  flex-shrink: 0;
}

.song-card:hover {
  border-color: #444;
  background: #222;
}

.song-card.selected {
  border-color: #ffcc00;
  background: #1a1800;
}

.song-name {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-stars {
  color: #ffcc00;
  font-size: 12px;
  letter-spacing: 1px;
}


/* =====================
   VOTE PANEL
===================== */

#votePanel {
  margin: 8px auto;
  max-width: 500px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

#myVoteLabel {
  color: #ffcc00;
  font-weight: bold;
}

#rivalVoteStatus {
  color: #aaa;
}

.rival-tag {
  font-size: 10px;
  color: #aaa;
  background: #333;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  display: inline-block;
}


/* =====================
   UNLOCKABLES
===================== */

.unlockables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.unlock-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  transition: border-color .2s;
}

.unlock-card.owned {
  border-color: #444;
}

.unlock-card.locked {
  opacity: .45;
}

.unlock-card-label {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 4px;
}

.unlock-card-desc {
  font-size: 11px;
  color: #666;
  margin-bottom: 10px;
}

.unlock-skin-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 auto 8px;
}

.unlock-locked {
  font-size: 12px;
  color: #555;
}

.equip-btn {
  padding: 4px 12px;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.equip-btn:hover {
  border-color: #ffcc00;
  color: #ffcc00;
}

.equip-btn.equipped {
  border-color: #4caf50;
  color: #4caf50;
  cursor: default;
}

/* =====================
   UNLOCK TOAST
===================== */

.unlock-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #1a1a1a;
  border: 1px solid #ffcc00;
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform .4s cubic-bezier(.175,.885,.32,1.275);
  max-width: 280px;
}

.unlock-toast.show {
  transform: translateX(0);
}

.unlock-toast-icon {
  font-size: 28px;
}

.unlock-toast-title {
  font-size: 11px;
  color: #ffcc00;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.unlock-toast-label {
  font-size: 15px;
  font-weight: bold;
}


/* =====================
   ABILITIES HUD
===================== */

#abilitiesHud {
  max-width: 500px;
  margin: 8px auto;
  padding: 10px 14px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

.energy-bar-wrap {
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

#energyBar {
  height: 100%;
  width: 0%;
  background: #225588;
  border-radius: 3px;
  transition: width .15s, background .3s;
}

#energyLabel {
  font-size: 11px;
  color: #666;
  text-align: right;
  margin-bottom: 8px;
}

.abilities-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.ability {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  transition:
    border-color .2s,
    background .2s,
    opacity .2s;
  min-width: 0;
}

.ability-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}

.ability-name {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: .5px;
  color: #666;
  margin-bottom: 2px;
}

.ability-key {
  font-size: 10px;
  font-weight: bold;
  color: #888;
  background: #222;
  border-radius: 3px;
  padding: 1px 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.ability-cost {
  font-size: 9px;
  color: #444;
}

/* ESTADO: bloqueada */
.ability-locked {
  opacity: .35;
}

.ability-locked .ability-icon {
  filter: grayscale(1);
}

/* ESTADO: lista */
.ability-ready {
  border-color: #44aaff;
  background: #0d1a2a;
  opacity: 1;
}

.ability-ready .ability-name {
  color: #44aaff;
}

.ability-ready .ability-key {
  color: #fff;
  background: #44aaff22;
  border: 1px solid #44aaff55;
}

.ability-ready .ability-cost {
  color: #44aaff88;
}

/* ESTADO: 100% - especiales */
#abilitySpecial.ability-ready,
#abilityShield.ability-ready {
  border-color: #ffcc00;
  background: #1a1500;
}

#abilitySpecial.ability-ready .ability-name,
#abilityShield.ability-ready .ability-name {
  color: #ffcc00;
}

#abilitySpecial.ability-ready .ability-key,
#abilityShield.ability-ready .ability-key {
  color: #fff;
  background: #ffcc0022;
  border: 1px solid #ffcc0055;
}

/* ESTADO: escudo activo */
.ability-active {
  border-color: #4caf50 !important;
  background: #0d1a0d !important;
  animation: shieldPulse 1s infinite;
}

@keyframes shieldPulse {
  0%, 100% { border-color: #4caf50; }
  50%       { border-color: #88ff88; }
}


/* =====================
   GAME LAYOUT — 2 COLUMNAS
===================== */

#gameLayout {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  max-width: 860px;
  margin: 0 auto;
}

#gameColumn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#game {
  flex-shrink: 0;
}

/* =====================
   RESULT PANEL
===================== */

#resultPanel {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 320px;
  min-height: 400px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  flex-shrink: 0;
}

#resultIcon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 8px;
}

#resultTitle {
  font-size: 22px;
  font-weight: bold;
  margin: 0 0 16px;
  color: #ffcc00;
}

.result-score {
  font-size: 42px;
  font-weight: bold;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}

.result-score-label {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.result-meta {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.result-row-label {
  width: 52px;
  text-align: right;
  font-weight: bold;
  color: #666;
  flex-shrink: 0;
}

.result-row-bar {
  flex: 1;
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
}

.result-row-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

.result-row-val {
  width: 28px;
  text-align: left;
  color: #aaa;
  flex-shrink: 0;
}

/* Colores por tipo */
.result-row.perfect .result-row-label { color: #ffcc00; }
.result-row.perfect .result-row-bar span { background: #ffcc00; }

.result-row.good .result-row-label { color: #44aaff; }
.result-row.good .result-row-bar span { background: #44aaff; }

.result-row.ok .result-row-label { color: #88ff88; }
.result-row.ok .result-row-bar span { background: #88ff88; }

.result-row.miss .result-row-label { color: #ff5555; }
.result-row.miss .result-row-bar span { background: #ff5555; }

#rematchButton {
  padding: 12px;
  background: #ffcc00;
  border: none;
  border-radius: 8px;
  color: black;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity .2s;
  margin-top: auto;
}

#rematchButton:hover {
  opacity: .85;
}


/* =====================
   TÍTULOS EN HUD Y LEADERBOARD
===================== */

#userBarTitle {
  font-size: 12px;
  color: #ffcc00;
  background: #1a1500;
  border: 1px solid #ffcc0044;
  border-radius: 4px;
  padding: 2px 8px;
}

#userBarTitle:empty {
  display: none;
}

.rank-title {
  display: block;
  font-size: 11px;
  color: #ffcc00;
  font-weight: normal;
  margin-top: 2px;
}


/* =====================
   GLOBAL POLISH
===================== */

h1 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 12px 0 8px;
  background: linear-gradient(135deg, #fff 60%, #ffcc00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =====================
   LOBBY INFO
===================== */

#lobbyInfo {
  margin: 4px 0 8px;
  line-height: 1.4;
}

#status {
  font-size: 15px;
  color: #ccc;
}

#room {
  font-size: 12px;
  color: #555;
}

/* =====================
   MATCH INFO (score + countdown)
===================== */

#matchInfo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 8px 0;
}

#scoreBlock {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#score, #opponent {
  font-size: 32px;
  font-weight: bold;
  color: #fff;
  line-height: 1;
}

#scoreLabel {
  font-size: 10px;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#countdown {
  font-size: 48px;
  font-weight: 900;
  color: #ffcc00;
  min-width: 60px;
  line-height: 1;
}

.countdown-go {
  color: #4caf50 !important;
  animation: goFlash .6s ease;
}

@keyframes goFlash {
  0%   { transform: scale(1.5); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* =====================
   HP BARS
===================== */

#hpBar,
#enemyHpBar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 500px;
  margin: 4px auto;
  font-size: 13px;
}

#hpBar {
  flex-direction: row;
}

#enemyHpBar {
  flex-direction: row-reverse;
}

#hpBarWrap,
#enemyHpBarWrap {
  flex: 1;
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
}

#hpFill,
#enemyHpFill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: #4caf50;
  transition: width .3s, background .3s;
}

#hpLabel {
  color: #aaa;
  font-size: 12px;
  min-width: 44px;
}

#enemyHpLabel {
  color: #aaa;
  font-size: 12px;
  min-width: 44px;
  text-align: right;
}

/* =====================
   COMBO DISPLAY
===================== */

#comboDisplay {
  height: 32px;
  font-size: 22px;
  font-weight: 900;
  color: #ffcc00;
  letter-spacing: 2px;
  text-align: center;
  line-height: 32px;
}

#comboDisplay.combo-pulse {
  animation: comboPulse .15s ease;
}

@keyframes comboPulse {
  0%   { transform: scale(1.3); }
  100% { transform: scale(1);   }
}

/* =====================
   LANE INDICATORS
===================== */

#laneIndicators {
  position: absolute;
  bottom: 8px;
  left: 0;
  width: 100%;
  display: flex;
  pointer-events: none;
  z-index: 10;
}

.lane-key {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  color: #444;
  letter-spacing: 1px;
}

/* Lane lines subtle */
#game::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(25% - 1px),
      #1a1a1a calc(25% - 1px),
      #1a1a1a 25%
    );
  pointer-events: none;
  z-index: 0;
}

/* =====================
   NOTE SHAPES PER LANE
===================== */

.note[data-lane="d"] { border-radius: 8px; }
.note[data-lane="f"] { border-radius: 50% 8px; }
.note[data-lane="j"] { border-radius: 8px 50%; }
.note[data-lane="k"] { border-radius: 50%; }


/* =====================
   STREAK
===================== */

#userBarStreak {
  font-size: 13px;
  font-weight: bold;
  color: #ff6600;
  animation: streakPulse 2s infinite;
}

#userBarStreak:empty {
  display: none;
}

@keyframes streakPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}


/* =====================
   SONG CHOSEN SCREEN
===================== */

#songChosenScreen {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(8px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#songChosenInner {
  text-align: center;
  padding: 40px 60px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 20px;
  animation: slideUp .4s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#songChosenLabel {
  font-size: 14px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

#songChosenName {
  font-size: 42px;
  font-weight: 900;
  color: #ffcc00;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffcc00, #ff8800);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#songChosenMeta {
  font-size: 15px;
  color: #888;
  margin-bottom: 28px;
}

#songChosenCountdown {
  font-size: 56px;
  font-weight: 900;
  color: #fff;
  animation: countPulse 1s infinite;
}

@keyframes countPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.1); opacity: .8; }
}


/* =====================
   PING INDICATOR
===================== */

#hudTopRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

#pingIndicator {
  font-size: 11px;
  color: #555;
  transition: color .3s;
}


/* =====================
   START BUTTONS
===================== */

#startButtons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0;
}

#practiceButton {
  padding: 10px 20px;
  background: none;
  border: 2px solid #44aaff;
  border-radius: 8px;
  color: #44aaff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background .2s, color .2s;
}

#practiceButton:hover {
  background: #44aaff22;
}


/* =====================
   HOLD NOTES
   Cola arriba, cabeza abajo.
   La nota entera viaja hacia la hitline.
===================== */

.hold-wrapper {
  position: absolute;
  width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Cola — aparece primero (arriba) */
.hold-tail {
  width: 50px;
  height: 20px;
  border-radius: 6px 6px 0 0;
  flex-shrink: 0;
  opacity: .9;
  border: 2px solid rgba(255,255,255,.3);
  border-bottom: none;
}

/* Cuerpo */
.hold-body {
  width: 24px;
  border-radius: 0;
  margin: 0 auto;
  flex-shrink: 0;
}

/* Cabeza — llega a la hitline (abajo) */
.hold-head {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  line-height: 50px;
  color: black;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  flex-shrink: 0;
  z-index: 2;
  transition: box-shadow .1s;
}

/* Activo — tecla mantenida */
.hold-wrapper.holding .hold-head {
  animation: holdPulse .3s infinite alternate;
}

.hold-wrapper.holding .hold-body {
  opacity: .8;
}

@keyframes holdPulse {
  from { transform: scale(1);    box-shadow: 0 0 8px rgba(255,255,255,.5); }
  to   { transform: scale(1.06); box-shadow: 0 0 20px rgba(255,255,255,.8); }
}


/* =====================
   EDITOR BUTTON
===================== */

#editorButton {
  padding: 4px 10px;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}

#editorButton:hover {
  border-color: #ffcc00;
  color: #ffcc00;
}


/* =====================
   COMMUNITY SONGS
===================== */

/* old section label — replaced by col label */
.songs-section-label { display: none; }

.community-song {
  border-color: #2a3a2a;
}

.community-song.selected {
  border-color: #4caf50;
  background: #0d1a0d;
}

.community-song:hover {
  border-color: #4caf50;
}

.song-community-rating {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.song-community-rating .rating-val {
  color: #ffcc00;
  font-weight: bold;
}

/* =====================
   RATING MODAL
===================== */

#ratingModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn .3s ease;
}

#ratingModalInner {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  min-width: 300px;
}

#ratingModalTitle {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 8px;
}

#ratingModalSong {
  font-size: 22px;
  font-weight: bold;
  color: #ffcc00;
  margin-bottom: 24px;
}

#ratingStars {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.rating-star {
  font-size: 36px;
  color: #333;
  cursor: pointer;
  transition: color .15s, transform .1s;
  user-select: none;
}

.rating-star.active {
  color: #ffcc00;
  transform: scale(1.1);
}

.rating-star:hover {
  transform: scale(1.2);
}

#ratingSkip {
  background: none;
  border: 1px solid #333;
  border-radius: 6px;
  color: #555;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: color .2s, border-color .2s;
}

#ratingSkip:hover {
  color: #aaa;
  border-color: #555;
}


/* =====================
   TOURNAMENT MODAL
===================== */

#tournamentModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn .2s ease;
}

#tournamentModalInner {
  background: #161616;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 32px;
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

#tournamentClose {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

#tournamentClose:hover { color: #fff; }

#tournamentContent h2 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 8px;
}

.tournament-subtitle {
  text-align: center;
  color: #555;
  font-size: 13px;
  margin-bottom: 24px;
}

#tournamentActions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.tournament-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid #333;
  background: #222;
  color: #fff;
  transition: background .2s;
  width: 100%;
}

.tournament-btn:hover {
  background: #333;
}

.tournament-btn.primary {
  background: #ffcc00;
  color: #000;
  border-color: #ffcc00;
}

.tournament-btn.primary:hover {
  background: #ffd740;
}

.tournament-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.tournament-divider {
  color: #444;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 16px 0 12px;
  text-align: center;
}

#joinRow {
  display: flex;
  gap: 8px;
  width: 100%;
}

#tournamentCodeInput {
  flex: 1;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
  font-size: 16px;
  text-transform: uppercase;
  outline: none;
}

#tournamentCodeInput:focus {
  border-color: #ffcc00;
}

#joinRow .tournament-btn {
  width: auto;
  white-space: nowrap;
}

.tournament-error {
  color: #f44336;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
  margin-top: 8px;
}

/* Código de sala */
#tournamentCode {
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  color: #ffcc00;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#tournamentCode span {
  letter-spacing: 4px;
}

#copyCode {
  background: none;
  border: 1px solid #333;
  border-radius: 6px;
  color: #aaa;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
}

/* Jugadores en sala de espera */
#tournamentPlayers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}

.tournament-player {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.tournament-player.filled {
  background: #1a1a1a;
  border-color: #333;
}

.tournament-player.empty {
  background: #111;
  color: #333;
  font-style: italic;
  justify-content: center;
}

.player-name { font-weight: bold; }
.player-elo  { color: #ffcc00; font-size: 13px; }

#tournamentWaitMsg {
  text-align: center;
  color: #555;
  font-size: 13px;
}

/* Votación */
.voting-round {
  margin-bottom: 20px;
}

.voting-round-label {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.voting-songs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.voting-song {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.voting-song:hover {
  border-color: #444;
  background: #222;
}

.voting-song.selected {
  border-color: #ffcc00;
  background: #1a1800;
}

.voting-song-name {
  font-weight: bold;
  font-size: 13px;
}

.voting-song-artist {
  font-size: 11px;
  color: #555;
}

#voteProgress {
  text-align: center;
  color: #555;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Bracket */
#bracketView {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 10px 0;
}

.bracket-round {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bracket-round.active .bracket-round-label {
  color: #ffcc00;
}

.bracket-round-label {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 4px;
}

.bracket-song {
  display: block;
  font-size: 10px;
  color: #444;
  text-transform: none;
  letter-spacing: 0;
}

.bracket-match {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px;
}

.bracket-match.playing {
  border-color: #ffcc00;
}

.bracket-match.finished {
  border-color: #333;
  opacity: .7;
}

.bracket-player {
  padding: 4px 0;
  font-size: 13px;
  color: #888;
}

.bracket-player.winner {
  color: #ffcc00;
  font-weight: bold;
}

.bracket-vs {
  font-size: 10px;
  color: #333;
  text-align: center;
}

#bracketStatus {
  text-align: center;
  color: #555;
  font-size: 13px;
  margin-top: 12px;
}

/* Campeón */
#championScreen {
  text-align: center;
  padding: 20px 0;
}

#championTrophy {
  font-size: 64px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

#championName {
  font-size: 32px;
  font-weight: bold;
  color: #ffcc00;
  margin: 12px 0 4px;
}

#championElo {
  color: #888;
  margin-bottom: 24px;
}

/* Tournament button in userBar */
#tournamentButton {
  padding: 4px 10px;
  background: none;
  border: 1px solid #ffcc00;
  border-radius: 4px;
  color: #ffcc00;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}

#tournamentButton:hover {
  background: #ffcc0022;
}


/* Champion title display */
#championTitle {
  font-size: 14px;
  color: #ffcc00;
  background: #1a1800;
  border: 1px solid #ffcc0044;
  border-radius: 8px;
  padding: 8px 16px;
  margin: 8px 0 20px;
  text-align: center;
}

#championPosition {
  font-size: 16px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: -8px;
  margin-bottom: 4px;
}


/* =====================
   RANK LEGEND
===================== */

.rank-legend {
  font-size: 11px;
  color: #555;
  text-align: center;
  padding: 8px 0 12px;
  letter-spacing: 0.5px;
}


/* =====================
   RESPONSIVE — MÓVIL
   breakpoint: 640px portrait, o height<=430 landscape
===================== */

@media (max-width: 640px), (max-height: 430px) {

  /* ── UserBar ── */
  #userBar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    justify-content: center;
    font-size: 13px;
  }

  #userBarName {
    font-size: 15px;
    width: 100%;
    text-align: center;
  }

  /* Ocultar editor en móvil */
  #editorButton { display: none !important; }

  /* Menú de botones más compacto */
  #userBar button,
  #userBar a {
    padding: 3px 8px;
    font-size: 12px;
  }

  /* ── Layout principal ── */
  #gameLayout {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
  }

  #resultPanel {
    width: 100%;
    min-height: unset;
    padding: 16px 12px;
  }

  /* ── Match info ── */
  #matchInfo {
    gap: 12px;
  }

  #countdown {
    font-size: 28px;
  }

  #score, #opponent {
    font-size: 28px;
  }

  /* ── Song selector ── */
  #songSelector {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin: 8px;
  }

  .songs-col {
    border-right: none;
    border-bottom: 1px solid #2a2a2a;
  }

  .songs-col:last-child {
    border-bottom: none;
  }

  .songs-col-scroll {
    max-height: 150px;
  }

  /* ── Abilities HUD ── */
  #abilitiesHud {
    margin: 4px 8px;
    padding: 8px;
  }

  .abilities-row {
    gap: 4px;
  }

  .ability {
    min-width: 48px;
    padding: 6px 4px;
  }

  .ability-icon { font-size: 16px; }
  .ability-name { font-size: 7px; }
  .ability-key  { font-size: 10px; }
  .ability-cost { font-size: 8px; }

  /* ── HP bars ── */
  #hpBar, #enemyHpBar {
    max-width: 100%;
    margin: 4px 8px;
  }

  /* ── Difficulty + buttons ── */
  #difficulty {
    width: 100%;
    max-width: 200px;
  }

  #startButtons {
    flex-direction: row;
    gap: 8px;
  }

  #startButton, #practiceButton {
    flex: 1;
    padding: 10px 8px;
    font-size: 14px;
  }

  /* ── Song chosen screen ── */
  #songChosenInner {
    padding: 20px;
  }

  /* ── Touch buttons — shown via JS when game starts ── */
  /* #touchButtons shown/hidden by showTouchButtons() */

}

/* =====================
   TOUCH BUTTONS
   Solo visibles en móvil durante partida
===================== */

#touchButtons {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  z-index: 500;
  background: #111;
  border-top: 2px solid #222;
}

.touch-btn {
  flex: 1;
  height: 100%;
  border: none;
  border-right: 1px solid #222;
  background: #1a1a1a;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: background .08s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.touch-btn:last-child { border-right: none; }

.touch-btn[data-lane="d"] { color: #ff6666; }
.touch-btn[data-lane="f"] { color: #ffaa44; }
.touch-btn[data-lane="j"] { color: #44aaff; }
.touch-btn[data-lane="k"] { color: #aa66ff; }

.touch-btn.active {
  filter: brightness(1.5);
}

.touch-btn[data-lane="d"].active { background: #ff666622; }
.touch-btn[data-lane="f"].active { background: #ffaa4422; }
.touch-btn[data-lane="j"].active { background: #44aaff22; }
.touch-btn[data-lane="k"].active { background: #aa66ff22; }

/* En móvil, añadir padding inferior al game para que
   los touch buttons no tapen las notas */
@media (max-width: 640px), (max-height: 430px) {
  body {
    padding-bottom: 90px;
  }
}


/* ── Game canvas scales to fill mobile width ── */
@media (max-width: 640px), (max-height: 430px) {

  #gameColumn {
    width: 100%;
    align-items: center;
  }

  /* Wrapper que escala el canvas al ancho disponible */
  #gameWrapper {
    width: 100%;
    overflow: visible;
    display: flex;
    justify-content: flex-start;
  }

  /* Canvas escala via JS */
  #game {
    transform-origin: top left;
    flex-shrink: 0;
  }
}


/* ── Ocultar habilidades de teclado en móvil ── */
@media (max-width: 640px), (max-height: 430px) {
  .abilities-row {
    display: none;
  }

  /* Ocultar energía pero mantener ping */
  .energy-bar-wrap {
    display: none;
  }

  #energyLabel {
    display: none;
  }

  /* HUD compacto — solo ping */
  #abilitiesHud {
    padding: 4px 10px;
    display: flex !important;
    justify-content: flex-end;
    background: transparent;
    border: none;
  }

  #hudTopRow {
    justify-content: flex-end;
  }
}

/* ── Landscape en móvil ── */
@media (max-height: 430px) and (orientation: landscape) {

  /* Ocultar habilidades y energía */
  .abilities-row,
  .energy-bar-wrap,
  #energyLabel {
    display: none !important;
  }

  #abilitiesHud {
    padding: 4px 10px;
    display: flex !important;
    justify-content: flex-end;
    background: transparent;
    border: none;
  }

  #hudTopRow {
    justify-content: flex-end;
  }

  #editorButton { display: none !important; }

  /* Botones más pequeños en landscape — siguen abajo */
  #touchButtons {
    height: 56px;
  }

  .touch-btn {
    font-size: 20px;
  }

  body {
    padding-bottom: 56px;
    padding-right: 0;
  }
}


/* =====================
   TOURNAMENT SECTIONS
===================== */

.tournament-section {
  margin-bottom: 16px;
}

.tournament-section-title {
  font-size: 13px;
  font-weight: bold;
  color: #ffcc00;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  margin-top: 4px;
}

#quickTournamentActions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tournament-btn.danger {
  background: #2a1a1a;
  color: #f44336;
  border: 1px solid #f4433644;
}

.tournament-btn.danger:hover {
  background: #3a1a1a;
}


/* =====================
   MODO ESPECTADOR
===================== */

#spectatorPanel {
  position: fixed;
  inset: 0;
  background: #111;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.spectator-loading,
.spectator-empty {
  text-align: center;
  color: #666;
  padding: 40px 20px;
  line-height: 2;
}

.spectator-match {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spectator-match-players {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
}

.spectator-match-players .vs {
  color: #ffcc00;
  font-size: 12px;
}

.spectator-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 12px;
}

.spectator-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spectator-player.right {
  align-items: flex-end;
  text-align: right;
}

.spectator-player.right .spectator-hp-bar {
  width: 100%;
}

.spectator-name {
  font-size: 13px;
  color: #aaa;
  font-weight: bold;
}

.spectator-score {
  font-size: 22px;
  font-weight: bold;
  color: #ffcc00;
}

.spectator-hp-bar {
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}

.spectator-hp-fill {
  height: 100%;
  background: #4caf50;
  border-radius: 3px;
  transition: width .3s;
}

.spectator-center {
  font-size: 11px;
  color: #ff4444;
  font-weight: bold;
  letter-spacing: 1px;
  white-space: nowrap;
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}


/* =====================
   ESPECTADOR — NOTAS
===================== */

.spec-note {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: #000;
  top: 0;
}

@keyframes specFeedbackAnim {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}


/* =====================
   DIFFICULTY WRAPPER
===================== */

#difficultyWrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 8px auto;
}

#difficultyWrapper label {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
}


/* =====================
   ONLINE COUNT
===================== */

#onlineCount {
  font-size: 12px;
  color: #4caf50;
  margin-top: 4px;
  font-weight: bold;
}


/* =====================
   NO RIVAL SUGGESTION
===================== */

#noRivalSuggestion {
  margin-top: 12px;
  text-align: center;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 12px 16px;
}

#noRivalSuggestion p {
  color: #aaa;
  font-size: 13px;
  margin-bottom: 8px;
}

#suggestPracticeBtn {
  background: #ffcc00;
  color: #111;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
}

#suggestPracticeBtn:hover {
  background: #ffd633;
}