html, body {
  height:100%;
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  -ms-text-size-adjust: none;
  touch-action:manipulation;
}

#titleDiv {
  display:none;
}

#info {
  display:none;
}

body {
  min-width:400px;
  font-family:Minion Pro, Times New Roman;
  color:#666;
  overflow:hidden;
  font-size:14pt;
}

.invert {
  background:black !important;
  color:#ccc !important;
}

.invert .fleuron img {
  filter: brightness(320%);
}

#contentcontainer {
  position:relative;
  height:98%;
  overflow-x:hidden;
}

#contentcontainer::-webkit-scrollbar {
  display:none;
}
div.sidebarleft {
  float:left;
  padding:0 10px 0 10px;
  height:100%;
  overflow-x:hidden;
  border-right:1px solid lightgray;
}

div.main {
  padding:10px;
  overflow-x:hidden;
  min-height:100px;
  white-space:pre-wrap;
  -o-tab-size: 2;
	-moz-tab-size: 2;
  tab-size: 2;
  text-align:justify;
  background-attachment:fixed;
  padding-right:15px;
}

div.tabcontent {
  border-top:1px solid lightgray;
}

ul {
  margin:0px;
  margin-top:0px;
  padding:0 0 0 10px;
  list-style-type:none;
}

li.menu-highlight {
		border: 1px dashed cyan !important;
		background: #fdfdfd;
}

h2 {
  margin-bottom:0px;
}

a {
  text-decoration:none;
}

.bold {
  font-weight:bold;
}

.centered {
  text-align:center;
}

.noBottomMargin {
  margin-bottom:0px;
}

.italic {
  font-style:italic;
}

.noMargin {
  margin:0px;
}

.hidden {
  display:none;
}

.linked {
  cursor:pointer;
}

#backArrow {
  cursor:pointer;
}

.opening {
  background-image:url('includes/ajax-loader.gif');
  background-repeat:no-repeat;
  background-position:99% 1%; 
}

.open {
  background-color:#DDDDDD;
}

#savestatus {
  position:fixed;
  z-index:5;
  width:20px;
  height:20px;
  top:0;
  right:0;
  margin:5px;
  background-repeat:no-repeat;
  background-position:99% 1%;
  background-size: cover;
}

.saved #savestatus {
  background-image:url('includes/bluedot.svg');
}

.altered #savestatus {
  background-image:url('includes/orangedot.svg');
}

.failed #savestatus {
  background-image:url('includes/reddot.svg') !important;
}

.saving #savestatus {
  background-image:url('includes/ajax-loader.gif');
}

.nameDiv {
  padding-right:20px;
}

div :focus {
  outline:0px solid;
}

.expandLinkInactive {
  color:#eeeeee;
}

#childnotes {
  text-align:right;
  overflow:hidden;
}

#clock {
  text-align:center;
  width:100%;
  position:fixed;
  bottom:0;
}

#childcontent {
  text-align:left;
}

/* Making a more palatable scrollbar */

#mainWindow {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.3) transparent;
}

#mainWindow::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#mainWindow::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,.3);
  border-radius: 3px;
}

#mainWindow::-webkit-scrollbar-track {
  background: transparent;
}


#mainWindow p {
  margin:0;
}


.fullScreen { 
    position:absolute;
    top:0;
    left:0;
    height: 100%; 
    z-index:-10;
    width:100%;
}

#increaseFont, #decreaseFont {
	cursor:pointer;
}


@media only screen and (max-device-width: 800px)
{

  #contentcontainer {
    overflow-y:auto;
  }

  div.sidebarleft {
    width:99% !important;
    font-size:24pt;
    left:0;
  }

  div.main, #childnotes {
    width:0% !important;
    display:none;
}

  div.sidebarleft.openedNote {
    width:0% !important;
    font-size:24pt;
    display:none;
  }

  div.main.openedNote, #childnotes.openedNote {
    width:99% !important;
    left:0;
    display:block;
}

  body {
    font-size:18pt;
  }

  .expandLink {
    font-size:36pt;
  }
}

@media only screen and (max-device-width: 400px)
{
  div.sidebarleft {
    font-size:54pt;
  }

  div.sidebarleft.openedNote {
    font-size:54pt;
  }
  body {
    font-size:36pt;
  }

  .expandLink {
    font-size:54pt;
  }
}



@media print {
  
  #titleDiv {
    display:block !important;
  }
  
  #showChildNotesLabel, #hideGarbageLabel {
    display:none;
  }
  
  
  
  div.sidebarleft {
    width:0px !important;
    display:none !important;
  }
  
  div.main, #childnotes {
    left:0px;
    overflow-x:hidden;
    min-height:0px;
    height:auto;
    width:100%;
    margin-left:0px;
    font-size:10pt;
    font-family:Times New Roman, serif;
  }
  
  #contentcontainer {
    height:auto;
  }

}

body:after{
    position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
    content: url('includes/reddot.gif');
}

/* Additional styling for hidden navigation/styling */

:root {
  --nav-width: 320px;
  --nav-max-width: 85vw;
  --edge-zone: 16px;
  --overlay-bg: rgba(0,0,0,.35);
  --panel-bg: #fff;
  --border: #e6e6e6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #fafafa;
}

.main {
  height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  line-height: 1.5;
}

.edge-zone {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--edge-zone);
  height: 100vh;
  z-index: 1;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 10;
}
.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(var(--nav-width), var(--nav-max-width));
  transform: translateX(-102%);
  transition: transform 220ms ease;
  background: #fffa;
  border-right: 1px solid var(--border);
  z-index: 11;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.nav.open {
  transform: translateX(0);
}

.nav-header {
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.close-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
}

.nav-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}


/* Right-side configuration pane (mirrors nav) */
.config {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(var(--nav-width), var(--nav-max-width));
  transform: translateX(102%);
  transition: transform 220ms ease;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  z-index: 11;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.config.open {
  transform: translateX(0);
}

.config-header {
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.config-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.config-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}

.config-body label {
  display: block;
  font-size: 13px;
  margin: 12px 0 6px;
}

.config-body input[type="text"],
.config-body select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  outline: none;
  background: #fff;
}

.config-body .row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.config-body button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}

/* Style for hidden config */

.accordion { max-width: 600px; }
.acc-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
}
.acc-panel { padding: 10px 14px; border-top: 1px solid #ddd; }

/* Styling for image select dialog */

/* Backdrop + dialog */
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  z-index:999;
}
.backdrop.open { display: flex; }

.dialog {
  width: min(720px, 100%);
  background: Canvas;
  border: 1px solid #9996;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  display: flex;
  max-height: 80%;   /* overall cap (tweak as you like) */
  flex-direction: column;
}

.dialog header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid #9993;
}
.dialog header h2 { margin: 0; font-size: 16px; font-weight: 650; }
.dialog main {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;                 /* important so children can scroll */
  flex: 1;      
}
.dialog footer {
  display: flex; gap: 10px; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-top: 1px solid #9993;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;

  max-height: 100%;             /* cap just the grid (tweak) */
  overflow: auto;
  padding-right: 4px;            /* optional: room for scrollbar */
}

.grid { -webkit-overflow-scrolling: touch; }

.tile {
  height: 150px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  user-select: none;
  background-size: cover;        /* key line */
  background-position: center;   /* keep it centered */
  background-repeat: no-repeat;  /* avoid tiling */

}
.tile[aria-selected="true"] { border-color: #5b9dff; }
.tile span {
  position: absolute; bottom: 8px; left: 8px;
  font-size: 12px; background: rgba(0,0,0,.35);
  color: white; padding: 3px 6px; border-radius: 999px;
}

.muted { opacity: .75; font-size: 12px; }
.right { display: flex; gap: 10px; }
.close {
  padding: 6px 10px; border-radius: 10px;
  background: transparent;
}

/* Login page */

#loginPage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  background: #f4f4f5;
}

#loginCard {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,.09);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 360px;
}

#loginLogo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  gap: 10px;
}

#loginTitle {
  font-size: 20px;
  font-weight: 600;
  color: #222;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.loginField-wrap {
  margin-bottom: 14px;
}

.loginField-wrap label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 5px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#loginCard .loginField {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  box-sizing: border-box;
  color: #222;
}

#loginCard .loginField:focus {
  border-color: #5b9dff;
  box-shadow: 0 0 0 3px rgba(91,157,255,.18);
}

#loginButton {
  width: 100%;
  padding: 13px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  cursor: pointer;
  margin-top: 6px;
  transition: background 150ms;
  letter-spacing: 0.01em;
}

#loginButton:hover {
  background: #000;
}

#loginButton:active {
  background: #444;
}

@media (max-width: 400px) {
  #loginCard {
    padding: 32px 20px 28px;
  }
}

#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    z-index: -1000;           /* behind everything */
    background: #ffffff;   /* example background */
    pointer-events: none; /* prevents blocking clicks */
    background-size: cover;        /* key line */
    background-position: center;   /* keep it centered */
    background-repeat: no-repeat;  /* avoid tiling */
}
