body{
font-family:system-ui,-apple-system,Segoe UI,Roboto;
margin:0;
background:#1c1f26;
color:white;
text-align:center;
min-height:100dvh;
}

html,
body{
width:100%;
height:100%;
overflow-x:hidden;
}

.overlay{
position:fixed;
inset:0;
width:100dvw;
height:100dvh;
background:rgba(0,0,0,0.5);
display:flex;
align-items:center;
justify-content:center;
z-index:200;
}

body.light{
background:#eef1f6;
color:#111;
}

body.light header{
background:#ffffff;
}

body.light th,
body.light td{
background:#ffffff;
color:#111;
}

body.light .player-name{
background:#e5e9f0;
}

body.light .overlay-content{
background:#ffffff;
}

body.light .modal-content{
background:#ffffff;
color:#111;
}

body.light input{
background:#ffffff;
color:#111;
}

body.light .player-card{
background:#ffffff;
}

body.light .titel{
background:none;
-webkit-text-fill-color:#111;

text-shadow:
0 0 6px rgba(255,0,0,0.5),
0 0 8px rgba(255,0,0,0.35),
0 0 14px rgba(255,0,0,0.2);

}


body.light .start-lobby-btn{
color:#333;
border-color:#22c55e;
}

body.light #podium div:nth-child(n+4){
color:black;
}

body.light .round-number{
color:black;
}

header{
background:#111318;
padding:16px;
position:sticky;
top:0;
z-index:100;
box-shadow:0 2px 6px rgba(0,0,0,0.5);
}

.titel{

font-size:26px;
font-weight:700;
letter-spacing:1.5px;

background:linear-gradient(
90deg,
#ffd700 0%,
#fff6b0 45%,
#ffd700 100%
);

-webkit-background-clip:text;
-webkit-text-fill-color:transparent;

text-shadow:
0 0 6px rgba(255,215,0,0.35),
0 0 12px rgba(255,215,0,0.15);

}

h2{
margin-top:10px;
font-weight:500;
}

button{
padding:12px 20px;
margin:8px;
font-size:16px;
border:none;
border-radius:10px;
cursor:pointer;
background:#2c7ef7;
color:white;
transition:0.2s;

touch-action: manipulation;
}

button:hover{
opacity:0.9;
}

input{
display:block;
width:80%;
margin:10px auto;
padding:12px;
font-size:16px;
border-radius:8px;
border:none;
background:#2b2f38;
color:white;
}

.hidden{
display:none;
}

/* START SCREEN */

.start-container{
max-width:420px;
margin:auto;
padding:20px;
}

.players-list{
display:flex;
flex-direction:column;
gap:12px;
margin-bottom:20px;
}

.player-card{
display:flex;
width:100%;
align-items:center;
background:#2b2f38;
border-radius:12px;
padding:6px;
box-shadow:0 4px 10px rgba(0,0,0,0.4);
}

.player-card input{
flex:1;
border:none;
background:transparent;
color:white;
font-size:16px;
padding:10px;
}

.player-card input:focus{
outline:none;
}

.remove-player{
background:#ff5a5a;
border:none;
color:white;
font-size:16px;
width:36px;
height:36px;
border-radius:8px;
cursor:pointer;

display: flex;
align-items: center;
justify-content: center;
}

.add-player-btn{
width:99%;
background:#3b82f6;
color:white;
}

.start-btn{
width:99%;
background:#22c55e;
font-size:18px;
}

/* HEADER */

.game-header{
background:#111318;
padding:18px 10px;
position:sticky;
top:0;
z-index:100;
box-shadow:0 4px 10px rgba(0,0,0,0.6);
}

.total-cell{
font-weight:bold;
background:#353a45;
min-width:70px;
width:70px;
}

.total-header{
min-width:70px;
width:70px;
}

.game-title{
display:flex;
align-items:center;
justify-content:center;
gap:8px;
}

.title-card{
height:60px;
border-radius:6px;
}

.left-card{
transform:rotate(-8deg);
height: 45px;
}

.right-card{
transform:rotate(8deg);
margin-left:-7px;
}

.lobby-btn{
background:none;
border:none;
display:flex;
align-items:center;
justify-content:center;
width:40px;
height:40px;
cursor:pointer;
opacity:0.85;
transition:0.15s;
}

.lobby-btn img{
width:45px;
height:45px;
}

.lobby-btn:hover{
opacity:1;
}

.lobby-btn:active{
transform:scale(0.92);
}

.start-lobby-btn{
justify-content:left;
width:100%;
color:grey;
background:none;
font-size:18px;
padding:14px 40px 14px 14px;
margin-top:10px;
margin-bottom:20px;
margin-left:-15px;
gap:10px;
}

.start-lobby-btn:hover{
text-shadow: 0 0 20px white;
}

.start-lobby-btn img{
width:40px;
height:40px;
}

#keypad-display{
font-size:24px;
margin-bottom:8px;
text-align:center;
min-height:29px;
}

/* TABLE */

#table-container {
    display: inline-flex;
    align-items: stretch;
    overflow-x: auto;
    max-width: 100%;
    margin-top: 25px;
    padding-bottom: 20px;
}

.table {
    border-collapse: separate;
    border-spacing: 4px;
    margin: 0; 
}

th{
background:#2b2f38;
padding:10px;
border-radius:8px;
font-weight:500;
min-width:60px;
}

td{
background:#2b2f38;
min-width:90px;
height:70px;
border-radius:8px;
position:relative;
cursor:pointer;
}

.player-name{
position:sticky;
left:0;
background:#181b21;
font-weight:600;
z-index:5;
min-width:110px;
}

.player-name,
.total-cell{
cursor:default;
}

.overlay.hidden{
display:none;
}

.overlay-content{
background:#1f222a;
padding:15px;
border-radius:14px;
width:240px;
max-width:90%;
}

/* KEYPAD */

#keypad-grid{
display:grid;
grid-template-columns:repeat(3,1fr);
gap:8px;
justify-items:center;
}

#keypad-grid button{
width:55px;
height:55px;
font-size:20px;
border-radius:10px;
}

.game-controls{
display:flex;
justify-content:flex-start;
gap:10px;
margin-top:20px;
margin-bottom:20px;
padding-left:10px;
}

.active-round{
box-shadow:0 0 0 2px #b80d0d ;
background:#353a45;
}

.endgame-cell{
vertical-align:middle;
}

#end-game-vertical{
background:none;
border:3px solid #444;
color:#ff5a5a;
padding:10px;
border-radius:10px;
font-size:14px;
}

#toast{
position:fixed;
top:55%;
left:50%;
transform:translate(-50%,-50%);
background:#2b2f38;
color:yellow;
padding:14px 20px;
border-radius:10px;
font-size:15px;
opacity:0;
pointer-events:none;
transition:opacity 0.3s, transform 0.3s;
box-shadow:0 8px 25px rgba(0,0,0,0.6);
z-index:500;
}

#toast.show{
opacity:1;
transform:translate(-50%,-55%);
}

#endgame-container{
display:flex;
justify-content:flex-end;
margin-top:8px;
}

#end-game{
background:none;
border:3px solid #444;
color:#ff5a5a;
padding:12px 8px;
font-size:16px;
border-radius:10px;

writing-mode:vertical-rl;
transform:rotate(180deg);
}

.round-header{
position:relative;
width:36px;
height:36px;
font-size:14px;
}

.round-header img{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
object-fit:cover;
border-radius:8px;
opacity:0.6;
}

.round-number{
position:relative;
z-index:2;
font-weight:bold;

font-size:18px;
color:white;
text-shadow: 0 0 10px red, 0 0 20px red;
top:-5px;
}

.add-round{
background:none;
border:2.5px solid #444;
color:#22c55e;
padding:8px 20px;
font-size:16px;
border-radius:10px;
opacity:0.9;
}

.close-game{
background:#2b2f38;
border:1px solid grey;
color:darkgrey;
padding:8px 18px;
font-size:16px;
border-radius:10px;
opacity:0.9;
}

body.light .close-game{
background:lightgrey;
border:1px solid grey;
color: grey;
}

#new-game{
display:block;
margin:26px auto 0 auto;
}

#podium-title{
text-shadow: 0 0 10px red, 0 0 20px red;
}

#podium-screen{
margin-top:30px;
margin-bottom:20px;
opacity:0;
transform:translateY(-20px);
transition:0.5s ease;
}

#podium-screen.show{
opacity:1;
transform:translateY(0);
}

#podium div{
background:none;
padding:6px;
margin:10px auto;
width:260px;
font-size:20px;
font-weight:600;
color:#111;
}

/* LOCUL 1 - AURIU */
#podium div:nth-child(1){
color:#ffd700;
text-shadow:
0 0 8px rgba(255,215,0,0.8),
0 0 18px rgba(255,215,0,0.6);
}

/* LOCUL 2 - ARGINT */
#podium div:nth-child(2){
color:#c0c0c0;
text-shadow:
0 0 6px rgba(192,192,192,0.8),
0 0 14px rgba(192,192,192,0.5);
}

/* LOCUL 3 - BRONZ */
#podium div:nth-child(3){
color:#cd7f32;
text-shadow:
0 0 6px rgba(205,127,50,0.8),
0 0 14px rgba(205,127,50,0.5);
}

/* LOCURILE 4+ - fara glow */
#podium div:nth-child(n+4){
color:#f5f2f2;
text-shadow:none;
opacity:0.9;
}

#keypad-grid button[data-key="enter"]{
color:#4dff88;
font-weight:bold;
}

#keypad-grid button[data-key="del"]{
color:#ff5a5a;
font-weight:bold;
}

/*animatie podium */

.firework{
position:fixed;
width:8px;
height:8px;
border-radius:50%;
background:#ffd700;
box-shadow:
0 0 6px #ffd700,
0 0 12px #ff3b3b,
0 0 18px #ff3b3b;

animation:fireworkPop 1.2s ease-out forwards;
}

@keyframes fireworkPop{

0%{
transform:scale(0.2);
opacity:0;
}

40%{
transform:scale(1.5);
opacity:1;
}

100%{
transform:scale(3);
opacity:0;
}

}


/* Stilul butonului lateral */
#end-game-side {
background:none;
border: 2px solid #444;
color: #4f4d4d;
padding: 25px 9px;
border-radius: 0 10px 10px 0;
cursor: pointer;
font-size: 16px;
    
writing-mode: vertical-rl;
    
/* Îl aliniem să înceapă sub header-ul tabelului */
margin-top: 62px;
flex-shrink: 0; /* Împiedică strivirea butonului */
transition: 0.2s;
}

/* Ajustare pentru modul Light */
body.light #end-game-side {
color: #b0aeae;
border: 2px solid #d9d7d7;
}


/* timer */
.timer-setup {
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
}
.timer-setup input {
    width: 50px;
    margin: 0;
    padding: 5px;
    text-align: center;
    display: inline-block;
}

#game-timer-container {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Mutat la stânga */
    gap: 10px;
    margin: 20px 15px; /* Aliniat cu marginea tabelului */
    background: transparent; /* Fără fundal */
    width: auto;
    padding: 0;
    border-radius: 0;
}

#timer-display {
    font-family: 'Courier New', Courier, monospace; /* Aspect de ceas */
    font-size: 28px;
    font-weight: bold;
    min-width: 60px;
    color: #3b82f6; /* Culoare implicită albastră */
}

#timer-display.timer-alert {
    color: #ff5a5a;
    text-shadow: 0 0 10px rgba(255, 90, 90, 0.5);
}

.timer-icon-btn {
    background: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    color: #888; /* Culoare neutră pentru butoane */
    transition: color 0.2s;
}

.timer-icon-btn:active {
    color: #3b82f6;
}

body.light #game-timer-container {
    background: transparent;
    border: none;
}

/* PAGE TRANSITIONS */

body{
opacity:0;
transition:opacity 0.35s ease;
}

body.page-enter{
opacity:1;
}

body.page-exit{
opacity:0;
pointer-events:none;
}