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{
border-radius:1px;
}

.left-card{
height: 65px;
transform:rotate(-8deg);
margin-bottom: -5px;
margin-right: -15px;
}

.right-card{
height:50px;
transform:rotate(-4deg);
margin-left:-2px;
}

.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;
font-weight:500;
margin-bottom:8px;
text-align:center;
min-height:29px;

height:35px;
display:flex;
align-items:center;
justify-content:center;

border:2px solid #4a5568;
border-radius:12px;

background:#2b2f38;
box-shadow:
inset 0 0 8px rgba(0,0,0,0.35),
0 0 8px rgba(0,0,0,0.2);

transition:0.15s;
}

body.light #keypad-display{
background: #dadee3;
border:2px solid darkgrey;
}

/* 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;
}

.player-phase{
font-size:14px;
font-weight:600;
color:#3b82f6;
margin-top:2px;
}

.player-phase.phase-updated{
animation: phasePulse 0.7s ease 2;
}

@keyframes phasePulse{

0%{
transform:scale(1);
}

50%{
transform:scale(1.25);
text-shadow:
0 0 8px #3dd16e,
0 0 16px #3dd16e;
}

100%{
transform:scale(1);
}

}

.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 #5eb1b5 ;
background:#353a45;
}

body.light .active-round{
box-shadow:0 0 0 2px #d63636 ;
}

.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.8;
}

body.light .round-header img{
opacity:0.9;
}

.round-number{
position:relative;
z-index:2;
font-weight:bold;

font-size:18px;
color:white;
text-shadow: 0 0 10px black, 0 0 20px black;
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;
}

.undo-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;
}

.undo-btn img{
width:38px;
height:38px;
}

.undo-flash{
animation:undoFlash 1.2s ease;
}

@keyframes undoFlash{

0%{
transform:scale(1);
}

20%{
transform:scale(1.45);
background:#ff5a5a;
box-shadow:
0 0 12px rgba(255,90,90,0.9),
0 0 24px rgba(255,90,90,0.6);
}

40%{
transform:scale(1);
}

60%{
transform:scale(1.45);
background:#ff5a5a;
box-shadow:
0 0 12px rgba(255,90,90,0.9),
0 0 24px rgba(255,90,90,0.6);
}

80%{
transform:scale(1);
}

100%{
transform:scale(1);
}
}

#new-game{
display:block;
margin:25px auto 0 auto;
}

#podium-title{
text-shadow: 0 0 10px red, 0 0 20px red;
margin: 25px auto 0 auto;
}

#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;
}

/* LOCUL 2 - ARGINT */
#podium div:nth-child(2){
color:#c0c0c0;
}

/* LOCUL 3 - BRONZ */
#podium div:nth-child(3){
color:#cd7f32;
}

/* 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;
}

/* PAGE TRANSITIONS */

body{
opacity:0;
transition:opacity 0.35s ease;
}

body.page-enter{
opacity:1;
}

body.page-exit{
opacity:0;
pointer-events:none;
}

.phase-complete-container{
margin-top:25px;
text-align:center;
}

.phase-complete-label{
display:flex;
justify-content:center;
align-items:center;
gap:10px;
font-size:18px;
font-weight:600;
}

.phase-complete-label input{
width:21px;
height:21px;
margin:0;
accent-color: green;
}

.play-arrow{
display:inline-block;
margin-right:5px;
color:#4dff88;
font-size:16px;
}

body.light .play-arrow{
color:#16913f;
}

/* Dealer popup */
#dealer-modal{
position:fixed;
inset:0;
display:none;
align-items:center;
justify-content:center;
background:rgba(0,0,0,0.55);
backdrop-filter:blur(5px);
z-index:1000;
}

#dealer-modal.show{
display:flex;
}

.modal-content{
background:#1f222a;
padding:25px;
border-radius:16px;
width:320px;
max-width:90vw;
box-shadow:
0 10px 40px rgba(0,0,0,0.5);
}

body.light .modal-content{
background:white;
color:black;
}

#dealer-options{
display:flex;
flex-direction:column;
gap:7px;
margin-top:15px;
}

.dealer-btn{
width:100%;
background:#2b2f38;
color:white;
border:0.5px solid #444;
padding:12px;
border-radius:10px;
}

body.light .dealer-btn{
background:#e5e9f0;
color:#111;
border:1px solid #cbd5e1;
}

.dealer-btn.active{
border:2px solid #22c55e;
box-shadow:
0 0 8px rgba(34,197,94,0.4);
}

body.light .dealer-btn.active{
border:2px solid #22c55e;
}

#dealer-confirm{
margin-top:15px;
width:50%;
background:#22c55e;
}

/* interogare "end the game" */
#confirm-modal{

position:fixed;
inset:0;

display:none;
align-items:center;
justify-content:center;

background:rgba(0,0,0,0.55);
backdrop-filter:blur(6px);

z-index:1000;
}

#confirm-modal.show{
display:flex;
}

.confirm-buttons{

display:flex;
justify-content:center;
gap:10px;

margin-top:20px;
}

#confirm-cancel{
background:#555;
}

#confirm-end{
background:#c62828;
}


/* Phase guide */
#guide-modal{
position:fixed;
inset:0;
display:none;
align-items:center;
justify-content:center;

background:rgba(0,0,0,0.55);
backdrop-filter:blur(5px);

z-index:1500;
overflow:auto;
}

#guide-modal.show{
display:flex;
}

#guide-content{
opacity:0;

transform:
translateY(-120px)
scale(0.35);

transition:
transform 0.55s ease,
opacity 0.55s ease;

max-width:95vw;
max-height:90vh;
}

#guide-modal.show #guide-content{
opacity:1;

transform:
translateY(0)
scale(1);
}

#guide-image{
max-width:95vw;
max-height:90vh;

border-radius:16px;

box-shadow:
0 15px 40px rgba(0,0,0,0.45);
}

#phase-guide-btn{
cursor:pointer;
}

.title-guide-pulse{
animation:titleGuidePulse 0.35s ease 4;
}

@keyframes titleGuidePulse{

0%{
transform:scale(1);
}

50%{
transform:scale(1.12);

text-shadow:
0 0 10px #ffd700,
0 0 20px #ffd700;
}

100%{
transform:scale(1);
}

}
