
/* ==========================================
   SMARTOVAL // VISUAL NOVEL INTERFACE
   Reusable dialogue component
   ========================================== */

.vn-panel {
  position: fixed;

  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));

  transform:
    translate(-50%, 35px);

  z-index: 100;

  width: min(900px, calc(100% - 40px));

  padding: 26px 32px 20px;

  background: rgba(7, 12, 10, 0.9);

  border: 1px solid rgba(166, 195, 172, 0.65);

  box-shadow:
    0 12px 45px rgba(0, 0, 0, 0.45),
    inset 0 0 25px rgba(90, 130, 100, 0.04);

  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);

  color: #e2e9df;

  font-family: "Courier New", monospace;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.55s ease,
    transform 0.55s ease,
    visibility 0.55s;
}

/* Thin accent line */

.vn-panel::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 2px;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(150, 200, 160, 0.65),
    transparent
  );
}

/* Visible state */

.vn-panel.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: translate(-50%, 0);
}

/* ==========================================
   DIALOGUE TEXT
   ========================================== */

.vn-text {
  margin: 0;

  min-height: 2.8em;

  color: #e2e9df;

  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.7;
  letter-spacing: 0.015em;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Typewriter cursor */

.vn-panel.is-typing .vn-text::after {
  content: "▌";

  display: inline-block;
  margin-left: 3px;

  color: #a2c9a8;

  animation: vn-cursor-blink 0.7s steps(1) infinite;
}

@keyframes vn-cursor-blink {
  50% {
    opacity: 0;
  }
}

/* ==========================================
   DIALOGUE ACTIONS
   ========================================== */

.vn-actions {
  display: flex;
  justify-content: flex-end;

  margin-top: 18px;
}

.vn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;

  padding: 10px 17px;

  background: #1b2b20;
  border: 1px solid #6c9674;

  color: #c1d9c3;

  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;

  text-decoration: none;

  cursor: pointer;

  opacity: 0;
  transform: translateY(7px);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    background 0.2s ease;
}

.vn-action[hidden] {
  display: none !important;
}

.vn-action.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.vn-action:hover {
  background: #304634;
  color: #ffffff;
}

.vn-action:focus-visible {
  outline: 2px solid #a2c9a8;
  outline-offset: 3px;
}

/* Screen-reader-only full narration */

.vn-screenreader {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ==========================================
   MOBILE
   ========================================== */

@media (max-width: 600px) {

  .vn-panel {
    width: calc(100% - 24px);

    bottom: max(
      14px,
      env(safe-area-inset-bottom)
    );

    padding: 20px 18px 16px;
  }

  .vn-text {
    min-height: 3.5em;
    font-size: 15px;
    line-height: 1.6;
  }

  .vn-actions {
    margin-top: 15px;
  }

  .vn-action {
    min-height: 44px;
    font-size: 11px;
    padding: 10px 12px;
  }

}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

  .vn-panel,
  .vn-action {
    transition: none;
  }

  .vn-panel.is-typing .vn-text::after {
    animation: none;
  }

}


/* ==========================================
   VISUAL NOVEL / REUSABLE COLOR THEMES
   ========================================== */

/* Default: neutral charcoal */

.vn-panel {
  --vn-bg: rgba(9, 11, 13, 0.92);
  --vn-border: #858e94;
  --vn-text-color: #e7eaec;
  --vn-accent: #c2c7ca;
  --vn-button-bg: #20262a;
  --vn-button-hover: #30383d;

  background: var(--vn-bg);
  border-color: var(--vn-border);
  color: var(--vn-text-color);
}

.vn-text {
  color: var(--vn-text-color);
}

.vn-panel::before {
  background: linear-gradient(
    90deg,
    transparent,
    var(--vn-accent),
    transparent
  );
}

.vn-panel.is-typing .vn-text::after {
  color: var(--vn-accent);
}

.vn-action {
  background: var(--vn-button-bg);
  border-color: var(--vn-border);
  color: var(--vn-text-color);
}

.vn-action:hover {
  background: var(--vn-button-hover);
}

.vn-action:focus-visible {
  outline-color: var(--vn-accent);
}

/* Optional: original terminal green */

.vn-panel.vn-theme-green {
  --vn-bg: rgba(7, 12, 10, 0.9);
  --vn-border: #829b88;
  --vn-text-color: #e2e9df;
  --vn-accent: #a2c9a8;
  --vn-button-bg: #1b2b20;
  --vn-button-hover: #304634;
}

/* Optional: cold blue-gray */

.vn-panel.vn-theme-cold {
  --vn-bg: rgba(9, 14, 21, 0.92);
  --vn-border: #8299ad;
  --vn-text-color: #e2ebf2;
  --vn-accent: #a9c5db;
  --vn-button-bg: #192733;
  --vn-button-hover: #2a4052;
}
