*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
}
*:focus {
  outline: 0;
  outline: none;
}

html {
  box-sizing: border-box;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

a {
  text-decoration: none;
}
a:active,
a:hover {
  outline: 0;
}
input,
select {
  font-size: 100%;
}
img {
  border: 0;
}
ul,
li {
  list-style: none;
}

.button {
  display: block;
  padding: 4px;
  width: 50px;
  height: 50px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
  fill: var(--txtCol);
  cursor: pointer;
  overflow: hidden;
}
.button * {
  pointer-events: none;
}
.button:hover {
  opacity: 0.7;
}

/* --- 1. The 8px Status Bar --- */
#online-status {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background-color: #4caf50; /* Green */
  transition: background-color 0.5s ease;
  z-index: 10;
}

.is-offline {
  background-color: #ffd54f !important; /* Soft Yellow */
}

/* --- 2. The Disappearing Toast Popup (Top Anchored) --- */
#toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 20px) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: #323232;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 20;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

#install-button {
  /* Positioning and Centering */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* Stacking Order (Above everything) */
  z-index: 9999;

  /* Your Existing Styles */
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease;
}

#install-button:hover {
  background-color: #0056b3;
}

#install-button[hidden] {
  display: none;
}

/* --- 4. iOS Install Tooltip --- */
#ios-install-tooltip {
  background-color: #ffffff;
  color: #333;
  padding: 16px;
  border-radius: 12px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  border: 1px solid #e0e0e0;
  z-index: 9999;
}

#ios-install-tooltip[hidden] {
  display: none;
}

#wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  color: var(--modeTxtCol);
  background: var(--modeBgCol);
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  overflow: hidden;
}
#wrapper.show {
  opacity: 1;
}

#main {
  position: relative;
  font-size: 16px;
  overflow: hidden;
}

#directory {
  position: relative;
  margin-left: 0;
  width: 300px;
  background: var(--dirBgCol);
  font-family: var(--defFont);
  touch-action: pan-y;
  z-index: 1500;
}

#settings {
  padding: 35px 0 10px 8px;
  background: var(--bgCol);
}
#settings .button {
  margin-right: 8px;
  padding: 4px;
  color: var(--txtCol);
  fill: currentColor;
}
#settings .button line {
  stroke: currentColor;
}
#addBtn {
  margin-left: auto;
  margin-right: 0;
  font-size: 38px;
}

#searchbox {
  background-color: var(--srchBgCol);
  padding: 6px 0;
}
#search {
  padding: 10px 15px;
  width: 100%;
  color: var(--srchTxtCol);
  border: none;
  outline: none;
  font-size: 20px;
  font-family: var(--defFont);
  background: inherit;
  border-radius: 0;
}
#search:focus {
  border: none;
  outline: none;
}
#search::placeholder {
  color: var(--srchTxtCol);
  opacity: 1;
}
#search::-moz-placeholder {
  opacity: 1;
}

#talkList {
  margin: 0;
  padding-top: 1px;
  width: 100%;
  background: var(--tlBgCol);
}
[data-type="listItem"] {
  position: relative;
  margin-bottom: 1px;
  padding: 5px 5px 5px 15px;
  width: 100%;
  height: 100px;
  color: var(--liTxtCol);
  background: var(--liBgCol);
  overflow: hidden;
  z-index: 1;
}
[data-type="listItem"].sel {
  color: var(--liTxtColSel);
  background: var(--liBgColSel);
}
[data-type="listttl"] {
  width: 100%;
  height: 100%;
  font-size: 18px;
  line-height: 1.2em;
  color: inherit;
  background: inherit;
  pointer-events: none;
}

#content {
  position: relative;
  padding: 25px 15px;
  color: inherit;
  background-color: inherit;
  touch-action: pan-y;
}

#talkttl {
  margin-right: 120px;
  margin-bottom: 15px;
  padding: 10px;
  color: var(--modeTtlCol);
  font-size: 1.4em;
  line-height: 1.2em;
}
#talkttl[contenteditable="true"] {
  margin-right: 0;
}

#talkmain {
  padding: 10px;
  padding-bottom: 50px;
  min-height: 65vh;
  font-size: 1em;
  line-height: 1.6em;
}

#notes {
  margin-right: -300px;
  padding: 20px 15px 0 10px;
  width: 300px;
  color: var(--modeNotesTxtCol);
  background-color: var(--modeNotesBgCol);
  touch-action: pan-y;
  z-index: 1450;
}
#notes header {
  padding: 15px 10px;
  color: var(--modeTtlCol);
  font-size: 18px;
  text-align: center;
}
#notesmain {
  padding: 8px;
  min-height: 50%;
  font-size: 0.8em;
  line-height: 1.4em;
}

[contenteditable="true"] {
  -webkit-user-select: initial;
  -khtml-user-select: initial;
  -moz-user-select: initial;
  -ms-user-select: initial;
  user-select: initial;
  outline: 1px dashed var(--modeTtlCol);
}
[contenteditable="true"]:focus {
  outline: 1px solid var(--modeTtlCol);
}
[contenteditable="true"]:empty:before {
  content: attr(placeholder);
  color: var(--modeTtlCol);
  display: block; /* For Firefox */
}

#editCntrl {
  position: absolute;
  top: 30px;
  right: 8px;
}
#deleteBtn {
  fill: var(--col3);
}
#editBtn {
  padding: 5px;
  fill: #999;
}
#optBtn {
  padding: 7px;
  fill: #999;
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 10000;
}
#options {
  position: absolute;
  top: 88px;
  right: 10px;
  font-size: 16px;
  background: var(--modeNotesBgCol);
  z-index: 10001;
}
#decFS,
#incFS,
#resetFS {
  fill: var(--modeTxtCol);
}
#resetFS {
  padding: 6px;
}
#printtalk {
  margin-top: 3px;
  fill: var(--col1);
  border-top: 1px solid #cccccc;
}
#backuptalk {
  margin-top: 3px;
  padding: 6px;
  fill: var(--col4);
  border-top: 1px solid #cccccc;
}

#menubar {
  position: relative;
  padding: 5px 15px;
  background: var(--bgCol);
}
#logo {
  position: absolute;
  left: 84px;
  top: 0;
  bottom: 0;
  color: var(--txtCol);
  font-size: 26px;
  font-family: var(--defFont);
  opacity: 1;
}
#logo::after {
  content: var(--version);
  margin-left: 5px;
  font-size: 22px;
}
#logo.standalone {
  opacity: 0.6;
}
#logo.standalone::before {
  content: "SA";
  font-size: 10px;
}

/* FORMATTING STOP WATCH     */
#stopWatch {
  position: relative;
  padding-left: 20px;
  color: var(--swTxtCol);
  background: var(--swBgCol);
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  border-radius: 8px;
}
#swDisplay {
  padding-bottom: 9px;
  font-size: 18px;
  opacity: 0.2;
  transition: opacity 0.5s ease-in-out;
  text-align: center;
}
.swbox {
  position: relative;
  width: 48px;
  font-family: var(--swFont);
  font-size: var(--swFontSize);
  text-align: center;
}
.swbox::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -21px;
  font-size: 8px;
  text-align: center;
}
#swH::after {
  content: "hours";
}
#swM::after {
  content: "min.";
}
#swS::after {
  content: "sec.";
}
#swControl {
  width: 60px;
  height: 60px;
}
#swControl svg {
  fill: currentColor;
  stroke: currentColor;
}

#swCP {
  position: absolute;
  left: 50%;
  bottom: 120%;
  transform: translateX(-50%);
  background: var(--modeNotesBgCol);
  padding: 2px 12px;
  z-index: 110;
  overflow: hidden;
}
#swCP .button {
  padding: 7px;
  width: 50px;
  height: 50px;
}
#swPause {
  fill: var(--col1);
}
#swResume {
  fill: var(--col2);
}
#swStop {
  fill: var(--col3);
}

#modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 35px;
  background: rgba(0, 0, 0, 0.2);
  z-index: 5000;
}
#modalContent {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 650px;
  height: 100%;
  color: var(--modeNotesTxtCol);
  background: var(--modeNotesBgCol);
  font-family: var(--defFont);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
}
#modHdr {
  position: relative;
  height: 60px;
  font-size: 24px;
  color: var(--modeTtlCol);
}
#modClose {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  height: 55px;
  font-size: 32px;
  color: var(--modeTxtCol);
}
#modMain {
  padding: 25px;
}
#modFtr {
  height: 25px;
}

#modMain h2 {
  margin: 15px 0;
  padding-bottom: 6px;
  color: var(--col1);
  font-size: 18px;
  font-weight: 100;
  border-bottom: 1px dotted var(--col1);
}

.modblock {
  margin-bottom: 50px;
}

.setbtn {
  margin: 10px 0;
  padding: 8px 12px 20px;
  width: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}
.setbtn * {
  pointer-events: none;
}
.setbtn h3 {
  margin: 0 0 4px;
  padding: 0;
  color: var(--modeTxtCol);
  font-size: 18px;
  font-weight: 100;
  text-align: center;
}
.setsel {
  border: 3px solid var(--col1) !important;
}
#updtBtn {
  padding: 8px 12px;
  color: var(--modeTxtCol);
  background: var(--modeBgCol);
  font-size: 18px;
  font-weight: 100;
  border: 1px solid var(--modeTxtCol);
  border-radius: 9px;
  cursor: pointer;
}

#infoPanel h3 {
  margin: 15px 0;
  padding-bottom: 6px;
  color: var(--col1);
  font-size: 18px;
  font-weight: 100;
  border-bottom: 1px dotted var(--col1);
}
#infoPanel p {
  margin-bottom: 35px;
  color: var(--modeTxtCol);
  font-size: 18px;
  fill: var(--col4);
  font-weight: 100;
}
#infoPanel a {
  color: var(--col4);
  font-size: 18px;
  font-weight: 100;
}

/* UTILITY FORMATS       */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}
/* Separate rule for compatibility, :focus-within is required on modern Firefox and Chrome */
input.visually-hidden:focus + label {
  outline: thin dotted;
}
input.visually-hidden:focus-within + label {
  outline: thin dotted;
}

#restoreBtn {
  margin: 18px 0 30px;
}
#restoreBtn label {
  padding: 8px 10px;
  color: var(--modeTxtCol);
  background: var(--modeBgCol);
  font-size: 16px;
  font-weight: 100;
  border: 1px solid var(--modeTxtCol);
  border-radius: 9px;
  cursor: pointer;
}

#basecover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  font-size: 24px;
  background: var(--bgCol);
  color: var(--txtCol);
  cursor: pointer;
}
#basecover * {
  pointer-events: none;
}

#notification {
  position: fixed;
  left: 50%;
  top: 10px;
  min-width: 250px;
  transform: translateX(-50%);
  color: #fff;
  background: #333;
  padding: 16px;
  border-radius: 9px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  cursor: pointer;
  z-index: 10000;
  display: none;
}

/* CUSTOM STYLES */
.smooth-scroll {
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}
.active {
  opacity: 1 !important;
  height: auto !important;
}
.hidden {
  display: none;
}

.flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}
.fl-col {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
}
.fl-row {
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
}
.fl-wrap {
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}
.fl-middle {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.fl-center {
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.fl-start {
  -ms-flex-line-pack: start;
  align-content: flex-start;
}
.fl-valign {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}
.fl-bottom {
  -ms-flex-item-align: end;
  align-self: flex-end;
}
.fl-space-between {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}
.fl-space-around {
  -ms-flex-pack: distribute;
  justify-content: space-around;
}
.fl-right {
  -webkit-box-pack: end;
  -ms-flex-pack: end;
  justify-content: flex-end;
}
.fl1 {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

@media only screen and (max-width: 700px) {
  #directory {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    z-index: 102;
  }
  #content {
    z-index: 100;
  }
  #notes {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    margin-right: -100vw;
    width: 100vw;
    z-index: 102;
  }
  #logo {
    display: none;
  }
  #stopWatch {
    padding-left: 12px;
  }
  .swbox {
    width: 45px;
    font-size: 30px;
  }
  .swbox::after {
    bottom: -19px;
  }
  #swControl {
    width: 45px;
    height: 45px;
  }
}

@media print {
  @page {
    size: letter;
  }
  html,
  body {
    margin: 0;
    padding: 0;
    width: 215.9mm;
    height: auto;
    color: #000;
    background: #fff;
    overflow: auto;
  }
  .noprint {
    display: none;
  }
  #wrapper,
  #main {
    margin: 0;
    padding: 0;
    position: relative !important;
    width: 100%;
    height: auto;
    overflow: auto;
    display: block;
  }
  #content {
    margin: 0;
    padding: 0;
    color: #000;
    background: #fff;
  }
  #talkttl {
    margin: 0 0 25px 0;
    padding: 0 0 6px 0;
    width: 100%;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18pt;
    border-bottom: 1px solid #000;
  }
  #talkmain {
    margin: 0;
    padding: 0;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14pt;
  }
}

/* MARKDOWN STYLES */
#talkmain h1,
#talkmain h2,
#talkmain h3,
#notesmain h1,
#notesmain h2,
#notesmain h3 {
  margin-top: 15px;
  margin-bottom: 10px;
  color: var(--col4);
}

mark {
  background: hsl(60, 85%, 85%); /* Soft pastel yellow */
  color: hsl(0, 0%, 0%); /* High-contrast black text */
  padding: 0 4px;
  border-radius: 3px;
}

/* CUSTOM HIGHLIGHT COLORS (PASTEL SET) */
mark.hl-red {
  background: hsl(355, 85%, 88%);
}
mark.hl-green {
  background: hsl(135, 75%, 85%);
}
mark.hl-blue {
  background: hsl(200, 85%, 85%);
}
mark.hl-purple {
  background: hsl(275, 85%, 88%);
}

.scripture {
  margin: 15px 0;
  padding: 12px 15px;
  border-left: 4px solid var(--col4);
  background: var(--modeNotesBgCol);
  border-radius: 4px;
}

.scr-ref {
  display: block;
  font-weight: bold;
  color: var(--col4);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.scr-text {
  display: block;
  font-style: italic;
}

/* MARKDOWN LIST STYLES */
#talkmain ul,
#notesmain ul {
  list-style-type: disc;
  margin-left: 25px;
  margin-bottom: 15px;
}

#talkmain ol,
#notesmain ol {
  list-style-type: decimal;
  margin-left: 25px;
  margin-bottom: 15px;
}

#talkmain li,
#notesmain li {
  margin-bottom: 8px;
  list-style: inherit;
}

.scr-btn {
  color: var(--col4);
  font-weight: bold;
  cursor: pointer;
  border-bottom: 1px dashed var(--col4);
  padding-bottom: 1px;
}
.scr-btn:hover {
  opacity: 0.7;
}

/* SCRIPTURE MODAL STYLES */
#scrModalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 6000;
}

.scr-modal-box {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 85%; /* Keeps it from hitting the very top/bottom on iOS */
  color: var(--modeNotesTxtCol);
  background: var(--modeNotesBgCol);
  font-family: var(--defFont);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.scr-modal-hdr {
  padding: 15px 20px;
  font-size: 22px;
  color: var(--col4);
  border-bottom: 1px dotted var(--col4);
  flex-shrink: 0; /* Prevents the header from getting squished */
}

.scr-modal-main {
  padding: 25px 20px;
  font-size: 1rem;
  line-height: 1.6;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Forces buttery-smooth iOS scrolling */
  flex-grow: 1;
}
