*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Patrick Hand', 'Comic Sans MS', cursive, sans-serif;
  background: #1a1040;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 107, 107, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(78, 205, 196, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 217, 61, 0.05) 0%, transparent 60%);
  color: #f0e6ff;
  letter-spacing: 0.02em;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  padding: 1rem 2rem;
  border-bottom: 3px dashed #ff6b6b;
  background: linear-gradient(135deg, #2d1b69, #1a1040, #162447);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, #ff6b6b, #ffd93d 25%, #6bcb77 50%, #4d96ff 75%, #ff6b6b 100%);
  background-size: 200px 3px;
  animation: rainbow-border 3s linear infinite;
}

@keyframes rainbow-border {
  0% { background-position: 0 0; }
  100% { background-position: 200px 0; }
}

.header-left {
  flex: 1;
}

.app-header h1 {
  margin: 0;
  font-size: 1.7rem;
  font-family: 'Bubblegum Sans', 'Comic Sans MS', cursive;
  color: #ffd93d;
  text-shadow: 2px 2px 0px #ff6b6b, -1px -1px 0px #4d96ff;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: #c4b5fd;
  font-size: 0.95rem;
  font-style: italic;
}

.header-timer {
  background: rgba(107, 203, 119, 0.15);
  border: 3px solid #6bcb77;
  border-radius: 1rem;
  padding: 0.5rem 1rem;
  min-width: 60px;
  text-align: center;
  transform: rotate(2deg);
  box-shadow: 3px 3px 0px rgba(107, 203, 119, 0.3);
}

.header-timer #header-timer-text {
  font-size: 1.3rem;
  font-weight: bold;
  color: #6bcb77;
  font-family: 'Bubblegum Sans', cursive;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.view {
  display: none;
  width: 100%;
  max-width: 960px;
}

.view.active {
  display: block;
}

#game-view.view {
  max-width: none;
}

main:has(#game-view.active) {
  padding: 0;
  align-items: stretch;
}

.card {
  margin: 0 auto;
  max-width: 480px;
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border-radius: 1.2rem;
  padding: 1.5rem;
  box-shadow: 6px 6px 0px #ff6b6b, -2px -2px 0px #4d96ff;
  border: 3px solid #ffd93d;
  transform: rotate(-0.5deg);
  transition: transform 0.2s;
}

.card:hover {
  transform: rotate(0.3deg) scale(1.01);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
  text-shadow: 2px 2px 0px rgba(255, 107, 107, 0.4);
}

.card p {
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: #c4b5fd;
}

label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: #c4b5fd;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.8rem;
  border: 2px dashed #7c3aed;
  background: rgba(30, 18, 80, 0.8);
  color: #f0e6ff;
  margin-bottom: 1rem;
  font-family: 'Patrick Hand', cursive;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #ffd93d;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(255, 217, 61, 0.3), 4px 4px 0px #ff6b6b;
}

.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

button {
  border-radius: 1rem;
  border: 2.5px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: 'Bubblegum Sans', cursive;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  letter-spacing: 0.03em;
  position: relative;
}

button.primary {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: white;
  border-color: #ffd93d;
  box-shadow: 4px 4px 0px #ffd93d;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

button.primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #ffd93d;
}

button.primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #ffd93d;
}

button.secondary {
  background: #2d1b69;
  color: #c4b5fd;
  border: 2.5px solid #7c3aed;
  box-shadow: 3px 3px 0px #4d96ff;
}

button.secondary:hover {
  background: #3b2280;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #4d96ff;
}

button.secondary:active {
  transform: scale(0.98);
  box-shadow: 1px 1px 0px #4d96ff;
}

button.danger {
  background: #dc2626;
  color: white;
  border-color: #ff6b6b;
  box-shadow: 3px 3px 0px #ff6b6b;
}

button.danger:hover {
  background: #ef4444;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #ff6b6b;
}

button.danger:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #ff6b6b;
}

.info-text {
  font-size: 0.95rem;
  color: #c4b5fd;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.canvas-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 220px;
  overflow-y: auto;
}

.canvas-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.8rem;
  background: rgba(45, 27, 105, 0.6);
  border: 2px dashed #7c3aed;
  margin-bottom: 0.5rem;
  transition: transform 0.15s, border-color 0.15s;
}

.canvas-list-item:hover {
  border-color: #ffdb0e;
}

.canvas-list-item span {
  font-size: 0.95rem;
}

.canvas-meta {
  font-size: 0.85rem;
  color: #a78bfa;
}

.drawing-layout {
  display: flex;
  justify-content: center;
  align-items: center;
  height: calc(100vh - 80px);
  gap: 1.5rem;
  padding: 1.5rem;
  overflow: auto;
}

.drawing-layout .canvas-container {
  width: 800px;
  height: 600px;
  flex: none;
}

.toolbar {
  width: 220px;
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 3px solid #7c3aed;
  box-shadow: 4px 4px 0px #4d96ff;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 1.5rem;
}

.toolbar h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toolbar-section input[type="color"] {
  width: 100%;
  border-radius: 0.8rem;
  border: 2px solid #7c3aed;
  padding: 0.25rem;
  background: #1e1250;
  cursor: pointer;
}

.toolbar-section input[type="range"] {
  width: 100%;
}

.canvas-container {
  background: #fffef5;
  border-radius: 0.8rem;
  overflow: hidden;
  position: relative;
  box-shadow: 5px 5px 0px #ffd93d, -2px -2px 0px #ff6b6b;
  border: 3px solid #4d96ff;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

.canvas-area .canvas-container {
  border-radius: 0.5rem 0.5rem 0 0;
}

/* Canvas cursor and touch feedback */
#drawing-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #fffef5;
  cursor: crosshair;
}

#drawing-canvas:not(.is-drawer) {
  cursor: default;
}

/* Touch indicator */
.touch-indicator {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s;
}

.touch-indicator.active {
  opacity: 0.5;
}

/* Mobile floating word display for drawer */
/*.mobile-word-display {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
  color: #fbbf24;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: bold;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: none;
  border: 2px solid #3b82f6;
}

.mobile-word-display .word-label {
  color: #93c5fd;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
}*/

/* Lobby styles */
.lobby-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.players-section h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
}

.players-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}

.players-list li {
  padding: 0.5rem 0.75rem;
  background: rgba(45, 27, 105, 0.6);
  border-radius: 0.6rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px dashed #7c3aed;
}

.player-status {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
  background: #2d1b69;
  border: 1px solid #7c3aed;
  font-family: 'Bubblegum Sans', cursive;
}

.player-status.ready {
  background: #059669;
  color: white;
  border-color: #6bcb77;
  box-shadow: 2px 2px 0px #6bcb77;
}

.lobby-controls {
  display: flex;
  gap: 0.5rem;
}

/* Game view styles */
.game-layout {
  display: flex;
  align-items: stretch;
  height: calc(100vh - 80px);
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
}

.game-sidebar {
  width: 300px;
  min-width: 280px;
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border-radius: 1rem;
  padding: 1rem;
  border: 3px solid #7c3aed;
  box-shadow: 4px 4px 0px #4d96ff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
}

#word-hint {
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.2em;
  color: #ffd93d;
  margin: 0;
  font-family: 'Bubblegum Sans', cursive;
  text-shadow: 2px 2px 0px rgba(255, 107, 107, 0.3);
}

/* Chosen word display for drawer */
.chosen-word-container {
  text-align: center;
  padding: 0.75rem;
  background: linear-gradient(135deg, #2d1b69, #4c1d95);
  border-radius: 0.8rem;
  margin-bottom: 0.5rem;
  border: 2px dashed #6bcb77;
  box-shadow: 3px 3px 0px #6bcb77;
}

.word-label {
  font-size: 0.9rem;
  color: #c4b5fd;
  margin-right: 0.5rem;
}

.chosen-word {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ffd93d;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Bubblegum Sans', cursive;
  text-shadow: 1px 1px 0px #ff6b6b;
}

.timer-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timer-bar {
  width: 100%;
  height: 10px;
  background: #2d1b69;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #7c3aed;
}

.timer-fill {
  height: 100%;
  background: linear-gradient(to right, #6bcb77, #ffd93d, #ff6b6b);
  transition: width 1s linear;
  width: 100%;
  border-radius: 4px;
}

#timer-text {
  text-align: center;
  font-size: 0.95rem;
  color: #c4b5fd;
  font-family: 'Bubblegum Sans', cursive;
}

.game-players-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-players-list li {
  padding: 0.4rem 0.6rem;
  background: rgba(45, 27, 105, 0.6);
  border-radius: 0.6rem;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  border: 1px dashed #7c3aed;
}

.player-score {
  font-weight: bold;
  color: #ffd93d;
  font-family: 'Bubblegum Sans', cursive;
}

.current-drawer {
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
  color: white;
  border-color: #ffd93d !important;
  border-style: solid !important;
  box-shadow: 2px 2px 0px #ffd93d;
}

/* Chat styles */
.chat-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.chat-section h4 {
  margin: 0;
  font-size: 1rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
}

.chat-messages {
  flex: 1;
  min-height: 100px;
  overflow-y: auto;
  background: rgba(30, 18, 80, 0.6);
  border-radius: 0.6rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 2px dashed #4d96ff;
}

.chat-message {
  font-size: 0.9rem;
  word-wrap: break-word;
}

.chat-message .sender {
  font-weight: 600;
  color: #ffd93d;
  margin-right: 0.5rem;
}

.chat-message.system {
  color: #a78bfa;
  font-style: italic;
  font-size: 0.9em;
}

.chat-message.correct-guess {
  color: #6bcb77;
  font-weight: 600;
  text-shadow: 1px 1px 0px rgba(107, 203, 119, 0.3);
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
}

#chat-input {
  flex: 1;
  padding: 0.5rem;
  border-radius: 0.6rem;
  border: 2px dashed #7c3aed;
  background: rgba(30, 18, 80, 0.8);
  color: #f0e6ff;
  font-family: 'Patrick Hand', cursive;
}

#chat-input:focus {
  outline: none;
  border-color: #ffd93d;
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(255, 217, 61, 0.3);
}

/* Drawing controls below canvas */
.drawing-controls {
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border-radius: 0 0 0.8rem 0.8rem;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  border: 3px solid #4d96ff;
  border-top: none;
  flex-shrink: 0;
}

.drawing-control-group {
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  align-items: center;
}

.drawing-control-group label {
  font-size: 0.85rem;
  color: #c4b5fd;
  margin: 0;
  white-space: nowrap;
}

.drawing-controls input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid #7c3aed;
  border-radius: 8px;
  cursor: pointer;
  padding: 1px;
  background: #1e1250;
}

.drawing-controls input[type="range"] {
  width: 100px;
}

.drawing-controls button {
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
}

/* Quick color picker buttons */
.quick-colors {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.quick-color-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  border: 2.5px solid #7c3aed;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.quick-color-btn:hover {
  transform: scale(1.2) rotate(10deg);
  border-color: #ffd93d;
}

.quick-color-btn.active {
  border-color: #ffd93d;
  box-shadow: 0 0 0 3px rgba(255, 217, 61, 0.4);
  transform: scale(1.1);
}

/* Word selection overlay */
.word-selection {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border: 3px solid #ffd93d;
  border-radius: 1.2rem;
  padding: 2rem;
  display: none;
  z-index: 10;
  box-shadow: 6px 6px 0px #ff6b6b;
}

.word-selection.active {
  display: block;
}

.word-selection h3 {
  margin: 0 0 1.5rem 0;
  text-align: center;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
  font-size: 1.3rem;
}

.word-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.word-option {
  padding: 0.75rem 1.5rem;
  background: rgba(45, 27, 105, 0.6);
  border: 2px dashed #7c3aed;
  color: #f0e6ff;
  border-radius: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Bubblegum Sans', cursive;
  font-size: 1.1rem;
}

.word-option:hover {
  background: rgba(76, 29, 149, 0.6);
  border-color: #ffd93d;
  border-style: solid;
  transform: translateY(-3px) rotate(1deg);
  box-shadow: 3px 3px 0px #ffd93d;
}

/* End game styles */
.winner-section {
  text-align: center;
  margin-bottom: 2rem;
}

#winner-text {
  font-size: 2rem;
  color: #ffd93d;
  margin: 0;
  font-family: 'Bubblegum Sans', cursive;
  text-shadow: 3px 3px 0px #ff6b6b, -1px -1px 0px #4d96ff;
  animation: winner-wobble 0.5s ease-in-out infinite alternate;
}

@keyframes winner-wobble {
  0% { transform: rotate(-2deg); }
  100% { transform: rotate(2deg); }
}

.final-scores {
  margin-bottom: 2rem;
}

.final-scores h3 {
  margin: 0 0 1rem 0;
  text-align: center;
  font-size: 1.3rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #c4b5fd;
}

.final-scores-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.final-scores-list li {
  padding: 1rem;
  background: rgba(45, 27, 105, 0.6);
  border-radius: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  transition: transform 0.2s;
  border: 2px dashed #7c3aed;
}

.final-scores-list li:hover {
  transform: translateX(5px);
}

.final-scores-list li.winner {
  background: linear-gradient(135deg, #ffd93d, #ff6b6b);
  color: #1a1040;
  font-weight: bold;
  box-shadow: 5px 5px 0px #4d96ff;
  border-color: #ffd93d;
  border-style: solid;
  animation: pulse 2s infinite;
}

.final-scores-list li.winner .player-score {
  color: #1a1040;
  font-weight: bold;
}

.final-scores-list li:nth-child(2) {
  background: linear-gradient(to right, #7c3aed, #6d28d9);
  color: white;
  border-color: #a78bfa;
  border-style: solid;
  box-shadow: 3px 3px 0px #a78bfa;
}

.final-scores-list li:nth-child(3) {
  background: linear-gradient(to right, #4d96ff, #3b82f6);
  color: white;
  border-color: #93c5fd;
  border-style: solid;
  box-shadow: 3px 3px 0px #93c5fd;
}

.rank {
  font-weight: bold;
  margin-right: 1rem;
  font-size: 1.2rem;
  min-width: 40px;
}

.player-name {
  flex: 1;
}

.player-score {
  font-weight: bold;
  color: #ffd93d;
  font-size: 1.1rem;
  font-family: 'Bubblegum Sans', cursive;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(251, 191, 36, 0.6);
  }
  100% {
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
  }
}

/* Lock icon for private games */
.lock-icon {
  font-size: 0.85em;
  margin-right: 0.25rem;
}

/* Password modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 16, 64, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.modal-card {
  background: linear-gradient(145deg, #2d1b69, #1e1250);
  border: 3px solid #ffd93d;
  border-radius: 1.2rem;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 6px 6px 0px #ff6b6b;
}

.modal-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-family: 'Bubblegum Sans', cursive;
  color: #ffd93d;
}

.modal-card p {
  margin: 0 0 1rem 0;
  color: #c4b5fd;
  font-size: 0.9rem;
}

/* Confetti animation */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 1000;
  animation: confetti-fall linear;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }

  .app-header {
    padding: 0.75rem 1rem;
  }

  .app-header h1 {
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .header-timer {
    padding: 0.4rem 0.8rem;
    min-width: 55px;
  }

  .header-timer #header-timer-text {
    font-size: 1.1rem;
  }

  main {
    padding: 0.5rem;
  }

  .card {
    padding: 1rem;
    max-width: 100%;
  }

  .button-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  button {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
  }

  input[type="text"],
  input[type="password"] {
    padding: 0.75rem;
    font-size: 16px;
    min-height: 44px;
  }

  .game-layout {
    flex-direction: column;
    height: calc(100vh - 70px);
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .game-sidebar {
    width: 100%;
    position: static;
    padding: 0.75rem;
    gap: 0.75rem;
    flex: 0 1 auto;
    overflow-y: auto;
    max-height: 40%;
  }

  .game-info {
    order: 2;
    flex-shrink: 0;
  }

  .chat-section {
    order: 1;
    flex: none;
  }

  .chat-messages {
    height: 100px;
    flex: none;
  }

  #chat-input {
    font-size: 16px;
    padding: 0.75rem;
    min-height: 44px;
  }

  .canvas-area {
    flex: 1 1 auto;
    min-height: 200px;
  }

  .canvas-container {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border-radius: 0.5rem;
  }

  #drawing-canvas {
    width: 100%;
    height: 100%;
  }

  .word-selection {
    width: 95%;
    max-width: none;
    padding: 1.5rem;
  }

  .word-options {
    gap: 0.5rem;
  }

  .word-option {
    padding: 1rem;
    font-size: 1rem;
    min-height: 44px;
  }

  /* When player is drawing on mobile */
  .game-layout.is-drawer {
    flex-direction: column-reverse;
  }

  .game-layout.is-drawer .canvas-area {
    flex: 1 1 auto;
    min-height: 250px;
  }

  .game-layout.is-drawer .game-sidebar {
    flex: 0 1 auto;
    max-height: 30%;
  }

  .game-layout.is-drawer .chat-messages {
    height: 60px;
    flex: none;
  }

  .game-layout.is-drawer .game-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .game-layout.is-drawer #word-hint {
    display: none; /* Hide the underscore version for drawer */
  }

  .game-layout.is-drawer .chosen-word-container {
    display: block !important; /* Force show the chosen word */
    order: -1; /* Show it first */
    margin-bottom: 0.75rem;
  }

  /* When player is NOT drawing on mobile */
  .game-layout:not(.is-drawer) .canvas-area {
    flex: 1 1 auto;
    min-height: 200px;
  }

  .game-layout:not(.is-drawer) .chat-messages {
    height: 120px;
    flex: none;
  }

  /* Mobile drawing controls */
  .drawing-controls {
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
  }

  .drawing-controls input[type="color"] {
    width: 36px;
    height: 36px;
  }

  .quick-color-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .drawing-controls input[type="range"] {
    width: 80px;
  }

  .drawing-controls button {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    min-height: 36px;
  }

  /* Players list on mobile */
  .game-players-list {
    max-height: 120px;
    overflow-y: auto;
  }

  /* Timer improvements */
  #word-hint {
    font-size: 1.25rem;
  }

  .chosen-word-container {
    padding: 0.5rem;
  }

  .word-label {
    font-size: 0.8rem;
  }

  .chosen-word {
    font-size: 1.1rem;
  }

  .timer-bar {
    height: 10px;
  }

  #timer-text {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 0.5rem;
  }

  .app-header h1 {
    font-size: 1.1rem;
  }

  .subtitle {
    display: none;
  }

  .header-timer {
    padding: 0.25rem 0.5rem;
    min-width: 50px;
  }

  .header-timer #header-timer-text {
    font-size: 1rem;
  }

  main {
    padding: 0.25rem;
  }

  .card {
    padding: 0.75rem;
    border-radius: 0.5rem;
  }

  .card h2 {
    font-size: 1.25rem;
  }

  .game-layout {
    height: calc(100vh - 60px);
  }

  .game-sidebar {
    padding: 0.5rem;
    max-height: 35%;
  }

  .chat-messages {
    height: 80px;
    flex: none;
  }

  .drawing-controls {
    padding: 0.4rem;
    gap: 0.4rem;
  }

  .quick-color-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .drawing-controls input[type="range"] {
    width: 70px;
  }

  #word-hint {
    font-size: 1.1rem;
  }

  .chosen-word-container {
    padding: 0.4rem;
    margin-bottom: 0.4rem;
  }

  .word-label {
    font-size: 0.75rem;
  }

  .chosen-word {
    font-size: 1rem;
  }

  .word-selection {
    padding: 1rem;
  }

  .word-option {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .lobby-controls {
    flex-direction: column;
    gap: 0.5rem;
  }

  .players-list {
    max-height: 150px;
  }

  .final-scores-list li {
    padding: 0.75rem;
    font-size: 1rem;
  }

  .rank {
    font-size: 1rem;
    min-width: 30px;
  }

  /* Show floating word display on small mobile when drawer */
  .game-layout.is-drawer .mobile-word-display {
    display: block;
  }
}

/* Landscape mode improvements */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header {
    padding: 0.25rem 0.5rem;
  }

  .app-header h1 {
    font-size: 1rem;
  }

  .subtitle {
    display: none;
  }

  .game-layout {
    height: calc(100vh - 50px);
    flex-direction: row;
  }

  .game-sidebar {
    width: 300px;
    position: static;
  }

  .canvas-area {
    flex: 1;
  }

  .canvas-container {
    max-height: none;
  }

  .chat-messages {
    height: 80px;
  }

  .game-layout.is-drawer {
    flex-direction: row;
  }

  .game-layout.is-drawer .game-info {
    display: flex;
  }
}

/* Prevent zoom on input focus */
input[type="text"],
input[type="password"],
input[type="color"],
input[type="range"],
button {
  font-size: 16px;
}

/* Touch-friendly scrolling */
.chat-messages {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.canvas-list {
  -webkit-overflow-scrolling: touch;
}

.players-list {
  -webkit-overflow-scrolling: touch;
}

.game-players-list {
  -webkit-overflow-scrolling: touch;
}

/* Drawing view responsive styles */
@media (max-width: 768px) {
  .drawing-layout {
    flex-direction: column;
    height: calc(100vh - 70px);
    gap: 1rem;
    padding: 0.5rem;
  }

  .toolbar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    position: static;
  }

  .toolbar-section {
    min-width: 140px;
    flex: 1;
  }

  .toolbar h2 {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }

  .drawing-layout .canvas-container {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    max-height: calc(100vh - 200px);
  }

  .drawing-layout #drawing-canvas {
    width: 100%;
    height: 100%;
  }
}

@media (max-width: 480px) {
  .drawing-layout {
    height: calc(100vh - 60px);
    padding: 0.25rem;
  }

  .toolbar {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .toolbar-section {
    min-width: 120px;
  }

  .toolbar-section input[type="color"] {
    height: 40px;
  }

  .drawing-layout .canvas-container {
    max-height: calc(100vh - 180px);
  }
}

/* Landscape mode for drawing view */
@media (max-height: 500px) and (orientation: landscape) {
  .drawing-layout {
    flex-direction: row;
    height: calc(100vh - 50px);
  }

  .toolbar {
    width: 200px;
    flex-direction: column;
    position: static;
  }

  .toolbar-section {
    min-width: auto;
    width: 100%;
  }

  .toolbar h2 {
    text-align: left;
    margin-bottom: 0.75rem;
  }

  .canvas-container {
    height: calc(100vh - 70px);
    max-height: none;
    aspect-ratio: auto;
  }
}

/* Better visual feedback for touch */
@media (hover: none) and (pointer: coarse) {
  button:active {
    transform: scale(0.95);
  }

  .word-option:active {
    transform: translate(1px, 1px);
  }

  .canvas-list-item:active {
    background: rgba(76, 29, 149, 0.6);
  }
}

