html,
body {
  padding: 0;
  margin: 0;
  overflow: hidden;
  font-family: 'Times New Roman', serif;
  background: #0a0a0f;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

* {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

canvas {
  width: 100%;
  height: 100%;
}

#info {
  position: absolute;
  top: 0;
  width: 100%;
  color: white;
  font-family: monospace;
  text-align: center;
  padding: 5px 0;
}

a {
  color: #b8c5d6;
}

.label {
  background-color: transparent;
  font-family: "Roboto Slab", serif;
  color: white;
  text-shadow: 2px 0 #333333, -2px 0 #333333, 0 2px #333333,
    0 -2px #333333, 1px 1px #333333, -1px -1px #333333, 1px -1px #333333,
    -1px 1px #333333;
}

.interface {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 15px 25px;
  background: linear-gradient(180deg, rgba(30, 20, 15, 0.9) 0%, rgba(20, 15, 10, 0.95) 100%);
  border: 2px solid #4a3a30;
  border-top: 1px solid #5a4a40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.interface button {
  background: linear-gradient(180deg, #251a10 0%, #1a0f05 100%);
  border: 1px solid #4a3a30;
  border-bottom: 2px solid #3a2a20;
  color: #e8d5c6;
  padding: 12px 30px;
  cursor: pointer;
  font-size: 13px;
  font-weight: normal;
  font-family: 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.15s ease;
  position: relative;
}

.interface button:hover {
  background: linear-gradient(180deg, #352a20 0%, #251a10 100%);
  border-color: #5a4a40;
  color: #f8e5d6;
  text-shadow: 0 0 8px rgba(200, 150, 100, 0.5);
}

.interface button:active {
  background: linear-gradient(180deg, #1a0f05 0%, #100500 100%);
  border-bottom: 1px solid #3a2a20;
  transform: translateY(1px);
}

.interface button.active {
  background: linear-gradient(180deg, #3a2a20 0%, #2a1a10 100%);
  border-color: #6a5a50;
  color: #f8e5d6;
  text-shadow: 0 0 10px rgba(200, 150, 100, 0.6);
  box-shadow: 0 0 15px rgba(200, 150, 100, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#help-button {
  min-width: 40px;
  padding: 12px 15px;
  font-size: 16px;
  font-weight: bold;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.modal-content {
  background: linear-gradient(180deg, rgba(20, 15, 10, 0.98) 0%, rgba(15, 10, 5, 0.99) 100%);
  border: 2px solid #4a3a30;
  border-top: 1px solid #5a4a40;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  padding: 30px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  color: #e8d5c6;
  font-family: 'Times New Roman', serif;
  position: relative;
}

.close-button {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #e8d5c6;
  transition: color 0.2s ease;
}

.close-button:hover {
  color: #f8e5d6;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 24px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid #4a3a30;
  padding-bottom: 10px;
}

.help-section {
  margin-bottom: 20px;
}

.help-section h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #c8d5e6;
  letter-spacing: 1px;
}

.help-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-section li {
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}

.help-section li::before {
  content: "◆";
  position: absolute;
  left: 0;
  color: #5a4a40;
}

.help-section strong {
  color: #d8e5d6;
}

:root {
  --loading-screen-fade-duration: 3s;
  --loading-content-fade-duration: 1s;
  --ui-fade-duration: 2s;
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #0a0505 0%, #150f10 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: opacity var(--loading-screen-fade-duration) ease-in-out;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  opacity: 0;
  animation: fadeInLoading 0.5s ease-in-out forwards;
}

@keyframes fadeInLoading {
  from { opacity: 0; }
  to { opacity: 1; }
}

#loading-screen.hidden .loading-content {
  opacity: 0;
  animation: none;
}

.hidden-on-load {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ui-fade-duration) ease-in-out;
}

.hidden-on-load.visible {
  opacity: 1;
  pointer-events: auto;
}

#location.hidden-on-load {
  opacity: 0;
  pointer-events: none;
}

#location.visible {
  opacity: 1;
  pointer-events: auto;
}

.door-loading-label {
  pointer-events: none;
  background: rgba(20, 15, 10, 0.9);
  border: 1px solid #4a3a30;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Times New Roman', serif;
  z-index: 50;
  transition: transform 0.1s ease-out;
}

.door-loading-bar-container {
  width: 100px;
  height: 4px;
  background: rgba(30, 20, 15, 0.8);
  border: 1px solid #4a3a30;
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.door-loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3a2a20, #5a4a40);
}

.door-loading-text {
  font-size: 11px;
  color: #e8d5c6;
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.loading-content {
  text-align: center;
  color: #e8d5c6;
  font-family: 'Times New Roman', serif;
}

.loading-content h1 {
  font-size: 36px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 30px;
  text-shadow: 0 0 20px rgba(200, 150, 100, 0.3);
}

.loading-bar-container {
  width: 300px;
  height: 8px;
  background: rgba(30, 20, 15, 0.5);
  border: 1px solid #4a3a30;
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto 15px;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3a2a20, #5a4a40);
  transition: width 0.3s ease;
}

.loading-text {
  font-size: 14px;
  letter-spacing: 1px;
  color: #c8d5e6;
}

.modal-buttons {
  margin-top: 20px;
  text-align: center;
}

.confirm-button {
  background: linear-gradient(180deg, #3a2a20 0%, #2a1a10 100%);
  border: 1px solid #4a3a30;
  border-bottom: 2px solid #3a2a20;
  color: #e8d5c6;
  padding: 12px 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
  font-family: 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.15s ease;
}

.confirm-button:hover {
  background: linear-gradient(180deg, #4a3a30 0%, #3a2a20 100%);
  border-color: #5a4a40;
  color: #f8e5d6;
  text-shadow: 0 0 8px rgba(200, 150, 100, 0.5);
}

.confirm-button:active {
  background: linear-gradient(180deg, #2a1a10 0%, #1a0f05 100%);
  border-bottom: 1px solid #3a2a20;
  transform: translateY(1px);
}

#location {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 40px;
  background: linear-gradient(180deg, rgba(20, 15, 10, 0.95) 0%, rgba(15, 10, 5, 0.98) 100%);
  border: 2px solid #3a2a25;
  border-bottom: 1px solid #2a1a15;
  color: #e8d5c6;
  font-size: 20px;
  font-weight: bold;
  font-family: 'Times New Roman', serif;
  letter-spacing: 3px;
  cursor: pointer;
  transition: opacity var(--ui-fade-duration) ease-in-out, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, text-shadow 0.2s ease;
  text-shadow: 0 0 20px rgba(200, 150, 100, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-transform: uppercase;
}

#location:hover {
  background: linear-gradient(180deg, rgba(30, 25, 20, 0.95) 0%, rgba(25, 20, 15, 0.98) 100%);
  border-color: #4a3a35;
  color: #f8e5d6;
  text-shadow: 0 0 25px rgba(200, 150, 100, 0.5);
}

#location:empty {
  opacity: 0;
  pointer-events: none;
}

#joystick-container {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#joystick-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(30, 20, 15, 0.8);
  border: 2px solid #4a3a30;
  border-top: 1px solid #5a4a40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#joystick-knob {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(180deg, #352a20 0%, #251a10 100%);
  border: 1px solid #5a4a40;
  border-bottom: 2px solid #3a2a20;
  top: calc(50% - 25px);
  left: calc(50% - 25px);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

#joystick-knob:active {
  background: linear-gradient(180deg, #453a30 0%, #352a20 100%);
  border-color: #6a5a50;
}

#location::before,
#location::after {
  content: '◆';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #5a6575;
  font-size: 12px;
  opacity: 0.7;
}

#location::before {
  left: 15px;
}

#location::after {
  right: 15px;
}

#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

#ui-container > * {
  pointer-events: auto;
}

#debug-controls {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  color: #00ff00;
  font-family: monospace;
  font-size: 12px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border-radius: 5px;
  pointer-events: auto;
  z-index: 1000;
}

#debug-controls div {
  margin-bottom: 10px;
}

#debug-controls label {
  display: block;
  margin-bottom: 5px;
}

#debug-controls input[type="range"] {
  width: 200px;
}

#debug-controls span {
  display: inline-block;
  margin-left: 10px;
  width: 80px;
}
