/* Emberforge — fabuła: dialogi, napisy, cutscenki. Mobile-first; tylko zmienne --ef-* z KONTRAKT sekcja 5. */

.efs-dlg {
  position: absolute;
  left: max(8px, var(--ef-safe-left, 0px));
  right: max(8px, var(--ef-safe-right, 0px));
  bottom: max(8px, var(--ef-safe-bottom, 0px));
  z-index: var(--ef-z-modal, 50);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 62vh;
  max-height: 62dvh;
  padding: 12px 14px 14px;
  overflow-y: auto;
  color: var(--ef-ink, #f6ead2);
  background: linear-gradient(180deg, var(--ef-panel, #2a1e18ee), var(--ef-panel2, #1d1511f2));
  border: 1px solid var(--ef-line, #6b4a2e);
  border-radius: var(--ef-radius, 14px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 220, 160, 0.1);
  font-family: var(--ef-font-body, system-ui, sans-serif);
  animation: efs-rise 0.22s ease-out;
}
.efs-dlg[hidden] { display: none; }
.efs-dlg__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.efs-dlg__name {
  font-family: var(--ef-font, Georgia, serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--ef-gold, #f2c45a);
}
.efs-dlg__role { flex: 1; font-size: 0.82rem; color: var(--ef-dim, #b9a487); }
.efs-dlg__skip { min-height: 44px; min-width: 44px; padding: 0 12px; }
.efs-dlg__text {
  margin: 0;
  min-height: 3.2em;
  font-size: 1.05rem;
  line-height: 1.5;
  cursor: pointer;
  white-space: pre-wrap;
}
.efs-dlg__choices { display: flex; flex-direction: column; gap: 6px; }
.efs-dlg__choices[hidden], .efs-dlg__next[hidden], .efs-dlg__skip[hidden] { display: none; }
.efs-dlg__choice {
  min-height: 44px;
  padding: 10px 14px;
  text-align: left;
  line-height: 1.3;
  white-space: normal;
}
.efs-dlg__choice:hover, .efs-dlg__choice:focus-visible, .efs-dlg__choice.is-sel { border-color: var(--ef-ember, #ff7a2f); outline: none; }
.efs-dlg__choice.is-sel { background: rgba(255, 140, 50, 0.16); box-shadow: 0 0 0 1px var(--ef-ember, #ff7a2f) inset; }
.efs-dlg__next { align-self: flex-end; min-height: 44px; min-width: 96px; }

/* napisy (cutscenki, szepty, barki) */
.efs-sub {
  position: absolute;
  left: 50%;
  bottom: max(70px, calc(var(--ef-safe-bottom, 0px) + 56px));
  transform: translateX(-50%);
  z-index: calc(var(--ef-z-modal, 50) - 1);
  width: min(92vw, 780px);
  padding: 8px 14px;
  text-align: center;
  color: var(--ef-ink, #f6ead2);
  background: rgba(20, 13, 9, 0.72);
  border-radius: 10px;
  font-family: var(--ef-font-body, system-ui, sans-serif);
  line-height: 1.4;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}
.efs-sub[hidden] { display: none; }
.efs-sub__who { margin-right: 8px; font-weight: 700; color: var(--ef-gold, #f2c45a); }
.efs-sub--small { font-size: 0.9rem; }
.efs-sub--medium { font-size: 1.05rem; }
.efs-sub--large { font-size: 1.3rem; }
.efs-sub--huge { font-size: 1.6rem; }

/* cutscenki */
.efs-cut { position: absolute; inset: 0; z-index: calc(var(--ef-z-modal, 50) + 5); pointer-events: none; }
.efs-cut[hidden] { display: none; }
.efs-cut__bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 0.6s ease; }
.efs-cut__bar--top { top: 0; }
.efs-cut__bar--bot { bottom: 0; }
.efs-cut--lb .efs-cut__bar { height: 11vh; height: 11dvh; }
.efs-cut__fade { position: absolute; inset: 0; background: #000; opacity: 1; }
.efs-cut__skip {
  position: absolute;
  top: max(12px, var(--ef-safe-top, 0px));
  right: max(12px, var(--ef-safe-right, 0px));
  min-height: 44px;
  min-width: 44px;
  pointer-events: auto;
  opacity: 0.85;
}

@keyframes efs-rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 768px) {
  .efs-dlg { left: 50%; right: auto; width: min(760px, 86vw); transform: translateX(-50%); animation: none; }
  .efs-dlg__choices { flex-direction: column; }
}
@media (max-height: 420px) and (orientation: landscape) {
  .efs-dlg { max-height: 78vh; max-height: 78dvh; padding: 8px 12px 10px; }
  .efs-dlg__text { font-size: 0.95rem; min-height: 2.4em; }
}
@media (prefers-reduced-motion: reduce) {
  .efs-dlg { animation: none; }
  .efs-cut__bar { transition: none; }
}
