:root {
  --color-bg-primary: #7bed9f;
  --color-panel-dark: #2c3e50;
  --color-primary: #3498db;
  --color-primary-hover: #2980b9;
  --color-success: #2ecc71;
  --color-danger: #e74c3c;
  --color-warning: #f1c40f;
  --color-text-light: #fff;
  --color-text-muted: #cbd5e1;
  --color-text-dark: #2c3e50;

  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: 1px solid rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --overlay-bg: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

@font-face {
  font-family: 'Pricedown';
  src: url('/fonts/pricedown.otf') format('opentype');
}


html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background-color: var(--color-bg-primary);
}

#gameCanvas {
  display: block;
}

/* Naming Dialog */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.dialog-content {
  background-color: var(--color-panel-dark);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  color: var(--color-text-light);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

#action-dialog,
#name-dialog .dialog-content {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text-light);
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Generalized Buttons */
.btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
  transition: all 0.2s;
}

.btn:active {
  transform: translateY(0);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:disabled {
  background-color: rgba(149, 165, 166, 0.4);
  color: rgba(255, 255, 255, 0.6);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Specific Button Themes */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
  background: linear-gradient(135deg, var(--color-primary-hover), #1f618d);
}

.btn-success {
  background-color: rgba(46, 204, 113, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.2);
}

.btn-success:hover:not(:disabled) {
  background-color: rgba(46, 204, 113, 0.9);
  box-shadow: 0 6px 15px rgba(46, 204, 113, 0.4);
}

.btn-danger {
  background-color: rgba(231, 76, 60, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background-color: rgba(231, 76, 60, 0.9);
  box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4);
}

.btn-action {
  flex: 1;
  padding: 8px 16px;
  border-radius: 6px;
}

.dialog-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-family: sans-serif;
}

/* Glass Panel utility */
.glass-panel {
  background: rgba(44, 62, 80, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.help-section {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  font-family: sans-serif;
}

.help-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #60a5fa;
}

.help-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.help-list li {
  margin-bottom: 8px;
}

.help-list li:last-child {
  margin-bottom: 0;
}

.help-list strong {
  color: var(--color-text-light);
}

.emote-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emote-tag {
  background: rgba(52, 152, 219, 0.2);
  border: 1px solid rgba(52, 152, 219, 0.5);
  color: #93c5fd;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-family: monospace;
}

/* Glass Inputs */
.glass-input {
  padding: 10px;
  font-size: 14px;
  border-radius: 8px;
  border: var(--glass-border);
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-text-light);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  outline: none;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}

.glass-input:focus {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.glass-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: none;
}

#player-name-input {
  font-size: 16px;
  margin-bottom: 20px;
  width: 200px;
  text-align: center;
}

#help-button {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: 20px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background-color: #34495e;
  color: var(--color-text-light);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
}

#help-button:hover {
  background-color: #3498db;
  transform: scale(1.1);
}

/* Chat System */
#chat-container {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
  pointer-events: auto;
}

#chat-input {
  width: 100%;
  pointer-events: auto;
  flex-grow: 1;
  min-width: 0;
  background-color: rgba(255, 255, 255, 0.95);
  color: #000;
  text-shadow: none;
}

#chat-input::placeholder {
  color: #000000;
}

#top-center-ui {
  display: none;
  flex-direction: column;
  z-index: 1000;
  background-color: transparent;
  pointer-events: none;
  align-items: center;
  padding-top: env(safe-area-inset-top);
  justify-content: flex-start;
  padding-left: 30px;
  padding-right: 30px;
  box-sizing: border-box;
}

#top-center-ui-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  align-items: stretch;
  gap: 10px;
}

#top-center-ui-header {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  /* Align to the bottom so chat input matches avatar */
  justify-content: center;
  gap: 15px;
  pointer-events: none;
  width: 100%;
}

#avatars-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: auto;
  flex-shrink: 0;
  padding-top: 10px;
}

#avatars-container:empty {
  display: none;
}

#top-center-ui-header-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  /* Push content to bottom */
  flex-grow: 1;
  min-width: 0;
}

#map-name-display {
  font-family: 'Pricedown', sans-serif;
  font-size: 36px;
  color: var(--color-text-light);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 10px;
  margin-top: 5px;
  pointer-events: none;
  user-select: none;
}

#action-dialog {
  text-align: center;
  width: 100%;
  max-width: none;
  pointer-events: auto;
  box-sizing: border-box;
}

#action-dialog-text {
  font-size: 18px;
  margin-bottom: 20px;
}

.action-dialog-buttons {
  display: flex;
  justify-content: space-around;
  gap: 10px;
}

/* Admin Panel Components */
#admin-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 320px;
  background-color: var(--color-panel-dark);
  padding: 10px;
  border-radius: 8px;
  color: var(--color-text-light);
  z-index: 50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  font-family: sans-serif;
  font-size: 12px;
}

#admin-panel h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  text-align: center;
}

.admin-handle {
  background: rgba(0, 0, 0, 0.3);
  padding: 5px;
  cursor: move;
  text-align: center;
  border-radius: 8px 8px 0 0;
  margin: -10px -10px 10px -10px;
  font-weight: bold;
  font-size: 12px;
  user-select: none;
}

.admin-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.admin-control-row span {
  margin-right: 10px;
  font-size: 14px;
}

.admin-btn {
  background-color: #34495e;
  color: var(--color-text-light);
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  margin-left: 5px;
  font-weight: bold;
}

.admin-btn:hover {
  background-color: var(--color-primary);
}

.admin-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #7f8c8d;
  color: var(--color-text-light);
  border-radius: 4px;
}

.admin-textarea {
  width: 100%;
  height: 60px;
  box-sizing: border-box;
  padding: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #7f8c8d;
  color: var(--color-text-light);
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
}

.admin-select {
  width: 100%;
  padding: 4px;
  margin-bottom: 5px;
  border-radius: 4px;
  border: 1px solid #7f8c8d;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-light);
  font-size: 11px;
}

.admin-color-picker {
  background: transparent;
  border: none;
}

.admin-full-btn {
  width: 100%;
  padding: 4px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--color-text-light);
}

/* Virtual Joystick */
#joystick-move-container {
  position: absolute;
  bottom: 20px;
  width: 120px;
  height: 120px;
  background-color: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  /* Prevent scrolling when using joystick */
  user-select: none;
  left: 20px;
}



#joystick-move-knob {
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  pointer-events: none;
  /* Let container handle events */
  transform: translate(0px, 0px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}


/* Joystick is now visible on all screens per user request */