/* ============================================================
   Jehovas Vidner-spillet - stilark
   ============================================================ */

:root {
  --dark: #0e0e13;
  --dark2: #171720;
  --light: #f4eeda;
  --gold: #c9a44c;
  --gold-dim: #8b7333;
  --blue: #4a6fa5;
  --red: #a8433b;
  --green: #5d8a58;
  --paper: #efe7d2;
  --ink: #22222a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #07070a;
  color: var(--light);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; overflow: hidden; }

canvas#c { position: absolute; inset: 0; display: block; image-rendering: auto; }

/* ---------------- HUD ---------------- */
#hud {
  position: absolute; inset: 0; pointer-events: none;
  font-size: 13px; letter-spacing: .02em;
}
.hud-box {
  position: absolute; background: rgba(10,10,15,.72);
  border: 1px solid rgba(201,164,76,.35);
  border-radius: 4px; padding: 7px 11px;
  backdrop-filter: blur(3px);
}
#hud-left { top: 12px; left: 12px; max-width: 260px; }
#hud-left .name { font-family: Georgia, serif; font-size: 15px; color: var(--gold); }
#hud-left .role { opacity: .75; font-size: 12px; margin-top: 2px; }
#hud-right { top: 12px; right: 12px; text-align: right; }
#hud-right .place { font-family: Georgia, serif; color: var(--gold); font-size: 14px; }
#hud-right .count { opacity: .75; font-size: 12px; margin-top: 2px; }
#hud-help {
  bottom: 12px; left: 12px; max-width: 224px;
  font-size: 10.5px; opacity: .6; line-height: 1.75;
}
kbd {
  background: #24242e; border: 1px solid #43434f; border-bottom-width: 2px;
  border-radius: 3px; padding: 0 4px; font-family: inherit; font-size: 10px;
}

/* ---------------- Baren ---------------- */
#barwrap {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  width: min(760px, 92vw); pointer-events: none; z-index: 5;
}
/* På smallere PC-vinduer holdes baren fri af hjælpeboksen i hjørnet:
   et 480 px bredt frirum giver 240 px i hver side, uanset vinduets bredde. */
@media (pointer: fine) and (max-width: 1240px) {
  #barwrap { width: min(760px, calc(100vw - 480px)); }
}
/* Under 820 px er der ikke plads til begge; hjælpeboksen ryger ud, og baren får pladsen igen. */
@media (max-width: 820px) {
  #hud-help { display: none; }
  #barwrap { width: min(760px, 92vw); }
}
#bar-status {
  text-align: center; margin-bottom: 6px; min-height: 18px;
}
#bar-status span {
  display: inline-block; font-family: Georgia, serif; font-size: 13px;
  color: var(--gold); background: rgba(8,8,12,.8);
  border: 1px solid rgba(201,164,76,.28); border-radius: 12px;
  padding: 3px 14px;
}
#bar-track {
  position: relative; height: 30px; border-radius: 15px;
  background: linear-gradient(90deg, #08080b 0%, #1d1d27 22%, #4a4a55 48%, #b9b096 74%, #fbf6e6 100%);
  border: 2px solid #2c2c38; box-shadow: 0 4px 20px rgba(0,0,0,.7), inset 0 0 18px rgba(0,0,0,.5);
  overflow: visible;
}
#bar-track .tick { position: absolute; top: 50%; width: 1px; height: 8px; margin-top: -4px; background: rgba(255,255,255,.12); }
#bar-marker {
  position: absolute; top: -7px; left: 50%; width: 14px; height: 44px;
  margin-left: -7px; border-radius: 4px;
  background: var(--gold); border: 2px solid #2b2214;
  box-shadow: 0 0 14px rgba(201,164,76,.85);
  transition: left .75s cubic-bezier(.3,1.4,.5,1);
}
#bar-marker.good { background: #e8d79a; box-shadow: 0 0 22px rgba(255,238,180,1); }
#bar-marker.bad  { background: #8e2f2a; box-shadow: 0 0 22px rgba(190,60,50,.9); }
#bar-labels {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-family: Georgia, serif; font-size: 13px; letter-spacing: .18em;
}
#bar-labels .l { color: #8c3f3a; text-shadow: 0 0 10px rgba(0,0,0,.9); }
#bar-labels .r { color: #f2e6c2; text-shadow: 0 0 10px rgba(242,230,194,.35); }

/* ---------------- Overlays / skærme ---------------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #14141c 0%, #05050a 75%);
  padding: 24px; overflow-y: auto;
}
.screen.hidden, .hidden { display: none !important; }

.panel {
  width: min(720px, 100%);
  background: linear-gradient(180deg, #1a1a24, #12121a);
  border: 1px solid rgba(201,164,76,.4);
  border-radius: 8px; padding: 32px 34px;
  box-shadow: 0 20px 70px rgba(0,0,0,.8);
}
h1 {
  font-family: Georgia, "Times New Roman", serif; font-weight: normal;
  font-size: 34px; margin: 0 0 6px; color: var(--gold);
  letter-spacing: .01em; line-height: 1.15;
}
h1 .sub { display: block; font-size: 15px; letter-spacing: .3em; color: #7d7d8c; margin-top: 10px; }
h2 {
  font-family: Georgia, serif; font-weight: normal; font-size: 22px;
  margin: 0 0 14px; color: var(--gold);
}
p { line-height: 1.65; margin: 0 0 14px; color: #d8d4c6; font-size: 15px; }
.small { font-size: 12.5px; color: #8b8b98; line-height: 1.6; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, rgba(201,164,76,.45), transparent); margin: 22px 0; }

/* knapper */
button {
  font-family: inherit; font-size: 14px; cursor: pointer;
  background: #23232f; color: var(--light);
  border: 1px solid #43434f; border-radius: 5px;
  padding: 12px 18px; transition: all .14s;
  text-align: left; line-height: 1.4;
}
button:hover { background: #2e2e3c; border-color: var(--gold-dim); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.primary { background: linear-gradient(180deg, #cdaa55, #a5842f); color: #1b1608; border-color: #6e5719; font-weight: 600; text-align: center; }
button.primary:hover { background: linear-gradient(180deg, #e0bc63, #b8933a); }
button.ghost { background: transparent; }
.btnrow { display: flex; gap: 12px; flex-wrap: wrap; }
.btnrow.stack { flex-direction: column; }
.btnrow.stack button { width: 100%; }
.choice { display: flex; gap: 12px; align-items: flex-start; }
.choice .num {
  flex: 0 0 22px; height: 22px; border-radius: 3px; background: #3a3a48;
  color: #cfcfe0; font-size: 12px; display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.choice .txt { flex: 1; }
.choice .kind { display: block; font-size: 11px; letter-spacing: .12em; opacity: .55; margin-bottom: 3px; }

/* kønsvalg */
.genderrow { display: flex; gap: 14px; flex-wrap: wrap; }
.gcard {
  flex: 1 1 190px; background: #1e1e28; border: 1px solid #3b3b49;
  border-radius: 6px; padding: 18px; cursor: pointer; transition: all .15s;
}
.gcard:hover { border-color: var(--gold); background: #262633; transform: translateY(-2px); }
.gcard .ic { font-size: 34px; line-height: 1; }
.gcard .t { font-family: Georgia, serif; font-size: 18px; color: var(--gold); margin: 10px 0 4px; }
.gcard .d { font-size: 12.5px; color: #9a9aa8; line-height: 1.55; }

/* ---------------- Dialogbokse i spillet ---------------- */
#dialog, #reaction {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 20px 26px; pointer-events: none;
  background: linear-gradient(0deg, rgba(4,4,8,.86) 0%, rgba(4,4,8,.55) 45%, rgba(4,4,8,0) 85%);
}
#dialog .box, #reaction .box {
  pointer-events: auto; width: min(760px, 100%);
  max-height: calc(100vh - 34px); overflow-y: auto;
  background: linear-gradient(180deg, rgba(24,24,33,.98), rgba(15,15,22,.99));
  border: 1px solid rgba(201,164,76,.5); border-radius: 8px;
  padding: 22px 24px; box-shadow: 0 16px 60px rgba(0,0,0,.85);
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dlg-head .ic { font-size: 30px; }
.dlg-head .ttl { font-family: Georgia, serif; font-size: 20px; color: var(--gold); }
.dlg-head .where { font-size: 11px; letter-spacing: .16em; color: #7f7f8e; margin-top: 2px; }
.dlg-text { font-size: 15px; line-height: 1.7; color: #ddd9cb; margin-bottom: 18px; white-space: pre-line; }

/* reaktion */
.spk { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.spk .av {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: #2a2a38; border: 1px solid #45455a;
}
.spk .nm { font-family: Georgia, serif; font-size: 17px; }
.spk .rl { font-size: 11px; letter-spacing: .15em; color: #7f7f8e; margin-top: 2px; }
.spk.jehova .av { background: radial-gradient(circle, #ffe9a8, #b9862a); border-color: #f0d79a; box-shadow: 0 0 26px rgba(255,220,130,.7); }
.spk.jehova .nm { color: #ffe9a8; letter-spacing: .22em; text-shadow: 0 0 18px rgba(255,220,130,.6); }
.spk.aeldste .nm { color: #b9c6dd; }
.spk.vidne .nm { color: #bdd2b6; }
.line { font-size: 15px; line-height: 1.7; color: #e6e2d5; font-style: italic; margin-bottom: 16px; }
.delta {
  display: inline-block; font-family: Georgia, serif; font-size: 14px;
  padding: 7px 14px; border-radius: 4px; margin-bottom: 14px;
}
.delta.good { background: rgba(215,196,140,.14); border: 1px solid rgba(215,196,140,.5); color: #eadfb4; }
.delta.bad  { background: rgba(168,67,59,.16); border: 1px solid rgba(168,67,59,.55); color: #e0a49c; }
.factbox {
  background: rgba(255,255,255,.035); border-left: 3px solid var(--gold-dim);
  padding: 12px 14px; border-radius: 0 4px 4px 0; margin-bottom: 16px;
}
.factbox .h { font-size: 10.5px; letter-spacing: .2em; color: var(--gold-dim); margin-bottom: 6px; }
.factbox .t { font-size: 12.5px; line-height: 1.65; color: #a9a9b8; }
.cont { text-align: right; font-size: 12px; color: #7f7f8e; }

/* ---------------- Cutscene ---------------- */
#cutscene { z-index: 40; background: #04040a; flex-direction: column; gap: 0; padding: 0; }
#cut-art { width: 100%; flex: 1 1 auto; min-height: 0; display: block; }
#cut-panel {
  flex: 0 0 auto; width: 100%; padding: 26px 30px 30px;
  background: linear-gradient(0deg, #04040a 60%, rgba(4,4,10,.4));
  border-top: 1px solid rgba(201,164,76,.25);
}
#cut-inner { max-width: 760px; margin: 0 auto; }
#cut-title { font-family: Georgia, serif; font-size: 20px; color: var(--gold); margin-bottom: 10px; letter-spacing: .04em; }
#cut-text { font-size: 15.5px; line-height: 1.75; color: #ddd9cb; white-space: pre-line; }
#cut-next { margin-top: 16px; font-size: 12px; color: #7f7f8e; text-align: right; }

/* ---------------- Slutskærm ---------------- */
.endbadge {
  font-family: Georgia, serif; letter-spacing: .3em; font-size: 12px;
  color: var(--gold-dim); margin-bottom: 8px;
}
.summary { max-height: 230px; overflow-y: auto; margin: 6px 0 18px; border: 1px solid #2b2b38; border-radius: 5px; }
.summary table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.summary td { padding: 7px 10px; border-bottom: 1px solid #22222c; vertical-align: top; }
.summary tr:last-child td { border-bottom: none; }
.summary .ok { color: #cdbd85; }
.summary .no { color: #cf8b83; }

/* ---------------- Touch-styring ---------------- */
#touch { position: absolute; z-index: 10; right: 16px; bottom: 150px; display: none; }
#touch .pad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); gap: 4px; }
#touch button {
  background: rgba(20,20,28,.7); border: 1px solid rgba(201,164,76,.35);
  border-radius: 8px; padding: 0; color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;                 /* ingen dobbelttryk-zoom eller scroll fra knapperne */
}
#touch button:active { background: rgba(52,44,20,.85); border-color: var(--gold); }
#touch svg { width: 24px; height: 24px; fill: currentColor; display: block; pointer-events: none; }

/* Spillets faste elementer må ikke kunne markeres eller give iOS-menu ved langt tryk.
   Dialogtekster holdes markerbare, så skriftsteder kan kopieres. */
#hud, #touch, #barwrap, canvas#c {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}

@media (pointer: coarse) { #touch { display: block; } #hud-help { display: none; } }

/* smalle skærme */
@media (max-width: 640px) {
  .panel { padding: 22px 18px; }
  h1 { font-size: 26px; }
  #dialog .box, #reaction .box { padding: 16px 16px; }
  .dlg-text, .line { font-size: 14px; }
  #barwrap { bottom: 10px; }
}
