/* ═══════════════════════════════════════════════════════════════
   OH NO PASTOR — Styles  |  happystoner5420 Games
   AAA Photo-Real UI — Dark Gothic Church Aesthetic
═══════════════════════════════════════════════════════════════ */

/* Fonts — system fallbacks for 100% offline operation.
   If Cinzel/Lora/Oswald happen to be installed locally they will be used;
   otherwise the fallbacks keep the design intact. */

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

:root {
  --bg-dark:       #0a0704;
  --bg-mid:        #130f0a;
  --bg-panel:      #1a1309;
  --bg-panel2:     #221a0e;
  --gold:          #c9943a;
  --gold-bright:   #f0c060;
  --gold-dim:      #7a5820;
  --red-chaos:     #c0392b;
  --red-bright:    #e74c3c;
  --cream:         #f5ead8;
  --cream-dim:     #b8a888;
  --white:         #ffffff;
  --border:        #3a2a10;
  --border-gold:   #6a4818;
  --shadow-deep:   0 8px 40px rgba(0,0,0,0.9);
  --glow-gold:     0 0 20px rgba(201,148,58,0.4);
  --glow-red:      0 0 20px rgba(192,57,43,0.5);
  --font-title:    'Cinzel', 'Trajan Pro', 'Book Antiqua', 'Palatino Linotype', 'Palatino', Georgia, serif;
  --font-body:     'Lora', 'Garamond', 'Georgia', 'Times New Roman', serif;
  --font-hud:      'Oswald', 'Impact', 'Arial Narrow', 'Franklin Gothic Medium', Arial, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
}

/* ── SCREENS ── */
.screen {
  position: fixed; inset: 0;
  display: none;
  z-index: 10;
}
.screen.active { display: flex; }

/* ════════════════════════════
   MAIN MENU
════════════════════════════ */
#main-menu {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, #2a1a08 0%, #0a0704 70%),
    repeating-linear-gradient(
      0deg, transparent, transparent 60px,
      rgba(201,148,58,0.03) 60px, rgba(201,148,58,0.03) 61px
    ),
    repeating-linear-gradient(
      90deg, transparent, transparent 60px,
      rgba(201,148,58,0.03) 60px, rgba(201,148,58,0.03) 61px
    );
}

.menu-bg-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(139,69,19,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(101,67,33,0.12) 0%, transparent 50%);
  pointer-events: none;
}

.menu-content {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; gap: 32px;
  z-index: 2;
}

.title-block {
  text-align: center;
}

.title-cross {
  font-size: 64px;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(201,148,58,0.8), 0 0 80px rgba(201,148,58,0.3);
  line-height: 1;
  margin-bottom: 8px;
  animation: crossGlow 3s ease-in-out infinite alternate;
}

@keyframes crossGlow {
  from { text-shadow: 0 0 30px rgba(201,148,58,0.6), 0 0 60px rgba(201,148,58,0.2); }
  to   { text-shadow: 0 0 60px rgba(201,148,58,1.0), 0 0 120px rgba(201,148,58,0.4); }
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(52px, 8vw, 100px);
  font-weight: 900;
  line-height: 0.95;
  color: var(--cream);
  text-shadow: 0 4px 20px rgba(0,0,0,0.8);
  letter-spacing: 4px;
}

.game-title span {
  color: var(--gold);
  text-shadow: var(--glow-gold), 0 4px 20px rgba(0,0,0,0.8);
  display: block;
}

.title-sub {
  font-family: var(--font-hud);
  font-size: 16px;
  letter-spacing: 6px;
  color: var(--cream-dim);
  text-transform: uppercase;
  margin-top: 12px;
}

.title-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: var(--gold-dim);
  margin-top: 6px;
}

.main-nav {
  display: flex; flex-direction: column; gap: 12px;
  width: 320px;
}

/* ── BUTTONS ── */
.menu-btn {
  width: 100%;
  padding: 14px 28px;
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 2px solid var(--border-gold);
  background: linear-gradient(180deg, #2a1f0e 0%, #1a1309 100%);
  color: var(--cream);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.menu-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(201,148,58,0.08), transparent);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.menu-btn:hover::before { transform: translateX(100%); }

.menu-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: linear-gradient(180deg, #3a2a14 0%, #251c0d 100%);
  box-shadow: var(--glow-gold), inset 0 0 20px rgba(201,148,58,0.08);
  transform: translateX(4px);
}

.menu-btn.primary {
  background: linear-gradient(180deg, #6a4818 0%, #3a2808 100%);
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: var(--glow-gold);
}

.menu-btn.primary:hover {
  background: linear-gradient(180deg, #8a5c1e 0%, #4a320a 100%);
  box-shadow: 0 0 40px rgba(201,148,58,0.6);
}

.menu-btn.danger {
  border-color: #6a2018;
  color: #e09080;
}

.menu-btn.danger:hover {
  border-color: var(--red-bright);
  color: var(--red-bright);
  box-shadow: var(--glow-red);
  background: linear-gradient(180deg, #3a1208 0%, #1a0a04 100%);
}

.menu-btn.large { font-size: 18px; padding: 16px 32px; }

.menu-footer {
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold-dim);
  text-transform: uppercase;
  text-align: center;
}

/* ════════════════════════════
   MODAL SCREENS
════════════════════════════ */
.modal-screen {
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: linear-gradient(180deg, #1e1508 0%, #130f06 100%);
  border: 2px solid var(--border-gold);
  box-shadow: var(--shadow-deep), var(--glow-gold), inset 0 1px 0 rgba(201,148,58,0.2);
  padding: 40px 48px;
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
  display: flex; flex-direction: column; gap: 24px;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--gold);
  text-align: center;
  text-shadow: var(--glow-gold);
  letter-spacing: 4px;
  border-bottom: 1px solid var(--border-gold);
  padding-bottom: 16px;
}

/* HOW TO PLAY */
.htp-content { display: flex; flex-direction: column; gap: 16px; }

.htp-step {
  display: flex; align-items: flex-start; gap: 14px;
  color: var(--cream);
  font-size: 14px;
  line-height: 1.6;
}

.htp-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--gold);
  color: var(--bg-dark);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

.htp-warning {
  background: rgba(192,57,43,0.15);
  border: 1px solid rgba(192,57,43,0.4);
  color: #e09080;
  font-size: 12px;
  padding: 12px 16px;
  font-style: italic;
  text-align: center;
}

/* CREDITS */
.credits-box { text-align: center; }
.credits-studio {
  font-family: var(--font-title);
  font-size: 26px;
  color: var(--gold);
  text-shadow: var(--glow-gold);
}
.credits-role {
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--cream-dim);
  text-transform: uppercase;
  font-family: var(--font-hud);
}
.credits-divider {
  height: 1px;
  background: var(--border-gold);
  margin: 8px 0;
}
.credits-content { display: flex; flex-direction: column; gap: 8px; }
.credits-entry {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; padding: 4px 0;
  border-bottom: 1px solid rgba(58,42,16,0.5);
}
.credits-label { color: var(--cream-dim); font-style: italic; }
.credits-name { color: var(--gold-bright); font-weight: 600; }
.credits-dedication {
  font-style: italic;
  color: var(--cream-dim);
  font-size: 13px;
  line-height: 1.8;
  margin-top: 8px;
}

/* ════════════════════════════
   GAME SCREEN — original layout
   HUD → Canvas → Ticker strip → Sermon panel
   Reaction log = fixed right panel, always visible
════════════════════════════ */
#game-screen {
  display: none;
  flex-direction: column;
  background: #0a0704;
  overflow: hidden;
}

#game-screen.active { display: flex; }

/* ── HUD TOP BAR ── */
#hud-top {
  height: 48px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1e1508 0%, #130f06 100%);
  border-bottom: 2px solid var(--border-gold);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  z-index: 100;
}

#hud-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
}

#hud-center {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
}

#hud-title {
  font-family: var(--font-title);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: var(--glow-gold);
  white-space: nowrap;
}

#hud-right {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  justify-content: flex-end;
}

.hud-label {
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--cream-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.chaos-bar-wrap {
  width: 130px; height: 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-gold);
  position: relative;
  overflow: hidden;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

#chaos-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7a3a10, #c0392b, #e74c3c, #ff6b35);
  transition: width 0.5s ease, background 0.5s ease;
  position: relative;
}

#chaos-bar::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
}

#chaos-val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-hud);
  font-size: 10px;
  font-weight: 600;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}

#sermon-count-label {
  font-family: var(--font-hud);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
}

#sermon-count-label b { color: var(--gold-bright); }

.hud-btn {
  padding: 5px 10px;
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid var(--border-gold);
  background: transparent;
  color: var(--cream-dim);
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
  white-space: nowrap;
  clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
}

.hud-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201,148,58,0.12);
}

/* ── CHURCH CANVAS — takes all remaining height, offset for reaction log ── */
#church-canvas {
  flex: 1;
  min-height: 0;
  width: calc(100% - 300px);
  display: block;
}

/* ── REACTION TICKER — slim strip below canvas ── */
#reaction-ticker {
  height: 32px;
  flex-shrink: 0;
  width: calc(100% - 300px);
  background: linear-gradient(90deg, #0e0a04, #1a1208, #0e0a04);
  border-top: 1px solid var(--border-gold);
  border-bottom: 1px solid var(--border-gold);
  overflow: hidden;
  display: flex; align-items: center;
}

#ticker-text {
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--gold);
  white-space: nowrap;
  display: inline-block;
  padding-left: 100%;
  animation: tickerScroll 28s linear infinite;
}

@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-200%); }
}

/* ── PASTOR SPEECH BUBBLE ── */
#pastor-bubble {
  position: absolute;
  left: calc(50% - 150px);
  transform: translateX(-50%);
  top: 60px;
  max-width: 460px;
  min-width: 220px;
  background: linear-gradient(180deg, #fdf8ee 0%, #f0e6c8 100%);
  border: 3px solid var(--gold);
  border-radius: 12px 12px 12px 0;
  padding: 14px 20px;
  box-shadow: var(--shadow-deep), 0 0 30px rgba(201,148,58,0.3);
  z-index: 50;
  pointer-events: none;
}

#pastor-bubble::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 20px;
  border: 10px solid transparent;
  border-top-color: var(--gold);
}

#pastor-bubble-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: #2a1a08;
  line-height: 1.6;
  text-align: center;
}

#pastor-bubble.hidden { display: none; }

/* ── SERMON PANEL — single compact row at bottom ── */
#sermon-panel {
  width: calc(100% - 300px);
  background: linear-gradient(180deg, #1a1309 0%, #100c06 100%);
  border-top: 2px solid var(--border-gold);
  flex-shrink: 0;
  z-index: 40;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.7);
  padding: 7px 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
}

/* Header label inline — no separate row */
.sermon-panel-header { display: none; }
.sermon-icon         { display: none; }
.sermon-label        { display: none; }
.sermon-hint         { display: none; }

#sermon-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border-gold);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  padding: 5px 10px;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
  box-sizing: border-box;
}

#sermon-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201,148,58,0.2);
}

#sermon-input::placeholder { color: var(--gold-dim); font-style: italic; }

/* Controls sit inline beside the textarea */
.sermon-controls {
  display: contents;
}

.sermon-controls .menu-btn {
  width: auto;
  padding: 5px 14px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

#char-count {
  font-family: var(--font-hud);
  font-size: 10px;
  color: var(--cream-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── REACTION LOG — always-visible fixed right panel ── */
#reaction-log {
  position: fixed;
  right: 0;
  top: 48px;
  bottom: 0;
  width: 300px;
  background: linear-gradient(180deg, rgba(8,5,2,0.97) 0%, rgba(16,11,5,0.97) 100%);
  border-left: 2px solid var(--border-gold);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 90;
}

.log-header {
  font-family: var(--font-hud);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-gold);
  background: rgba(201,148,58,0.08);
  flex-shrink: 0;
}

#log-entries {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

.log-entry {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-dim);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--cream-dim);
  line-height: 1.5;
  animation: logFadeIn 0.3s ease;
}

.log-entry.shock    { border-left-color: #e74c3c; }
.log-entry.rage     { border-left-color: #c0392b; }
.log-entry.amused   { border-left-color: #f39c12; }
.log-entry.faint    { border-left-color: #9b59b6; }
.log-entry.gossip   { border-left-color: #1abc9c; }
.log-entry.leave    { border-left-color: #7f8c8d; }
.log-entry.praise   { border-left-color: #27ae60; }
.log-entry.chaos    { border-left-color: #e74c3c; background: rgba(192,57,43,0.1); }

.log-npc-name {
  color: var(--gold-bright);
  font-weight: 600;
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 2px;
}

@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── FLOATING REACTION POPUPS ── */
.reaction-popup {
  position: absolute;
  font-size: 22px;
  z-index: 60;
  pointer-events: none;
  animation: popupFloat 2.5s ease-out forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

@keyframes popupFloat {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  15%  { opacity: 1; transform: translateY(-10px) scale(1.2); }
  50%  { opacity: 1; transform: translateY(-40px) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* ── CHAOS EVENT OVERLAY ── */
#chaos-overlay {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: transparent;
}

.chaos-flash {
  animation: chaosFlash 0.6s ease forwards;
}

@keyframes chaosFlash {
  0%   { background: transparent; }
  20%  { background: rgba(192,57,43,0.4); }
  50%  { background: rgba(192,57,43,0.2); }
  100% { background: transparent; }
}

#chaos-event-banner {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(180deg, #6a0808, #2a0404);
  border: 3px solid var(--red-bright);
  box-shadow: var(--glow-red), var(--shadow-deep);
  color: var(--white);
  font-family: var(--font-title);
  font-size: 32px;
  letter-spacing: 4px;
  text-align: center;
  padding: 24px 48px;
  z-index: 300;
  clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
  pointer-events: none;
}

#chaos-event-banner.show {
  animation: bannerBoom 3s ease forwards;
}

@keyframes bannerBoom {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  10%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  15%  { transform: translate(-50%, -50%) scale(0.95); }
  20%  { transform: translate(-50%, -50%) scale(1.0); }
  70%  { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.0); opacity: 0; }
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

/* ── NPC SPEECH BUBBLES (canvas overlay) ── */
.npc-bubble {
  position: absolute;
  background: linear-gradient(180deg, #1a1309 0%, #100c06 100%);
  border: 1px solid var(--border-gold);
  color: var(--cream);
  font-size: 11px;
  font-family: var(--font-body);
  font-style: italic;
  padding: 6px 10px;
  border-radius: 8px 8px 8px 0;
  max-width: 180px;
  pointer-events: none;
  z-index: 40;
  animation: bubblePop 4s ease forwards;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

@keyframes bubblePop {
  0%   { opacity: 0; transform: scale(0.8) translateY(4px); }
  10%  { opacity: 1; transform: scale(1) translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* ── PASTOR ANIMATION STATES ── */
.pastor-preaching { animation: pastorShake 0.3s infinite alternate; }

@keyframes pastorShake {
  from { transform: rotate(-1deg); }
  to   { transform: rotate(1deg); }
}
