/* === PERPETUITY & PROCESS — Standard Issue Stylesheet === */
/* Ref: Visual Identity Guidelines, Section 3-A */

:root {
  --office-beige: #F0EAD6;
  --office-cream: #F5F0E0;
  --wall-green: #8FA88F;
  --sign-green: #2D6A4F;
  --sign-red: #C1292E;
  --sign-border: #555;
  --floor-light: #C9BD9F;
  --floor-dark: #B8AC8E;
  --metal-gray: #7A7A7A;
  --metal-light: #A0A0A0;
  --laminate-bg: #FEFEFA;
  --laminate-shadow: rgba(0,0,0,0.15);
  --text-dark: #1A1A1A;
  --text-muted: #555;
  --fluorescent: #FFFFF0;
  --accent-warm: #D4A853;
  --blood: #6B1C1C;
  --sunlight: #FFE4A0;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Space Mono', 'Courier New', monospace;
  color: var(--text-dark);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

.hidden { display: none !important; }

/* === LAMINATED SIGN EFFECT === */
.laminated-main {
  background: var(--laminate-bg);
  border: 2px solid #999;
  border-radius: 4px;
  padding: 28px 36px;
  position: relative;
  box-shadow:
    0 2px 8px var(--laminate-shadow),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 0 rgba(0,0,0,0.05);
}

/* Glossy laminate highlight */
.laminated-main::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
  border-radius: 3px 3px 0 0;
  pointer-events: none;
}

/* Pushpin effect */
.laminated-main::after {
  content: '';
  position: absolute;
  top: -4px; left: 50%;
  width: 8px; height: 8px;
  background: radial-gradient(circle, #cc3333 40%, #881111 100%);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transform: translateX(-50%);
}

.sign-ref {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-align: center;
}

.sign-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  letter-spacing: 1px;
}

.sign-motto {
  font-size: 10px;
  color: var(--sign-green);
  margin-top: 6px;
  text-align: center;
  font-style: italic;
  letter-spacing: 0.5px;
}

/* === TITLE SCREEN === */
#menuOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(30, 28, 24, 0.92);
  backdrop-filter: blur(2px);
}

#menuContent {
  text-align: center;
  max-width: 520px;
  width: 90%;
}

#titleSign {
  margin-bottom: 28px;
}

#titleSign h1 {
  font-family: 'Space Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 4px;
  line-height: 1.3;
  text-transform: uppercase;
}

#menuItems {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.menu-btn {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  padding: 10px 24px;
  background: var(--laminate-bg);
  border: 2px solid #999;
  border-radius: 3px;
  color: var(--text-dark);
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.15s;
  box-shadow: 0 1px 4px var(--laminate-shadow);
}

.menu-btn:hover, .menu-btn:focus {
  background: var(--accent-warm);
  color: #fff;
  border-color: var(--accent-warm);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px var(--laminate-shadow);
}

.menu-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px var(--laminate-shadow);
}

#menuFooter {
  font-size: 11px;
  color: #777;
  letter-spacing: 1px;
}

/* === LAMINATED POPUP (used for settings, stats, etc.) === */
.laminated-popup {
  background: var(--laminate-bg);
  border: 2px solid #999;
  border-radius: 4px;
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  position: relative;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.8);
}

.laminated-popup::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  border-radius: 3px 3px 0 0;
  pointer-events: none;
}

.laminated-popup h2 {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 20px;
  color: var(--text-dark);
  text-align: center;
}

.laminated-popup p, .laminated-popup li {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 6px 0;
  border-bottom: 1px solid #e0ddd0;
}

.setting-row label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.setting-row input[type="range"] {
  width: 140px;
  accent-color: var(--sign-green);
}

.close-btn {
  margin-top: 18px;
  width: 100%;
}

.pause-sub {
  text-align: center;
  margin-bottom: 16px;
  font-style: italic;
}

/* === OVERLAYS === */
#settingsOverlay, #statsOverlay, #tutorialOverlay,
#pauseOverlay, #gameOverOverlay, #docOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  background: rgba(30, 28, 24, 0.85);
  backdrop-filter: blur(2px);
}

/* === DOCUMENT VIEWER === */
#docFrame {
  background: var(--laminate-bg);
  border: 2px solid #999;
  border-radius: 4px;
  padding: 28px 32px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.8);
}

#docFrame::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  border-radius: 3px 3px 0 0;
  pointer-events: none;
}

#docContent {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-dark);
}

#docContent h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #ccc;
}

#docContent .doc-ref {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

#docContent .doc-body {
  margin-top: 8px;
}

#docContent .doc-body p {
  margin-bottom: 8px;
}

#docContent .handwritten {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: #333;
  transform: rotate(-1deg);
  display: block;
  margin: 12px 0;
}

#docContent .redacted {
  background: #333;
  color: #333;
  padding: 0 4px;
  display: inline;
}

#docContent .sign-line {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #ccc;
  font-size: 10px;
  color: var(--text-muted);
}

#docClose {
  text-align: center;
  margin-top: 18px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 2px;
  transition: all 0.15s;
}

#docClose:hover {
  background: var(--accent-warm);
  color: #fff;
  border-color: var(--accent-warm);
}

/* === INTERACTION PROMPT === */
#interactPrompt {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--laminate-bg);
  border: 2px solid #999;
  border-radius: 3px;
  padding: 8px 20px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 50;
  box-shadow: 0 2px 8px var(--laminate-shadow);
  animation: promptPulse 2s ease-in-out infinite;
}

@keyframes promptPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; box-shadow: 0 2px 12px rgba(212, 168, 83, 0.3); }
}

/* === TUTORIAL === */
.tutorial-popup {
  max-width: 520px;
}

.tutorial-popup .tut-step {
  margin-bottom: 16px;
}

.tutorial-popup .tut-key {
  display: inline-block;
  background: #e8e4d8;
  border: 1px solid #aaa;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin: 0 2px;
}

.tutorial-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.tutorial-nav .menu-btn {
  flex: 1;
}

/* === GAME OVER === */
.gameover-popup {
  max-width: 520px;
  text-align: center;
}

.gameover-popup .go-status {
  font-size: 11px;
  color: var(--sign-red);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

.gameover-popup .go-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 2;
}

/* === STAT DISPLAY === */
.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e0ddd0;
  font-size: 12px;
}

.stat-item .stat-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.stat-item .stat-value {
  font-weight: 700;
  color: var(--text-dark);
}

/* === MOBILE CONTROLS === */
#mobileControls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 180px;
  z-index: 80;
  pointer-events: none;
}

#joystickZone {
  position: absolute;
  bottom: 30px;
  left: 30px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
}

#joystickBase {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(240, 234, 214, 0.25);
  border: 2px solid rgba(240, 234, 214, 0.4);
  position: relative;
}

#joystickStick {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(240, 234, 214, 0.5);
  border: 2px solid rgba(240, 234, 214, 0.6);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
}

#mobileInteract {
  position: absolute;
  bottom: 60px;
  right: 30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.4);
  border: 2px solid rgba(212, 168, 83, 0.6);
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: auto;
  cursor: pointer;
}

/* === FULLSCREEN & MUTE BUTTONS === */
#fullscreenBtn, #muteBtn {
  position: fixed;
  z-index: 90;
  background: rgba(240, 234, 214, 0.15);
  border: 1px solid rgba(240, 234, 214, 0.3);
  color: rgba(240, 234, 214, 0.6);
  width: 36px;
  height: 36px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#fullscreenBtn {
  top: 12px;
  right: 12px;
}

#muteBtn {
  top: 12px;
  right: 54px;
}

#fullscreenBtn:hover, #muteBtn:hover {
  background: rgba(240, 234, 214, 0.3);
  color: rgba(240, 234, 214, 0.9);
}

/* === SCROLLBAR === */
#docFrame::-webkit-scrollbar { width: 6px; }
#docFrame::-webkit-scrollbar-track { background: #e8e4d8; }
#docFrame::-webkit-scrollbar-thumb { background: #aaa; border-radius: 3px; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  #titleSign h1 { font-size: 20px; letter-spacing: 2px; }
  .laminated-main { padding: 20px 24px; }
  .menu-btn { font-size: 12px; padding: 8px 16px; }
  .laminated-popup { padding: 20px 18px; }
  #docFrame { padding: 20px 18px; }
  #interactPrompt { font-size: 10px; bottom: 200px; }
}

/* Animations for sign appearance */
@keyframes signFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.doc-appear {
  animation: signFadeIn 0.4s ease-out;
}

/* Flicker effect for in-game fluorescence */
@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.7; }
  97% { opacity: 1; }
  98% { opacity: 0.8; }
}
