*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a1020;
  color: #f5e6c8;
  font-family: 'Fredoka', sans-serif;
}

.cww-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, #2a1838 0%, #120818 100%);
}

.cww-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255, 200, 80, 0.15);
  background: rgba(0, 0, 0, 0.45);
}

.cww-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cww-brand h1 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: #ffd866;
}

.cww-rec {
  font-size: 0.68rem;
  color: #ff5050;
  animation: cww-blink 1s step-end infinite;
}

@keyframes cww-blink { 50% { opacity: 0.25; } }

.cww-credit {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: rgba(245, 230, 200, 0.4);
}

.cww-exit {
  font-size: 0.75rem;
  color: rgba(245, 230, 200, 0.55);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(255, 200, 80, 0.2);
  border-radius: 6px;
}

.cww-exit:hover { color: #ffd866; }

.cww-stage {
  flex: 1;
  min-height: 0;
  padding: 10px;
}

.cww-office-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border: 3px solid #3a2848;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0610;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
}

#cww-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cww-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 200, 80, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  pointer-events: none;
}

.cww-time {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd866;
  min-width: 52px;
}

.cww-night { color: rgba(245, 230, 200, 0.65); }

.cww-power {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}

.cww-power-bar {
  width: 80px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.cww-power-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #44cc66, #ffd866);
  transition: width 0.3s linear, background 0.3s;
}

.cww-power-fill.low { background: #ff6644; }

.cww-door-ui {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}

.cww-door-ui--left { left: 10px; }
.cww-door-ui--right { right: 10px; }

.cww-door-btn,
.cww-light-btn {
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 2px solid rgba(255, 200, 80, 0.35);
  border-radius: 6px;
  background: rgba(20, 12, 28, 0.85);
  color: #f5e6c8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cww-door-btn:hover,
.cww-light-btn:hover {
  border-color: #ffd866;
}

.cww-door-btn.on {
  background: #cc3333;
  border-color: #ff5555;
  color: #fff;
}

.cww-light-btn.on {
  background: #886622;
  border-color: #ffd866;
  color: #ffd866;
}

.cww-cam-toggle {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 2px solid rgba(100, 180, 255, 0.4);
  border-radius: 8px;
  background: rgba(10, 20, 40, 0.9);
  color: #88ccff;
  cursor: pointer;
  z-index: 3;
}

.cww-cam-toggle.on {
  background: rgba(20, 50, 90, 0.95);
  border-color: #66aaff;
  box-shadow: 0 0 20px rgba(100, 180, 255, 0.3);
}

.cww-cam-panel {
  position: absolute;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: rgba(5, 10, 20, 0.92);
  border: 1px solid rgba(100, 180, 255, 0.35);
  border-radius: 8px;
  z-index: 3;
  text-align: center;
}

.cww-cam-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #88ccff;
}

.cww-cam-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.cww-cam-btn {
  width: 36px;
  height: 36px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid rgba(100, 180, 255, 0.3);
  border-radius: 6px;
  background: rgba(20, 30, 50, 0.8);
  color: #aaccee;
  cursor: pointer;
}

.cww-cam-btn.active,
.cww-cam-btn:hover {
  background: rgba(40, 80, 140, 0.9);
  border-color: #66aaff;
  color: #fff;
}

.cww-static {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
  mix-blend-mode: overlay;
  z-index: 2;
}

.cww-static.on {
  opacity: 0.35;
  animation: cww-static-flicker 0.08s step-end infinite;
}

@keyframes cww-static-flicker {
  50% { opacity: 0.15; }
}

/* Overlays */
.cww-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 4, 12, 0.94);
  padding: 20px;
}

.cww-screen[hidden] { display: none; }

.cww-title-box {
  max-width: 480px;
  text-align: center;
}

.cww-title-badge {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: rgba(255, 200, 80, 0.55);
  margin-bottom: 12px;
}

.cww-title-box h2 {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
  color: #ffd866;
  line-height: 1.15;
  margin: 0 0 16px;
  text-shadow: 0 0 30px rgba(255, 180, 50, 0.35);
}

.cww-title-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(245, 230, 200, 0.75);
  margin-bottom: 16px;
}

.cww-title-rules {
  text-align: left;
  margin: 0 0 24px;
  padding-left: 20px;
  font-size: 0.8rem;
  line-height: 1.75;
  color: rgba(245, 230, 200, 0.65);
}

.cww-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.cww-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #2a1020;
  background: linear-gradient(180deg, #ffd866 0%, #e8a830 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 0 #a87018;
  transition: transform 0.1s, box-shadow 0.1s;
}

.cww-btn--ghost {
  color: #f5e6c8;
  background: transparent;
  border: 2px solid rgba(255, 200, 80, 0.35);
  box-shadow: none;
}

.cww-btn--ghost:hover {
  border-color: #ffd866;
  transform: none;
  color: #ffd866;
}

.cww-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #a87018;
}

.cww-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a87018;
}

.cww-screen--end {
  flex-direction: column;
  text-align: center;
}

.cww-screen--end h2 {
  font-size: 2rem;
  color: #ffd866;
  margin-bottom: 12px;
}

.cww-screen--end p {
  max-width: 400px;
  line-height: 1.6;
  color: rgba(245, 230, 200, 0.75);
  margin-bottom: 24px;
}

.cww-screen--jumpscare {
  background: #000;
}

#cww-scare-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cww-screen--jumpscare h2,
.cww-screen--jumpscare p,
.cww-screen--jumpscare .cww-btn {
  position: relative;
  z-index: 2;
}

.cww-screen--jumpscare h2 {
  color: #ff4444;
  font-size: 2.4rem;
  margin-top: auto;
}

@media (max-width: 600px) {
  .cww-hud { gap: 10px; padding: 6px 12px; font-size: 0.72rem; }
  .cww-power-bar { width: 50px; }
  .cww-door-btn, .cww-light-btn { padding: 8px 10px; font-size: 0.65rem; }
}
