* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #0f1013;
  color: #f2f2f2;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #15171c;
  border-bottom: 1px solid #2a2d36;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.4px;
  text-decoration: none;
  color: inherit;
}
.topnav { display: flex; gap: 18px; flex-wrap: wrap; }
.topnav a { color: #d5d7de; }
.container { width: min(1100px, calc(100% - 24px)); margin: 24px auto 60px; }
.container.narrow { width: min(850px, calc(100% - 24px)); }
.card {
  background: #171a20;
  border: 1px solid #2b2f38;
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
}
.hero h1, .card h1 { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.two-up { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.three-up { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  display: inline-block;
  background: #f4f4f4;
  color: #111;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.btn-secondary { background: transparent; color: #f1f1f1; border: 1px solid #454a57; }
.btn-small { padding: 8px 12px; font-size: 0.92rem; }
.section-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.text-link { color: #a7c3ff; }
.forum-card, .lesson-row {
  display: block;
  background: #101318;
  border: 1px solid #2b2f38;
  border-radius: 14px;
  padding: 16px;
}
.lesson-list { display: grid; gap: 12px; }
.lesson-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 12px;
  align-items: center;
}
.lesson-number { color: #cfd2db; font-weight: 700; }
.lesson-title { font-weight: 700; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.84rem;
  white-space: nowrap;
}
.pill-live { background: #8e1b1b; color: #fff; border: 1px solid #cf5050; }
.pill-closed { background: #232833; color: #cfd2db; border: 1px solid #414858; }
.muted { color: #b4b7bf; }
.small { font-size: 0.92rem; }
.lesson-container { width: min(900px, calc(100% - 24px)); }
.status-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.comment-stream { display: grid; gap: 14px; margin-top: 12px; }
.comment {
  background: #101318;
  border: 1px solid #2a303c;
  border-radius: 14px;
  padding: 14px;
}
.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #d9dbe2;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.comment-form, .chat-input { margin-top: 18px; display: grid; gap: 10px; }
input, textarea {
  width: 100%;
  border: 1px solid #3a4150;
  background: #0f1218;
  color: #f3f3f3;
  border-radius: 10px;
  padding: 12px;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
.locked-box {
  margin-top: 18px;
  background: #11161f;
  border: 1px solid #384154;
  border-radius: 14px;
  padding: 16px;
}
.chat-shell { display: grid; gap: 18px; }
.chat-window { height: min(52vh, 460px); overflow-y: auto; margin-top: 14px; }
.chat-messages { display: grid; gap: 2px; }
.chat-message {
  background: none;
  border: none;
  border-radius: 0;
  padding: 2px 0;
  margin: 0;
}
.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: #cdd0d8;
  margin-bottom: 8px;
}
.alert-message { border-color: #825959; background: #231515; }
.slim-input textarea { min-height: 82px; }
.current-name { color: #d7dae2; margin-bottom: 2px; }
.chat-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 8px;
}
.lesson-bar, .lifeline-wrap { position: relative; }
.lesson-btn {
  background: #101318;
  color: #fff;
  border: 1px solid #2b2f38;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.lifeline-btn {
  background: #2a1414;
  color: #ffd2d2;
  border: 1px solid #8e3b3b;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.lesson-menu {
  position: absolute;
  top: 46px;
  right: -140px;
  left: auto;
  width: min(280px, calc(100vw - 60px));
  background: #171a20;
  border: 1px solid #2b2f38;
  border-radius: 12px;
  padding: 12px;
  z-index: 50;
  box-shadow: 0 14px 30px rgba(0,0,0,0.25);
}
.menu-item { display: block; padding: 8px 0; cursor: pointer; color: #e8e9ed; }
.submenu { margin-top: 8px; }
.menu-back { margin-bottom: 8px; cursor: pointer; color: #aaa; }
.lifeline-box {
  position: absolute;
  top: 46px;
  left: -25%;
  transform: translateX(-50%);
  width: min(280px, calc(100vw - 60px));
  background: #1b1111;
  border: 1px solid #8e3b3b;
  border-radius: 12px;
  padding: 12px;
  z-index: 50;
  box-shadow: 0 14px 30px rgba(0,0,0,0.25);
}
.lifeline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.name-card {
  margin-top: 16px;
  background: #11161f;
  border: 1px solid #344058;
  border-radius: 14px;
  padding: 14px;
}
.name-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.name-row input { flex: 1 1 240px; }
.hidden { display: none; }

.chat-line {
  margin: 0;
  display: inline;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-time {
  color: #888;
  margin-right: 8px;
  font-size: 0.9em;
}

.chat-message p { margin: 0; }
.chat-text { white-space: pre-wrap; }

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.header-menu-wrap {
  position: relative;
}

.always-open {
  color: #35c759;
  font-weight: 700;
  white-space: nowrap;
}

.users-panel {
  position: relative !important;
  top: auto !important;
  right: auto !important;
}

.users-header {
  font-weight: bold;
  margin-bottom: 10px;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #35c759;
  flex: 0 0 8px;
}

.user-name {
  font-size: 14px;
}

@media (max-width: 700px) {
  .lesson-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .chat-tools { flex-direction: column; align-items: stretch; }
  .lesson-btn, .lifeline-btn { width: 100%; text-align: left; }
  .users-panel {
    position: static;
    width: 100%;
    margin-top: 70px;
  }
}



.lesson-menu {
  background: #1c1f26;
  opacity: 1;
}

.lifeline-box {
  background: #241616;
  opacity: 1;
}




.lesson-menu,
.lifeline-box {
  z-index: 999;
  background: #171a20;
  opacity: 1;
}

.lifeline-box {
  background: #1b1111;
}

.users-panel {
  z-index: 10;
}


/*
.left-panel {
  position: absolute;
  top: -72px;
  left: -360px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
*/


.left-section {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px;
}

.left-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.left-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.left-btn {
  background: #101318;
  border: 1px solid #2b2f38;
  color: #fff;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
}



.top-actions {
  display: flex;
  align-items: center;
gap: 10px;
}

.logout-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 6px 10px;
}



.chat-window {
  flex: 1;
}



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

.always-open {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #7CFC9A; /* soft green */
  font-weight: 600;
}




.always-open {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #7CFC9A;
  font-weight: 600;
}

/* Left dot */
.always-open::before,
.always-open::after {
  content: "●";
  margin: 0 6px;
  animation: pulse 1.5s infinite;
}

/* Optional: stagger timing for nicer effect */
.always-open::after {
  animation-delay: 0.75s;
}

@keyframes pulse {
  0%   { opacity: 0.3; transform: scale(0.9); }
  50%  { opacity: 1;   transform: scale(1.1); }
  100% { opacity: 0.3; transform: scale(0.9); }
}


.chat-system-sep {
  color: #665;
  margin: 0 4px;
}



.chat-window {
  min-height: 640px;
}


.left-panel {
  margin-top: 37px;
}




.side-toggle,
.side-subtoggle {
  width: 100%;
  padding: 14px 12px;
  font-size: 16px;
  text-align: left;
  cursor: pointer;

  background: #000;           /* black background */
  color: #fff;                /* white text */
  border: 1px solid #555;     /* subtle border */
  border-radius: 8px;
}
.side-list,
.side-sublist {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  margin-left: 10px;
}

.side-sublist a {
  display: none;
  padding: 12px 12px;
  font-size: 16px;
  text-decoration: none;
  border-radius: 8px;
}



.lesson-viewer {
  width: 50%;
  max-width: 400px;
  margin: 20px auto;
  padding: 12px;
}

.lesson-content {
  width: 100%;
  box-sizing: border-box;
}


.side-list,
.side-sublist {
  position: static;   /* key fix */
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  margin-left: 10px;
}


#exploreMenu {
  position: static !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  width: 100% !important;
  box-shadow: none;
}


.side-link {
  display: block;
  padding: 12px;
  margin-top: 6px;

  background: #000;
  color: #fff;
  text-decoration: none;

  border: 1px solid #555;
  border-radius: 8px;
}

.lesson-nav {
  max-width: 500px;
  margin: 20px auto 10px;
  text-align: center;        /* centers the button */
}

.back-btn {
  display: inline-block;
  padding: 10px 16px;

  background: #000;
  color: #fff;               /* white text */
  text-decoration: none;     /* remove underline */
  font-size: 18px;           /* larger text */

  border: 1px solid #555;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .left-panel {
    position: relative;
    z-index: 100;
  }

  #exploreList {
    position: absolute;
    top: 48px;
    left: 0;
    width: min(260px, calc(100vw - 24px));
    background: #111;
    border: 1px solid #555;
    border-radius: 10px;
    padding: 10px;
    z-index: 999;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  }

  #exploreList .side-subtoggle,
  #exploreList .side-link,
  #exploreList .side-sublist a {
    width: 100%;
    box-sizing: border-box;
  }
}


.side-sublist {
  display: none;
}



.side-sublist {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 8px 14px;
  padding: 0;
}

.side-sublist a {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  padding: 12px;
  min-height: 22px;

  background: #000;
  color: #fff !important;
  text-decoration: none !important;

  border: 1px solid #555;
  border-radius: 8px;
  box-sizing: border-box;
}


.lesson-chat-layout {
  display: flex;
  min-height: 100vh;
  background: #000;
}

.lesson-viewer {
  width: 28%;
  min-width: 320px;     /* don’t go too small */
  padding: 20px;
  box-sizing: border-box;
  border-right: 1px solid #333;
}

.lesson-content {
  max-width: 420px;     /* keeps text readable */
}






.lesson-wrap {
  width: 28%;
  min-width: 320px;
  padding: 20px;
  box-sizing: border-box;
}
.lesson-wrap {
  flex: 0 0 28%;

}

.lesson-viewer {
  width: 100%;
  margin: 0;
  padding: 0;
}

a.logout-btn,
.logout-btn {
  color: #fff !important;
  border-color: rgba(255,255,255,0.5) !important;
}

a.logout-btn:hover,
.logout-btn:hover {
  color: #fff !important;
  border-color: #fff !important;
  background: rgba(255,255,255,0.1) !important;
}



@media (max-width: 768px) {
  body {
    overflow: hidden;
  }

  .lifeline-wrap {
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
  }

  .chat-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .mobile-controls {
    order: 1;
    display: flex;
    gap: 8px;
    padding: 8px;
  }

  .chat-messages {
    order: 2;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .chat-input {
    order: 3;
    flex-shrink: 0;
    padding: 8px;
  }

  .chat-input textarea {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
    box-sizing: border-box;
  }

}
 

/* iPhone Stuff */

#messageBox {
  font-size: 16px !important;
}

body {
  overflow-x: hidden;
}




html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

* {
  box-sizing: border-box;
}

#messageBox {
  font-size: 16px !important; /* prevents iPhone auto-zoom */
  max-width: 100% !important;
}

.chat-area,
.chat-messages,
.chat-input,
.left-panel,
.users-panel,
.lesson-viewer,
#lessonContent,
.lesson-content {
  max-width: 100vw !important;
}


.chat-messages {
  overflow-y: auto !important;
  overflow-x: visible !important; /* 👈 important */
  user-select: text !important;
}

#chatMessages * {
  user-select: text !important;
}






  .chat-input {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .lesson-content {
    word-break: normal !important;
    overflow-wrap: anywhere !important;
  }

@media (max-width: 768px) {
  .left-panel.open {
    position: fixed !important;
    left: 10px !important;
    top: 70px !important;
    bottom: 70px !important;

    display: block !important;
    width: calc(100vw - 20px) !important;
    max-width: none !important;

    background: #111 !important;
    border: 1px solid #444 !important;
    border-radius: 10px !important;
    padding: 10px !important;
    overflow-y: auto !important;
    z-index: 999999 !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.75) !important;
  }
}

