/* ============================================================
   SCRIPTORIUM MINI-GAMES
   - Ghost Terminal (Job Test)
   - Estonia 91 (Swipe of History)
   All styles are scoped to local roots.
   ============================================================ */

/* ------------------------------------------------------------
   Shared container styling for game blocks
------------------------------------------------------------ */
.scriptorium-game-card {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 40px auto 60px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  border-radius: 24px;
  overflow: hidden;
}

/* ============================================================
   1) GHOST TERMINAL — JOB TEST
   (from interviewtest.html, scoped to #ghost-terminal-widget)
   ID is unique, so no conflict with main.css.
   ============================================================ */

#ghost-terminal-widget {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 500px;
  margin: 0 auto;
  background: #000;
  border: 1px solid #333;
  font-family: "Courier New", monospace;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  color: #0f0;
  border-radius: 4px;
}

/* The background canvas */
#ghost-canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* The UI Layer sitting on top of canvas */
#ghost-terminal-widget .ui-layer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(0, 10, 0, 0.6);
}

/* Header bar */
#ghost-terminal-widget .terminal-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #0f0;
  padding-bottom: 10px;
  margin-bottom: 15px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Scrollable content area for questions/diagrams */
#ghost-terminal-widget .terminal-content {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 15px;
  font-size: 15px;
  line-height: 1.4;
  scrollbar-width: thin;
  scrollbar-color: #0f0 #002200;
}

/* Custom Scrollbar for Webkit */
#ghost-terminal-widget .terminal-content::-webkit-scrollbar { width: 8px; }
#ghost-terminal-widget .terminal-content::-webkit-scrollbar-track { background: #002200; }
#ghost-terminal-widget .terminal-content::-webkit-scrollbar-thumb { background: #0f0; }

/* ASCII Diagrams */
#ghost-terminal-widget .ascii-art {
  font-family: "Courier New", monospace;
  white-space: pre;
  background: rgba(0, 20, 0, 0.8);
  border: 1px dashed #0f0;
  padding: 10px;
  margin: 10px 0;
  color: #fff;
  display: inline-block;
  font-weight: bold;
  font-size: 14px;
}

/* Multiple Choice List */
#ghost-terminal-widget .options-list {
  list-style: none;
  padding: 0;
  margin-top: 10px;
}
#ghost-terminal-widget .options-list li {
  margin-bottom: 6px;
  padding-left: 10px;
  border-left: 2px solid transparent;
}
#ghost-terminal-widget .options-list li:hover {
  border-left: 2px solid #0f0;
  background: rgba(0, 255, 0, 0.1);
}

/* Input Area */
#ghost-terminal-widget .input-area {
  display: flex;
  border-top: 1px solid #0f0;
  padding-top: 10px;
}
#ghost-terminal-widget .prompt-char {
  color: #0f0;
  margin-right: 10px;
  font-weight: bold;
}
#ghost-terminal-widget #cmd-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

/* Utilities */
#ghost-terminal-widget .highlight {
  color: #fff;
  font-weight: bold;
}
#ghost-terminal-widget .hidden {
  display: none !important;
}

/* Button for start/restart */
#ghost-terminal-widget .btn {
  background: #0f0;
  color: #000;
  border: none;
  padding: 10px 20px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
}
#ghost-terminal-widget .btn:hover {
  background: #fff;
}

/* Overlay for Start/End screens */
#ghost-terminal-widget #overlay-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ============================================================
   2) ESTONIA 91 — SWIPE OF HISTORY
   (from freeestonia.html, scoped to #estonia91-root)
   ============================================================ */

/* Local root instead of body */
#estonia91-root {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #030305;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: #fff;
  height: 600px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 24px;
}

/* Ensure tap highlight is local to widget */
#estonia91-root,
#estonia91-root * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* --- DYNAMIC BACKGROUND --- */
#estonia91-root .aurora-bg {
  position: absolute;
  width: 150%;
  height: 150%;
  background:
    radial-gradient(circle at 50% 50%, rgba(77, 159, 255, 0.15), transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(46, 213, 115, 0.1), transparent 40%);
  filter: blur(60px);
  animation: est-aurora 10s infinite alternate;
  z-index: -1;
}

@keyframes est-aurora {
  0%   { transform: translate(-10%, -10%); }
  100% { transform: translate(5%, 5%); }
}

/* --- UI LAYER --- */
#estonia91-root .header-ui {
  width: 100%;
  padding: 20px;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

#estonia91-root .stat-pill {
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  gap: 8px;
  align-items: center;
}

#estonia91-root .progress-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- CARD STACK --- */
#estonia91-root .stack-container {
  flex-grow: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  perspective: 1000px;
  margin-top: -40px;
}

#estonia91-root .card {
  position: absolute;
  width: 90%;
  max-width: 360px;
  height: 65vh;
  max-height: 600px;
  background: #111116;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
  user-select: none;
  cursor: grab;
  overflow: hidden;
}

/* Layering effect for cards behind */
#estonia91-root .card:nth-last-child(1) { z-index: 3; }
#estonia91-root .card:nth-last-child(2) {
  z-index: 2;
  transform: scale(0.96) translateY(15px);
  opacity: 0.6;
}
#estonia91-root .card:nth-last-child(3) {
  z-index: 1;
  transform: scale(0.92) translateY(30px);
  opacity: 0.3;
}
#estonia91-root .card:nth-last-child(n+4) {
  opacity: 0;
  pointer-events: none;
}

#estonia91-root .card-visual {
  flex-grow: 1;
  background: #1a1a20;
  border-radius: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 4rem;
  position: relative;
  overflow: hidden;
}

#estonia91-root .card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

#estonia91-root .year-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #fff;
  color: #000;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

#estonia91-root .card h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.1;
  margin-bottom: 8px;
}
#estonia91-root .card p {
  margin: 0;
  font-size: 0.95rem;
  color: #999;
  line-height: 1.5;
}

/* Stamps (Like/Nope) */
#estonia91-root .stamp {
  position: absolute;
  top: 40px;
  padding: 5px 10px;
  border: 4px solid;
  border-radius: 8px;
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0;
  z-index: 10;
  transform: rotate(-15deg);
}
#estonia91-root .stamp-nope {
  right: 40px;
  color: #ff4757;
  border-color: #ff4757;
  transform: rotate(15deg);
}
#estonia91-root .stamp-like {
  left: 40px;
  color: #2ed573;
  border-color: #2ed573;
}

/* --- CONTROLS --- */
#estonia91-root .controls {
  width: 100%;
  padding: 30px;
  display: flex;
  justify-content: center;
  gap: 30px;
  z-index: 10;
}

#estonia91-root .action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  justify-content: center;
  align-items: center;
}
#estonia91-root .action-btn:active {
  transform: scale(0.9);
}
#estonia91-root .btn-nope {
  color: #ff4757;
}
#estonia91-root .btn-like {
  color: #2ed573;
  box-shadow: 0 0 20px rgba(46, 213, 115, 0.2);
}

/* --- SCREENS --- */
#estonia91-root .overlay-screen {
  position: fixed; /* full-screen overlay for immersion */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #030305;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
  transition: opacity 0.6s;
}

#estonia91-root .start-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 0.9;
  background: linear-gradient(to right, #fff, #888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

#estonia91-root .primary-btn {
  margin-top: 40px;
  background: #fff;
  color: #000;
  border: none;
  padding: 18px 40px;
  border-radius: 40px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255,255,255,0.2);
  transition: transform 0.2s;
}
#estonia91-root .primary-btn:active {
  transform: scale(0.95);
}

#estonia91-root .hidden {
  opacity: 0;
  pointer-events: none;
}
