* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #1a120b;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  color: #e8d5b7;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #1a120b;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #2a2118;
}

/* ===== UI ===== */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 20;
}

#ink-meter {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 150px;
  height: 11px;
  background: rgba(40, 30, 20, 0.85);
  border: 1.5px solid #6b5344;
  border-radius: 6px;
  overflow: hidden;
}

#ink-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #1a1a1a, #444);
  transition: width 0.15s ease;
  border-radius: 4px;
}

#depth-info {
  position: absolute;
  top: 14px;
  right: 16px;
  text-align: right;
  line-height: 1.35;
}

#depth {
  font-size: 15px;
  letter-spacing: 1.2px;
}

#chapter {
  font-size: 12px;
  opacity: 0.75;
  letter-spacing: 0.8px;
  margin-top: 1px;
}

#best-depth {
  font-size: 12px;
  opacity: 0.65;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Tutorial */
#tutorial {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 8, 0.82);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
  z-index: 25;
  pointer-events: none;
  border: 1px solid rgba(107, 83, 68, 0.4);
  max-width: 90vw;
}

#tutorial.hidden {
  display: none;
}

/* ===== Screens ===== */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(16, 11, 7, 0.95);
  z-index: 50;
}

.screen.hidden {
  display: none;
}

#logo {
  width: min(300px, 75vw);
  max-width: 340px;
  margin-bottom: 28px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5));
  border-radius: 4px;
}

.menu-hint {
  margin-top: 18px;
  font-size: 0.95rem;
  opacity: 0.7;
  letter-spacing: 1px;
}

#x-link {
  margin-top: 22px;
  color: #c4a882;
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 1px;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
  pointer-events: auto;
}

#x-link:hover {
  opacity: 1;
  color: #e8d5b7;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  letter-spacing: 3px;
}

#final-depth {
  margin-bottom: 8px;
  opacity: 0.85;
}

#new-best {
  color: #d4b896;
  margin-bottom: 20px;
  font-size: 1rem;
}

#new-best.hidden {
  display: none;
}

button {
  padding: 13px 40px;
  font-size: 1.05rem;
  background: #2a2118;
  color: #e8d5b7;
  border: 1.5px solid #6b5344;
  cursor: pointer;
  letter-spacing: 2px;
  font-family: Georgia, serif;
  border-radius: 4px;
  transition: all 0.15s ease;
}

button:active {
  background: #3a2f24;
  transform: scale(0.97);
}

/* ===== Mobile Controls ===== */
#mobile-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 170px;
  pointer-events: none;
  z-index: 30;
  display: none;
}

#joystick-zone {
  position: absolute;
  left: 18px;
  bottom: 28px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
}

#joystick-base {
  width: 108px;
  height: 108px;
  background: rgba(40, 30, 20, 0.55);
  border: 2px solid rgba(107, 83, 68, 0.7);
  border-radius: 50%;
  position: relative;
}

#joystick-knob {
  width: 46px;
  height: 46px;
  background: rgba(30, 25, 18, 0.9);
  border: 2px solid #8a6d55;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#right-buttons {
  position: absolute;
  right: 16px;
  bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

#jump-btn, #absorb-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 0;
  font-size: 0.78rem;
  letter-spacing: 1px;
  background: rgba(42, 33, 24, 0.88);
  border: 2px solid #6b5344;
  display: flex;
  align-items: center;
  justify-content: center;
}

#absorb-btn {
  background: rgba(50, 35, 25, 0.9);
  border-color: #8a6d55;
}

@media (max-width: 900px) {
  #mobile-controls {
    display: block;
  }
}
