* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Courier New", monospace;
  background: linear-gradient(180deg, #5c94fc 0%, #88c0ff 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  image-rendering: pixelated;
}

/* SMB3 Sky with clouds */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(
      ellipse 80px 40px at 15% 20%,
      #ffffff 40%,
      transparent 40%
    ),
    radial-gradient(ellipse 60px 30px at 10% 20%, #ffffff 40%, transparent 40%),
    radial-gradient(ellipse 70px 35px at 22% 20%, #ffffff 40%, transparent 40%),
    radial-gradient(ellipse 90px 45px at 85% 60%, #ffffff 40%, transparent 40%),
    radial-gradient(ellipse 70px 35px at 78% 60%, #ffffff 40%, transparent 40%),
    radial-gradient(ellipse 80px 40px at 95% 60%, #ffffff 40%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* SMB3 Ground */
body::after {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(
    180deg,
    #00a800 0%,
    #00a800 30%,
    #e09038 30%,
    #e09038 100%
  );
  border-top: 4px solid #000000;
  pointer-events: none;
  z-index: 0;
  box-shadow: inset 0 3px 0px rgba(255, 255, 255, 0.3);
}

.container {
  background: #fcb040;
  border: 5px solid #000000;
  padding: 40px;
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.3),
    inset -4px -4px 0px rgba(0, 0, 0, 0.2),
    inset 4px 4px 0px rgba(255, 255, 255, 0.3);
  max-width: 800px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ========================================
   GAME HEADER (Text-Only)
   ======================================== */

.game-header {
  text-align: center;
  padding: 40px 20px 20px 20px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: "Bungee", "Courier New", monospace;
  font-size: 4em;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  padding: 0;
  line-height: 1;

  /* Layered text shadow for depth and impact */
  text-shadow:
    /* Black outline */
    6px 6px 0px #000000,
    -3px -3px 0px #000000,
    3px -3px 0px #000000,
    -3px 3px 0px #000000,

    /* Orange/red highlight for retro pop */
    -4px -4px 0px #ff4040,

    /* Deep shadow for 3D effect */
    8px 8px 0px rgba(0, 0, 0, 0.5),

    /* Subtle glow */
    0 0 30px rgba(252, 176, 64, 0.3);

  /* Prevent text selection */
  user-select: none;
  -webkit-user-select: none;
}

h2 {
  color: #000000;
  font-weight: bold;
  text-transform: uppercase;
}

/* ========================================
   PANEL SYSTEM (SMB3 Theme)
   ======================================== */

/* Base Panel Style */
.panel {
  background: #fcb040;
  border: 5px solid #000000;
  padding: 20px;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3),
    inset -4px -4px 0px rgba(0, 0, 0, 0.2),
    inset 4px 4px 0px rgba(255, 255, 255, 0.3);
  position: relative;
  margin-bottom: 20px;
}

/* Corner Bolts (Top) */
.panel::before,
.panel::after {
  content: "⊗";
  position: absolute;
  top: 8px;
  font-size: 20px;
  color: #000000;
  font-weight: bold;
  line-height: 1;
  z-index: 2;
}

.panel::before {
  left: 8px;
}

.panel::after {
  right: 8px;
}

.panel-players {
  /* min-height: 632px; */
}

/* Blue Panel (Room Info) */
.panel-blue {
  background: linear-gradient(180deg, #a8d8ff 0%, #88c0ff 100%);
}

.panel-blue h2 {
  color: #000000;
}

/* Pink Panel (Players) */
.panel-pink {
  background: linear-gradient(180deg, #ffc8d8 0%, #ffb0c0 100%);
}

/* Pipe Panel (Chat - Green) */
.panel-pipe {
  background: linear-gradient(
    90deg,
    #00c800 0%,
    #00c800 20%,
    #00a800 20%,
    #00a800 40%,
    #00c800 40%,
    #00c800 60%,
    #00a800 60%,
    #00a800 80%,
    #00c800 80%,
    #00c800 100%
  );
  padding: 0;
  overflow: hidden;
}

.panel-pipe .chat-section {
  margin: 0;
  border: none;
  box-shadow: none;
}

.panel-pipe .chat-header {
  background: #008800;
  border-bottom: 5px solid #000000;
}

/* Orange/Brown Panel (Ready-Up) */
.panel-orange {
  background: linear-gradient(180deg, #f09038 0%, #e09038 100%);
}

/* Panel Title */
.panel-title {
  margin: 0 0 20px 0;
  text-align: center;
  color: #000000;
  font-size: 1.3em;
  text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

/* Two-Column Layout */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.column-left,
.column-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Adjust room info panel */
.room-info-panel .room-info {
  margin-bottom: 0;
}

/* Screen visibility */
.join-screen,
.waiting-screen,
.game-screen,
.results-screen {
  display: none;
}

.join-screen.active,
.waiting-screen.active,
.game-screen.active,
.results-screen.active {
  display: block;
}

/* Instructions */
.instructions {
  background: #ffffff;
  padding: 20px;
  border: 4px solid #000000;
  margin-bottom: 20px;
  line-height: 1.6;
  box-shadow: inset 3px 3px 0px rgba(0, 0, 0, 0.1);
  font-weight: bold;
  color: #000000;
}

.instructions strong {
  color: #c84c0c;
  text-transform: uppercase;
}

/* Input fields */
.player-input {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}

.player-input input[type="text"] {
  flex: 1;
  padding: 12px;
  border: 4px solid #000000;
  font-size: 16px;
  background: #ffffff;
  font-family: "Courier New", monospace;
  font-weight: bold;
}

.player-input input:focus {
  outline: none;
  border-color: #000000;
  background: #ffffaa;
  box-shadow: 0 0 0 2px #fcb040;
}

.color-picker {
  width: 60px;
  height: 45px;
  border: 4px solid #000000;
  cursor: pointer;
  box-shadow: 2px 2px 0px #000000;
}

/* Buttons */
.btn {
  background: #e09038;
  color: #ffffff;
  border: 4px solid #000000;
  padding: 15px 30px;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.1s;
  width: 100%;
  margin-top: 10px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: 2px 2px 0px #000000;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(255, 255, 255, 0.3);
  position: relative;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.3),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(255, 255, 255, 0.3);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(255, 255, 255, 0.3);
}

.secondary-btn {
  background: #c84c0c;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(200, 76, 12, 0.5);
}

/* Divider */
.divider {
  text-align: center;
  margin: 20px 0;
  color: #000000;
  font-weight: bold;
  text-shadow: 2px 2px 0px #ffffff;
  font-size: 1.3em;
}

/* Join room section */
.join-room-section {
  margin-top: 10px;
}

.join-room-section input {
  width: 100%;
  padding: 12px;
  border: 4px solid #000000;
  font-size: 18px;
  text-align: center;
  margin-bottom: 10px;
  background: #ffffff;
  font-family: "Courier New", monospace;
  font-weight: bold;
}

/* Waiting room */
.room-info {
  text-align: center;
  margin-bottom: 30px;
}

.room-code {
  display: inline-block;
  background: #00a800;
  color: #ffffff;
  padding: 10px 30px;
  border: 4px solid #000000;
  font-size: 2em;
  font-weight: bold;
  letter-spacing: 5px;
  margin-top: 10px;
  text-shadow: 3px 3px 0px #000000;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.4),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(88, 216, 84, 0.4);
}

.room-hint {
  color: #000000;
  margin-top: 10px;
  font-size: 0.9em;
  font-weight: bold;
}

.players-waiting {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin: 24px 0;
  min-height: 50px;
}

.player-card {
  background: #ffffff;
  border: 4px solid #000000;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.player-card.ready {
  border-color: #000000;
  background: #58d854;
  border-width: 5px;
}

.player-card.me {
  border-color: #000000;
  background: #fcb040;
  border-width: 5px;
}

.player-color-badge {
  width: 50px;
  height: 50px;
  border: 4px solid #000000;
  box-shadow: 2px 2px 0px #000000;
}

.player-info {
  flex: 1;
}

.player-card-name {
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 5px;
}

.player-status {
  font-size: 0.9em;
  color: #000000;
  font-weight: bold;
}

.player-card.ready .player-status {
  color: #ffffff;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000000;
}

.ready-section {
  text-align: center;
  margin-top: 30px;
}

.ready-btn {
  max-width: 300px;
  margin: 0 auto;
}

.ready-btn.ready {
  background: #00a800;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3),
    inset -3px -3px 0px rgba(0, 0, 0, 0.3),
    inset 3px 3px 0px rgba(88, 216, 84, 0.4);
}

.waiting-text {
  margin-top: 15px;
  color: #000000;
  font-size: 0.95em;
  font-weight: bold;
}

/* Chat Section */
.chat-section {
  margin: 30px 0;
  background: #ffffff;
  border: 4px solid #000000;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.chat-header {
  background: #00a800;
  color: #ffffff;
  padding: 12px 20px;
  margin: 0;
  font-size: 1.2em;
  text-shadow: 2px 2px 0px #000000;
  border-bottom: 4px solid #000000;
  text-transform: uppercase;
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 15px;
  background: #fffef7;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar {
  width: 12px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #e09038;
  border: 2px solid #000000;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #00a800;
  border: 2px solid #000000;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #58d854;
}

.chat-message {
  padding: 8px 12px;
  background: #ffffff;
  border: 3px solid #000000;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
  word-wrap: break-word;
  animation: message-appear 0.2s ease-out;
}

@keyframes message-appear {
  from {
    transform: translateX(-10px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.chat-message-author {
  font-weight: bold;
  margin-right: 8px;
  text-transform: uppercase;
}

.chat-message-text {
  color: #000000;
  font-weight: normal;
}

.chat-input-area {
  display: flex;
  gap: 0;
  border-top: 4px solid #000000;
}

.chat-input {
  flex: 1;
  padding: 12px;
  border: none;
  border-right: 4px solid #000000;
  font-size: 16px;
  background: #ffffff;
  font-family: "Courier New", monospace;
  font-weight: bold;
}

.chat-input:focus {
  outline: none;
  background: #ffffaa;
}

.chat-send-btn {
  background: #e09038;
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: 2px 2px 0px #000000;
  transition: background 0.1s;
}

.chat-send-btn:hover {
  background: #fcb040;
}

.chat-send-btn:active {
  background: #c84c0c;
}

/* Game screen */
.timer {
  text-align: center;
  font-size: 3em;
  font-weight: bold;
  color: #ffffff;
  margin: 30px 0;
  text-shadow: 4px 4px 0px #000000, -2px -2px 0px #e09038;
}

.countdown {
  text-align: center;
  font-size: 5em;
  font-weight: bold;
  color: #ffffff;
  margin: 50px 0;
  text-shadow: 6px 6px 0px #000000, -3px -3px 0px #c84c0c;
  animation: countdown-pulse 1s ease-in-out infinite;
}

@keyframes countdown-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.player-box {
  background: #ffffff;
  padding: 20px;
  text-align: center;
  border: 4px solid #000000;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.player-box.my-player {
  border-color: #000000;
  background: #fcb040;
  border-width: 5px;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.4),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.player-name {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 15px;
  color: #000000;
  text-transform: uppercase;
}

.player-score {
  font-size: 3em;
  font-weight: bold;
  margin: 20px 0;
  color: #ffffff;
  text-shadow: 3px 3px 0px #000000, -2px -2px 0px #c84c0c;
}

.smash-button {
  width: 100%;
  height: 120px;
  border: 5px solid #000000;
  font-size: 1.5em;
  font-weight: bold;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.05s;
  text-transform: uppercase;
  font-family: "Courier New", monospace;
  text-shadow: 3px 3px 0px #000000, -2px -2px 0px rgba(255, 255, 255, 0.3);
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.4),
    inset -4px -4px 0px rgba(0, 0, 0, 0.3),
    inset 4px 4px 0px rgba(255, 255, 255, 0.3);
  position: relative;
}

.smash-button:hover:not(.disabled) {
  transform: scale(1.05);
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.4),
    inset -4px -4px 0px rgba(0, 0, 0, 0.3),
    inset 4px 4px 0px rgba(255, 255, 255, 0.3);
}

.smash-button:active:not(.disabled) {
  transform: scale(0.95) translateY(4px);
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4),
    inset -4px -4px 0px rgba(0, 0, 0, 0.3),
    inset 4px 4px 0px rgba(255, 255, 255, 0.3);
}

.smash-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Results screen */
.trophy {
  font-size: 3em;
  margin-bottom: 20px;
}

.results-list {
  margin: 30px 0;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin: 10px 0;
  background: #ffffff;
  border: 4px solid #000000;
  font-size: 1.2em;
  transition: transform 0.2s;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
  font-weight: bold;
}

.result-item:hover {
  transform: translateX(5px);
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3),
    inset 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.winner-item {
  border: 5px solid #fcb040;
  background: #ffeb3b;
  animation: pulse 2s infinite;
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.4),
    inset 3px 3px 0px rgba(255, 255, 255, 0.5), 0 0 20px rgba(252, 176, 64, 0.6);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.result-rank {
  font-weight: bold;
  color: #c84c0c;
  width: 40px;
  font-size: 1.3em;
}

.result-name {
  flex: 1;
  font-weight: bold;
  color: #000000;
}

.result-score {
  font-weight: bold;
  color: #00a800;
  font-size: 1.3em;
}

/* Responsive design */

/* Tablet: Adjust column widths */
@media (max-width: 768px) {
  .game-layout {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .game-header {
    padding: 30px 20px 15px 20px;
  }

  h1 {
    font-size: 3em;
    text-shadow:
      5px 5px 0px #000000,
      -2px -2px 0px #000000,
      2px -2px 0px #000000,
      -2px 2px 0px #000000,
      -3px -3px 0px #ff4040,
      6px 6px 0px rgba(0, 0, 0, 0.5),
      0 0 20px rgba(252, 176, 64, 0.3);
  }
}

/* Mobile: Single column stack */
@media (max-width: 600px) {
  .container {
    padding: 20px;
  }

  .panel {
    padding: 15px;
    margin-bottom: 15px;
  }

  .game-header {
    padding: 20px 15px 10px 15px;
  }

  h1 {
    font-size: 2.2em;
    text-shadow:
      4px 4px 0px #000000,
      -2px -2px 0px #000000,
      2px -2px 0px #000000,
      -2px 2px 0px #000000,
      -3px -3px 0px #ff4040,
      5px 5px 0px rgba(0, 0, 0, 0.5),
      0 0 15px rgba(252, 176, 64, 0.3);
  }

  .room-code {
    font-size: 1.5em;
    letter-spacing: 3px;
    padding: 8px 20px;
  }

  .players-grid {
    grid-template-columns: 1fr;
  }

  .players-waiting {
    grid-template-columns: 1fr;
  }

  .game-layout {
    gap: 12px;
  }

  .column-left,
  .column-right {
    gap: 12px;
  }

  /* Adjust panel corner bolts for mobile */
  .panel::before,
  .panel::after {
    font-size: 16px;
    top: 6px;
  }

  .panel::before {
    left: 6px;
  }

  .panel::after {
    right: 6px;
  }
}
