*{box-sizing:border-box}
body{margin:0;font-family:system-ui,Arial,sans-serif;background:#f5f5f2;color:#222;line-height:1.4}
.app{max-width:1200px;margin:20px auto;padding:10px}
.header{display:flex;justify-content:space-between;margin-bottom:15px}
.status{font-size:12px;border:1px solid #aaa;padding:4px 10px;border-radius:20px;background:#fff;display:none}
.grid{display:grid;grid-template-columns:22% 53% 25%;gap:12px}
.box{background:#fff;border:1px solid #ccc;border-radius:6px;padding:12px;min-height:400px;overflow:auto}
.box h3{margin-top:0;font-size:13px;text-transform:uppercase;border-bottom:1px solid #ddd;padding-bottom:6px}
label{font-size:13px;display:block;margin:4px 0}
input[type=text], textarea, select{width:100%;padding:6px;border-radius:6px;border:1px solid #aaa;font-size:13px}
textarea{min-height:70px;font-family:Aptos,Calibri,Arial,sans-serif;font-size:16px}
.small{min-height:50px}
.preview{border:1px solid #aaa;border-radius:8px;padding:12px;font-family:Aptos,Calibri,Georgia,serif;background:#fff;font-size:16px;max-width:900px;margin:auto;line-height:1.65}
.preview p{margin:0 0 12px}
.title{text-align:center;font-weight:bold;font-size:17px}
.meta{text-align:center;font-size:12px;color:#666;margin-bottom:10px}
.ok{color:green;background:1a7f37;}.bad{color:#900;background:#fdeaea;}
.controlsStack button{display:block;width:100%}
.controlsStack button+button{margin-top:8px}
.perspectiveButtons{margin-top:10px;display:grid;grid-template-columns:1fr 1fr;gap:8px}
.exportButtons{display:grid;grid-template-columns:1fr;gap:8px;margin:12px 0 0}
button{padding:7px 12px;border-radius:6px;border:1px solid #888;background:#355c88;color:#fff;font-weight:bold;cursor:pointer}
button:hover{background:#008CBA}
button:disabled{background:#aaa;cursor:not-allowed}
.warnBox{border:2px solid #cc0000;padding:10px;margin-bottom:12px;background:#fff2f2;font-size:13px;border-radius:8px}
.hl{background:#ffdddd;border-bottom:2px solid red;padding:0 2px;border-radius:3px}
.spinner{width:32px;height:32px;border:4px solid #ddd;border-top:4px solid #355c88;border-radius:50%;animation:spin 1s linear infinite;margin:20px auto}
@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.menu{
  display:flex;
  align-items:center;
  gap:10px;

  flex-wrap:nowrap;   /* 🔥 IMPORTANT */

  white-space:nowrap; /* 🔥 IMPORTANT */
}

#systemMenu{
  display:flex;
  gap:10px;
}

.multiGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-top:14px;
}

.multiCard{
  border:1px solid #ccc;
  border-radius:10px;
  padding:16px;
  background:#fafafa;
  box-shadow:0 2px 6px rgba(0,0,0,0.08);
  transition:transform 0.15s ease, box-shadow 0.15s ease;
}

.multiCard:hover{
  transform:translateY(-2px);
  box-shadow:0 4px 10px rgba(0,0,0,0.12);
}

.multiCard p{
  margin-top:6px;
  line-height:1.5;
}

.multiCard h4{
  margin-top:0;
  font-size:18px;
  border-bottom:1px solid #ddd;
  padding-bottom:6px;
}


.pFreud{border-left:6px solid #355c88}
.pKlein{border-left:6px solid #7a3e9d}
.pWinnicott{border-left:6px solid #3a8f5c}
.pKernberg{border-left:6px solid #b03a3a}
.pBion{border-left: 6px solid #5c7c8a;background:#f5f8fa;}
.pRelational{border-left: 6px solid #8a5c7c;background:#faf5f8;}

#newCase{background:#888}
@media (max-width:980px){.grid{grid-template-columns:1fr}}

.app.readingMode .grid {
  grid-template-columns: 0fr 0fr 1fr;
}
.app.readingMode .box:nth-child(1),
.app.readingMode .box:nth-child(2) {
  display:none;
}
.app.readingMode .box:nth-child(3) {
  grid-column: 1 / span 3;
}

.app.presentationMode .grid {
  grid-template-columns: 0fr 0fr 1fr;
}

.app.presentationMode .box:nth-child(1),
.app.presentationMode .box:nth-child(2) {
  display:none;
}

.app.presentationMode .box:nth-child(3) {
  grid-column: 1 / span 3;
}

.app.presentationMode .preview {
  font-size: 22px;
  line-height: 1.7;
  max-width: 1000px;
}

.app.presentationMode .preview h3 {
  font-size: 28px;
}

.app.presentationMode .preview h4 {
  font-size: 24px;
}

.caseFacts{
  font-size:13px;
  background:#f4f4f4;
  border-radius:6px;
  padding:8px 10px;
  margin-bottom:10px;
  line-height:1.4;
}

.interpretDivider{
  border-top:1px solid #ddd;
  margin:12px 0 10px 0;
}

.morphCard{
  max-width:700px;
  margin:auto;
  padding:18px;
  border:1px solid #ccc;
  border-radius:10px;
  background:#fafafa;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#222;
  color:white;
  padding:8px 20px;
}

.logo{
  font-weight:bold;
  font-size:18px;
}

.menu button{
  background:none;
  border:none;
  color:white;
  margin-left:10px;
  cursor:pointer;
}

.menu button:hover{
  text-decoration:underline;
}

.page{
  display:none;
}

.homePanel{
  max-width:700px;
  margin:80px auto;
  text-align:center;
  font-size:18px;
}

#systemMenu {
  display: inline-flex;
  gap: 6px;
}

.homeTagline{
  font-size:20px;
  margin-bottom:15px;
  color:#444;
}

.homeDiagram{
  margin:40px auto;
  text-align:center;
}

.caseBox{
  display:inline-block;
  padding:12px 20px;
  border:2px solid #444;
  border-radius:6px;
  font-weight:bold;
}

.arrow{
  font-size:28px;
  margin:10px 0;
}

.theoryRow{
  display:flex;
  justify-content:center;
  gap:12px;
  margin-top:10px;
}

.theoryBox{
  padding:14px;
  border-radius:10px;
  border:2px solid #ccc;
  
  background:white;
  
  text-align:center;
  
  font-weight:600;
  }


  .freudBox{
    border-color:#355c88;
    }
    
  .kleinBox{
  border-color:#7a3e9d;
  }
  
  .winnicottBox{
  border-color:#3a8f5c;
  }
  
  .bionBox{
  border-color:#5c7c8a;
  }
  
  .kernbergBox{
  border-color:#b03a3a;
  }
  
  .relationalBox{
  border-color:#8a5c7c;
  }
    

.enterButton{
  display:block;
  
  margin:10px auto 0 auto;
  
  font-size:18px;
  padding:10px 20px;
  }

.homeStatement{
  max-width:600px;
  margin:15px auto 25px auto;
  font-size:16px;
  color:#555;
  line-height:1.5;
}

.theoryBox small{
  color:#666;
  font-size:12px;
}

.mapPanel{
  max-width:900px;
  margin:60px auto;
  text-align:center;
}

.mapIntro{
  margin-bottom:30px;
  color:#555;
}

.conceptGrid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  margin-bottom:30px;
}

.conceptCell{
  padding:12px;
  border:1px solid #aaa;
  border-radius:6px;
  background:#f8f8f8;
  cursor:pointer;
  transition:background 0.2s;
}

.conceptCell:hover{
  background:#eaeaea;
}

.conceptInfo{
  border-top:1px solid #ddd;
  padding-top:20px;
  font-size:15px;
  color:#333;
}

.conceptActive{
  background:#355c88;
  color:white;
  border-color:#355c88;
}

.conceptRelated{
  background:#e3ecf7;
  border-color:#355c88;
}

.conceptGraphWrap{
  margin-top:30px;
  padding-top:20px;
  border-top:1px solid #ddd;
}

.conceptGraph{
  width:100%;
  height:auto;
  background:#fafafa;
  border:1px solid #ddd;
  border-radius:8px;
}

.graphNode{
  fill:#f5f5f5;
  stroke:#666;
  stroke-width:1.5;
}

.graphNode.active{
  fill:#355c88;
  stroke:#355c88;
}

.graphNode.related{
  fill:#e3ecf7;
  stroke:#355c88;
}

.graphLabel{
  font-size:14px;
  text-anchor:middle;
  dominant-baseline:middle;
  fill:#222;
  font-family:system-ui, Arial, sans-serif;
}

.graphLabel.active{
  fill:white;
  font-weight:bold;
}

.graphEdge{
  stroke:#999;
  stroke-width:2;
}

.mapPerspectiveBar{
  margin-top:25px;
  margin-bottom:10px;
  text-align:center;
}

.mapPerspectiveBar button{
  margin:0 6px;
  padding:6px 10px;
  font-size:13px;
}

button.generateConcept{
  margin-top:12px;
  font-size:14px;
}

.mapPerspectiveBar button.activePerspective{
  background:#355c88;
  color:white;
  border-color:#355c88;
}

.loginPanel{
  max-width:420px;
  margin:80px auto;
  text-align:center;
}

.loginPanel input{
  width:100%;
  margin-top:6px;
  margin-bottom:12px;
}

.compareGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.compareCard{
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  background: #fafafa;

  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.5s ease forwards;
}
/* Stagger effect */
.compareCard:nth-child(1){
  animation-delay: 0.1s;
}
.compareCard:nth-child(2){
  animation-delay: 0.25s;
}

@keyframes fadeInUp{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}


.compareFreud{ border-left: 4px solid #3b82f6; }
.compareKlein{ border-left: 4px solid #ef4444; }
.compareWinnicott{ border-left: 4px solid #10b981; }
.compareKernberg{ border-left: 4px solid #f59e0b; }
.compareBion{ border-left: 4px solid #8b5cf6; }      /* violet */
.compareRelational{ border-left: 4px solid #06b6d4; } /* cyan */

/* fallback for unknown names */
.compareGeneric{ border-left: 4px solid #888; }


.loginCard {
  width: 360px;
  padding: 30px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  text-align: center;
}

.loginCard h2 {
  margin-bottom: 5px;
}

.subtitle {
  font-size: 14px;
  color: #777;
  margin-bottom: 20px;
}

input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.primaryBtn {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  border: none;
  border-radius: 6px;
  background: #2d6cdf;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.primaryBtn:hover {
  background: #1f4fb5;
}

.toggleRow {
  display: flex;
  margin-bottom: 15px;
}

.toggleRow button {
  flex: 1;
  padding: 8px;
  border: none;
  background: #f1f1f1;
  cursor: pointer;
}

.toggleRow button.active {
  background: #2d6cdf;
  color: white;
}

.status {
  margin-top: 10px;
  font-size: 13px;
  color: #888;
}

body {
  background: linear-gradient(to bottom right, #f5f7fa, #e8edf5);
  font-family: system-ui, sans-serif;
}

.termsBox {
  text-align: left;
  font-size: 12px;
  margin-top: 10px;
}

.termsText {
  background: #f7f7f7;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.termsCheck {
  display: flex;
  align-items: center;
  gap: 6px;
}


#loginPage.active {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}


.loginCard {
  width: 320px;
  padding: 28px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  text-align: center;
}

.loginCard input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.loginCard button {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: none;
  border-radius: 6px;
  background: #2c7be5;
  color: white;
  font-weight: 500;
  cursor: pointer;
}

.loginCard button:hover {
  background: #1a68d1;
}

.status {
  margin-top: 10px;
  font-size: 13px;
  color: #555;
}

/* ---------- Page System (clean + stable) ---------- */

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ---------- Login Page (special layout) ---------- */

#loginPage.active {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.fadeIn {
  opacity: 0;
  transform: translateY(4px);
  animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Make page fill viewport */
#loginPage {
  height: 100vh;
  display: flex;
  justify-content: center;   /* horizontal */
  align-items: center;       /* vertical */
}

/* Optional: make it look clean */
.loginContainer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.loginCenter {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  outline: 2px solid red;
}




.optionGroup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.inlineOption {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

/* Normalize checkbox/radio size */
.inlineOption input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Remove giant blue blocks */
input[type="checkbox"],
input[type="radio"] {
  transform: scale(1);   /* important */
}

.workbenchRight {
  transition: all 0.25s ease;
}

#pBody.mode-reading {
  position: fixed;

  top: 80px;                 /* below your menu */
  left: 50%;
  transform: translateX(-50%);

  width: 800px;
  max-width: 90vw;

  height: calc(100vh - 100px);
  overflow-y: auto;

  padding: 30px;

  background: #fafafa;

  border-radius: 10px;
  border: 1px solid #ddd;

  z-index: 999;
}

#pBody.mode-presentation {
  position: relative;

  left: 50%;
  transform: translateX(-50%);

  width: 1000px;
  max-width: 95vw;

  margin-top: 30px;
  padding: 40px;

  background: #ffffff;

  border-radius: 12px;

  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transition: all 0.25s ease;
}

h3 {
  margin-bottom: 6px;
}

.optionGroup {
  margin-bottom: 16px;
}

.inlineOption:hover {
  background: #f5f7fa;
  border-radius: 6px;
  padding: 2px 4px;
}

#pBody.mode-editor {
  font-size: 14px;
  line-height: 1.5;
  max-width: 700px;
}

#pBody.mode-reading {
  font-size: 18px;
  line-height: 1.8;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px;
}

#pBody.mode-reading h3 {
  margin-top: 24px;
  margin-bottom: 10px;
}

#pBody.mode-reading p {
  margin-bottom: 14px;
}

#pBody.mode-presentation {
  font-size: 22px;
  line-height: 1.6;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
}

#pBody.mode-presentation h3 {
  font-size: 28px;
  margin-bottom: 20px;
}

#pBody.mode-presentation p {
  margin-bottom: 18px;
}

#pBody {
  transition: all 0.25s ease;
}

.mode-presentation ~ * {
  opacity: 0.1;
}

.mode-presentation .controls {
  display: none;
}

#pBody.mode-reading {
  background: #fafafa;
  border-radius: 8px;
}

#pBody.mode-presentation {
  background: #ffffff;
}

.previewSection {
  margin-bottom: 16px;
}

.previewSection h4 {
  margin-bottom: 6px;
  font-size: 14px;
  color: #444;
}

.previewHint {
  opacity: 0.7;
  font-size: 13px;
}

/* default (Editor stays constrained) */
#pBody {
  max-width: 700px;
}

/* 📖 Reading mode */
#pBody.mode-reading {
  max-width: 680px;
  margin: 0 auto;
}

/* 🎤 Presentation mode */
#pBody.mode-presentation {
  max-width: 1000px;   /* or 1200px if you want bigger */
  margin: 0 auto;
}

#pBody.mode-presentation {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;         /* this is the key */
  max-width: 1200px;
}

#pBody.mode-presentation {
  padding: 40px;
}

#pBody.mode-reading {
  padding: 20px;
}

#pBody.mode-presentation p {
  max-width: 900px;
}

#pBody.mode-presentation {
  width: 95vw;
  max-width: none;
}

#pBody.mode-presentation p,
#pBody.mode-presentation h3,
#pBody.mode-presentation h4 {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* 🎤 Presentation mode escapes layout */
#pBody.mode-presentation {
  position: fixed;
  top: 60px;            /* below menu */
  left: 0;
  width: 100vw;
  height: calc(100vh - 60px);

  overflow-y: auto;
  padding: 60px;

  background: #fff;
  z-index: 999;
}

#pBody.mode-reading {
  max-width: 700px;
  margin: 20px auto;

  padding: 25px;

  background: #fafafa;

  border-radius: 8px;

  border: 1px solid #eee;
}

#pBody.mode-editor {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  background: none;
}

#pBody {
  transition: all 0.25s ease;
}

body.presentation-active .page {
  opacity: 0.2;
}


/* Keep preview fully visible */
body.presentation-active #pBody {
  opacity: 1;
  pointer-events: auto;
}

#pBody.mode-presentation {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);

  width: 90vw;
  max-width: 1200px;
  height: calc(100vh - 60px);

  overflow-y: auto;#pBody.mode-presentation {
    max-width: 900px;
    margin: 30px auto;
  
    padding: 40px;
  
    background: #ffffff;
  
    border-radius: 12px;
  
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  
    border: 1px solid #e0e0e0;
  }
  padding: 40px;

  background: #ffffff;

  z-index: 1000;   /* 🔥 ABOVE overlay */
}

.page,
#pBody {
  transition: opacity 0.25s ease, transform 0.25s ease;
}


body.presentation-active {
  background: #f4f6f8;
}

body.presentation-active::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;

  background: rgba(0,0,0,0.5);   /* dimming strength */
  z-index: 900;

  pointer-events: none;          /* 🔥 allows clicking through */
}

#viewBar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#viewBar button {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #444;

  background: #2c3e50;        /* dark slate */
  color: #ffffff;

  font-size: 14px;
  font-weight: 500;

  cursor: pointer;
}

#viewBar button:hover {
  background: #1a252f;
}

#viewBar button.active {
  background: #0077cc;        /* clear active state */
  border-color: #005fa3;
}

#content.reading {
  font-size: 18px;
  line-height: 1.8;
  max-width: 760px;
}

#content.presentation {
  font-size: 24px;        /* 🔥 more visible change */
  line-height: 1.6;
  max-width: 1100px;
}

