/* Forest Encyclopedia styles. Big friendly text for classroom screens. */

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

:root {
  --panel-bg: #fffdf5;
  --ink: #2f2a1e;
  --leaf: #3e7c3a;
  --warning: #b3452c;
  --warning-bg: #ffe9e2;
  --safe: #2c6e49;
  --safe-bg: #e2f3e6;
  --fun: #f5b700;
}

body {
  font-family: "Trebuchet MS", "Comic Sans MS", Verdana, sans-serif;
  background: #10241a;
  color: var(--ink);
  overflow: hidden;
  user-select: none;
}

.hidden { display: none !important; }

#game-container,
#game-container canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* HUD */

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  transition: transform 0.12s ease, border-color 0.12s ease;
  pointer-events: none;
}

#crosshair.hot {
  transform: scale(1.5);
  border-color: #ffe066;
  box-shadow: 0 0 10px rgba(255, 224, 102, 0.9);
}

#crosshair.danger { border-color: #ff8866; }

#interact-prompt {
  position: fixed;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  background: rgba(20, 32, 22, 0.85);
  color: #fff;
  font-size: 20px;
  padding: 12px 22px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

#discovery-counter {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(20, 32, 22, 0.8);
  color: #d7f2c9;
  font-size: 17px;
  padding: 10px 16px;
  border-radius: 12px;
  pointer-events: none;
}

/* Fact panel */

#fact-panel {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.panel-inner {
  position: relative;
  width: min(880px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel-bg);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
}

.panel-media {
  background: #dcead2;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px 0 0 22px;
  overflow: hidden;
}

.panel-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#fact-image-fallback {
  color: #4d6b44;
  font-size: 20px;
  padding: 20px;
  text-align: center;
}

.panel-text { padding: 30px 34px 24px 34px; }

#fact-safety {
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

#fact-safety.safe { background: var(--safe-bg); color: var(--safe); }
#fact-safety.dangerous {
  background: var(--warning-bg);
  color: var(--warning);
  border: 2px solid var(--warning);
}

#fact-name { font-size: 34px; line-height: 1.1; margin-bottom: 4px; }

#fact-category {
  color: #6d6a55;
  font-size: 19px;
  margin-bottom: 14px;
}

#fact-description { font-size: 19px; line-height: 1.45; margin-bottom: 16px; }

.panel-text h2 { font-size: 15px; text-transform: uppercase; color: #8a8567; margin: 14px 0 8px; }

#fact-list { padding-left: 22px; }
#fact-list li { font-size: 18px; line-height: 1.5; margin-bottom: 8px; }

.fun-fact {
  margin-top: 16px;
  background: #fff6d8;
  border-left: 5px solid var(--fun);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 17px;
  line-height: 1.45;
}

.close-hint { margin-top: 14px; font-size: 14px; color: #8a8567; }

#fact-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: var(--ink);
  color: #fff;
  border: none;
  font-size: 18px;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
}

#fact-close:hover { background: #4a4433; }

/* Danger banner inside panel */

.panel-inner.dangerous { border-top: 8px solid var(--warning); }

/* Start screen */

#start-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1c3a24 0%, #0e1f14 100%);
  color: #f4f1e0;
  text-align: center;
}

.start-inner h1 { font-size: 52px; margin-bottom: 8px; text-shadow: 0 3px 10px rgba(0,0,0,0.5); }
.start-inner .subtitle { font-size: 24px; color: #b9d8a8; margin-bottom: 22px; }
.start-inner .start-help { font-size: 18px; color: #d8d4bd; max-width: 460px; margin: 0 auto 30px; line-height: 1.5; }

#start-button {
  background: #f5b700;
  color: #2f2a1e;
  border: none;
  font-size: 26px;
  font-weight: bold;
  font-family: inherit;
  padding: 18px 46px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 #c19000;
}

#start-button:hover { transform: translateY(-2px); }
#start-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #c19000; }

/* Pointer lock help overlay when user exits lock mid game */

#resume-hint {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 18, 10, 0.6);
  color: #fff;
  font-size: 26px;
  text-align: center;
}

/* Touch controls (phones and tablets) */

#joystick {
  position: fixed;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: rgba(20, 32, 22, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 10;
}

#joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

body.touch-mode #interact-prompt { top: 30%; font-size: 18px; max-width: 80vw; text-align: center; }
body.touch-mode #discovery-counter { font-size: 15px; top: max(10px, env(safe-area-inset-top)); }

/* Small screens keep the panel readable */

@media (max-width: 760px) {
  .panel-inner { grid-template-columns: 1fr; max-height: 92vh; width: 94vw; }
  .panel-media { min-height: 180px; max-height: 240px; border-radius: 22px 22px 0 0; }
  #fact-name { font-size: 26px; }
  .panel-text { padding: 20px 20px 16px 20px; }
  #fact-description { font-size: 17px; }
  #fact-list li { font-size: 16px; }
  #fact-close { padding: 12px 22px; font-size: 16px; }
  .start-inner h1 { font-size: 34px; }
  .start-inner .subtitle { font-size: 18px; }
  .start-inner .start-help { font-size: 16px; padding: 0 16px; }
  #start-button { font-size: 22px; padding: 16px 38px; }
}
