@import url('https://fonts.googleapis.com/css2?family=Beiruti:wght@200..900&display=swap');

:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --glass: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text: #ffffff;
  --success: #4fd1c5;
  --danger: #fc8181;
  --warning: #f6ad55;
}

/* ... existing reset ... */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Chat Font Override */
.chat-sidebar, .chat-msg, .chat-input-area input {
    font-family: 'Beiruti', sans-serif !important;
}

/* Settings Glow */
.top-right-icon {
    animation: glow-pulse 3s infinite;
}

@keyframes glow-pulse {
    0% { filter: drop-shadow(0 0 5px rgba(255,255,255,0.4)); }
    50% { filter: drop-shadow(0 0 15px rgba(255,255,255,0.8)); }
    100% { filter: drop-shadow(0 0 5px rgba(255,255,255,0.4)); }
}

/* Status Badge Glow */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 8px;
  box-shadow: 0 0 5px currentColor;
}

.status-waiting {
  background: var(--warning);
  color: black;
  box-shadow: 0 0 10px var(--warning);
  animation: badge-pulse-wait 2s infinite;
}

.status-playing {
  background: var(--success);
  color: black;
  box-shadow: 0 0 10px var(--success);
  animation: badge-pulse-play 2s infinite;
}

@keyframes badge-pulse-wait {
    0% { box-shadow: 0 0 5px var(--warning); }
    50% { box-shadow: 0 0 15px var(--warning); }
    100% { box-shadow: 0 0 5px var(--warning); }
}

@keyframes badge-pulse-play {
    0% { box-shadow: 0 0 5px var(--success); }
    50% { box-shadow: 0 0 15px var(--success); }
    100% { box-shadow: 0 0 5px var(--success); }
}

/* Timer Text */
.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px black;
    z-index: 2;
    line-height: 1;
}

body {
    background: url('assets/gui/bg_menu.png') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.glass-panel {
    background: rgba(0, 0, 0, 0.6); /* Darker to contrast with bg image */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

h1,
h2,
h3 {
  margin-bottom: 1rem;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}


.btn {
    background: url('assets/gui/primary_btn.png') no-repeat center center;
    background-size: 100% 100%;
    border: none;
    padding: 15px 30px; /* Larger to fit image */
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 2px black;
    min-width: 120px;
}
.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: none; /* remove default shadow as image handles it roughly */
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(1);
}

/* ... */

.btn-danger, .btn-warning {
    background: url('assets/gui/warning_btn.png') no-repeat center center;
    background-size: 100% 100%;
}

.btn-success {
    background: url('assets/gui/success_btn.png') no-repeat center center;
    background-size: 100% 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: auto;
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--glass-border);
  padding: 12px;
  border-radius: 8px;
  color: white;
  width: 100%;
  margin-bottom: 1rem;
  font-size: 1rem;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

input[type="text"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
}

/* Room List */
.room-list {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
}

.room-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.room-item:hover {
  background: rgba(0, 0, 0, 0.3);
}

.room-status {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  text-align: center;
  margin: 2rem 0;
}


/* Chat Sidebar */
.chat-sidebar {
    position: fixed;
    top: 0;
    right: -350px; /* Hidden */
    width: 300px;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 1px solid var(--glass-border);
    transition: right 0.3s ease;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.chat-sidebar.open {
    right: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-msg {
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 8px;
    font-size: 0.9rem;
    word-break: break-word;
}

.chat-msg.mine {
    background: rgba(79, 209, 197, 0.2);
    align-self: flex-end;
}

.chat-msg .sender {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 2px;
}

.chat-input-area {
    display: flex;
    gap: 5px;
}

/* Custom Scrollbar for Logs & Chat */
.log-area::-webkit-scrollbar, .chat-messages::-webkit-scrollbar {
    width: 8px;
}

.log-area::-webkit-scrollbar-track, .chat-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.log-area::-webkit-scrollbar-thumb, .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.log-area::-webkit-scrollbar-thumb:hover, .chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

/* Chat Notification Dot */
.chat-toggle-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    cursor: pointer;
    z-index: 1400;
    color: white;
    transition: right 0.3s ease;
}

.chat-notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background-color: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
    display: none; /* Hidden by default */
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.emoji-btn {
    font-size: 1.5rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    cursor: pointer;
    padding: 5px;
    text-align: center;
}

.emoji-btn:hover {
    background: rgba(255,255,255,0.3);
}

.player-emote {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    animation: bounce 0.5s infinite alternate;
    pointer-events: none;
    z-index: 50; 
}

@keyframes bounce {
    from { transform: translateX(-50%) translateY(0); }
    to { transform: translateX(-50%) translateY(-10px); }
}

/* Avatar Selection */
.avatar-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.avatar-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.avatar-option.selected {
    border-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}


.player-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    position: relative; /* For emojies */
}

.vs-badge {
  align-self: center;
  font-size: 2rem;
  font-weight: bold;
  color: var(--warning);
}

.score {
  font-size: 3rem;
  font-weight: bold;
  margin: 1rem 0;
}

.move-display {
  font-size: 4rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.move-btn {
  font-size: 1.5rem;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.move-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.move-btn.selected {
  background: var(--success);
  border-color: white;
}

/* Game Log Updates */
.log-area {
    margin-top: 2rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.15); /* Light border */
    border-radius: 8px;
    padding: 0.8rem;
    max-height: 120px;
    overflow-y: auto;
    font-family: 'Courier New', monospace; /* More code-like */
    font-size: 0.8rem; /* Smaller text */
    text-align: left;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.log-entry {
    margin-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.05); /* Fainter separator */
    padding-bottom: 0.2rem;
    color: rgba(255,255,255,0.9);
}

.winner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
  backdrop-filter: blur(5px);
}



@media (max-width: 600px) {
  .game-board {
    grid-template-columns: 1fr;
  }
  .vs-badge {
    margin: 1rem 0;
  }
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(
    135deg,
    rgba(40, 44, 52, 0.95),
    rgba(20, 24, 32, 0.95)
  );
  margin: 10% auto;
  padding: 30px;
  border: 1px solid var(--glass-border);
  width: 90%;
  max-width: 500px;
  border-radius: 16px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  color: var(--text);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
  color: white;
  text-decoration: none;
}

/* Floating Icons */
.top-right-icon, .bottom-right-icon {
    position: fixed;
    z-index: 1000;
    width: 64px;
    height: 64px;
    cursor: pointer;
    transition: transform 0.2s;
    background: none;
    border: none;
    display: block;
}

.top-right-icon {
    top: 20px;
    right: 20px;
}

.bottom-right-icon {
    bottom: 20px;
    right: 20px;
}

.top-right-icon img, .bottom-right-icon img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
}

.top-right-icon:hover, .bottom-right-icon:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Responsive Fixes */
@media (max-width: 768px) {
    .game-board {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .vs-badge {
        margin: 0.5rem 0;
        font-size: 1.5rem;
    }
    .player-card {
        padding: 1rem;
    }
    .move-display {
        font-size: 3rem;
        min-height: 60px;
    }
    .score-dots {
        justify-content: center;
    }
    .chat-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* Score Board (Dots) */
.score-dots {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    justify-content: center;
}

.score-dot {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px; /* Rounded squares */
    background: rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.score-dot.active {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Timer Bar */
.timer-container {
    width: 200px;
    height: 16px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.2);
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #f6ad55, #fc8181);
    transform-origin: left;
    transition: width 0.1s linear;
}

/* Move Display States */
.move-display {
    transition: all 0.3s ease;
    border-radius: 50%; /* Make glow circular if icon is central */
    width: 120px;       /* Ensure enough space for glow */
    height: 120px;
    margin: 1rem auto;
}

.move-display.waiting-opp {
    box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.5);
    animation: pulse-white 1.5s infinite;
}

.move-display.win-glow {
    box-shadow: 0 0 20px 5px var(--success);
    background: rgba(79, 209, 197, 0.1);
    border: 2px solid var(--success);
}

.move-display.lose-glow {
    box-shadow: 0 0 20px 5px var(--danger);
    background: rgba(252, 129, 129, 0.1);
    border: 2px solid var(--danger);
}

@keyframes pulse-white {
    0% { box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.3); }
    50% { box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.6); }
    100% { box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.3); }
}

/* Enhanced Icons */
.move-display i {
    font-size: 5rem !important; /* Bigger */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Custom Checkbox Toggles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.2);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Updated Finished Badge */
.status-finished {
    background: #2d3748;
    color: white;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 10px #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Reversed/Continuous Glow for Room Badges */
@keyframes badge-pulse-wait-reverse {
    0% { box-shadow: 0 0 5px var(--warning); }
    50% { box-shadow: 0 0 15px var(--warning); }
    100% { box-shadow: 0 0 5px var(--warning); }
}

.status-waiting {
    animation-direction: alternate-reverse !important;
    animation-duration: 1.5s !important;
}

/* Timer Text */
.timer-text {
    /* (Existing, just ensuring it stays) */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px black;
    z-index: 2;
    line-height: 1;
}
.dev-info-list {
  list-style: none;
  margin-top: 1rem;
  padding: 0;
}

.dev-info-list li {
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dev-info-list a {
  color: var(--success);
  text-decoration: none;
  transition: color 0.2s;
}

.dev-info-list a:hover {
  color: white;
  text-decoration: underline;
}

/* Confetti */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background-color: #f2d74e;
  position: fixed;
  top: -10px;
  z-index: 9999;
}

@keyframes fall {
    to { transform: translateY(100vh) rotate(720deg); }
}
