/* SPDX-FileCopyrightText: © 2020 Thomas Reale <tom@feralfiction.com> */
/* SPDX-License-Identifier: Unlicensed */
/* SPDX-LicenseRef-Custom-Commercial-Agreement */
/* "Feral Fiction™" is a trademark of Postmodern Media, LLC */

/* ================================
   CORE RESET + BASE STRUCTURE
=================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  position: relative;
  font-size: var(--font-size);
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  scroll-behavior: smooth;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#logo-corner {
  position: absolute;
  top: -4px;
  left: 4px;
  z-index: 1000;
  height: auto;
}

#logo-corner img,
#logo-corner video {
  display: none;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.freeze-ui {
  opacity: 0.999;
}

.app {
  height: auto;
  display: grid;
  grid-template-columns: 0.5fr 1.5fr 0.5fr;
  grid-template-rows: 5% 95%;
  margin-bottom: 100px;
}

.mainForm {
  grid-column: 3 / -1;
}

:root {
  --bg-color: #ffffff;
  --text-color: #111111;
  --accent-color: #007aff;
  --border-color: #83837e;
  --border-radius: 8px;
  --border-radius-small: 6px;
  --input-bg: #ffffff;
  --font-family: Georgia, "Times New Roman", serif;
  --font-size: 16px;
  --heading-font: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  --cursor-color: #111111;
  --scrollbar-color: rgba(0, 0, 0, 0.4);
  --scrollbar-width: thin;
}

/* ================================
   THEME: NORMAL
=================================== */
body[data-theme="normal"] {
  --bg-color: #ffffff;
  --text-color: #111111;
  --accent-color: #007aff;
  --border-color: #83837e;
  --input-bg: #ffffff;
  --font-family: Georgia, "Times New Roman", serif;
  --heading-font: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  --cursor-color: #111111;
  --scrollbar-color: rgba(0, 0, 0, 0.4);
  --font-size: 18px;
  --scrollbar-width: thin;
}

/* Normal theme: still image */
body[data-theme="normal"] #logo-still {
  width: 52px;
  display: block;
}

body[data-theme="normal"] #input-box {
  font-family: var(--font-family);
  font-size: 22px;
  color: var(--text-color);
  background-color: var(--input-bg);
  caret-color: var(--cursor-color);
  border: 2px solid var(--border-color);
}

body[data-theme="normal"] .block-cursor {
  background: var(--cursor-color);
  width: 4px;
}

body[data-theme="normal"] #conversation,
body[data-theme="normal"] #story-box,
body[data-theme="normal"] #message-box,
body[data-theme="normal"] #select-box,
body[data-theme="normal"] #notepad-box,
body[data-theme="normal"] #message-scroll,
body[data-theme="normal"] #messages,
body[data-theme="normal"] #story-box-help,
body[data-theme="normal"] .modal,
body[data-theme="normal"] .modal-content,
body[data-theme="normal"] .popup {
  background-color: var(--bg-color);
  color: var(--text-color);
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  font-family: var(--font-family);
  scrollbar-width: var(--scrollbar-width);
}

body[data-theme="normal"] #messages {
  border: none !important;
  box-shadow: none !important;
}

body[data-theme="normal"] #conversation {
  border: none !important;
  box-shadow: none !important;
  padding: 8px;
  margin: 0 !important;
}

body[data-theme="normal"] ::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}

body[data-theme="normal"] ::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-color);
  border-radius: 4px;
}

body[data-theme="normal"] ::-webkit-scrollbar-track {
  background-color: var(--bg-color);
}

body[data-theme="normal"] .story,
body[data-theme="normal"] .story p,
body[data-theme="normal"] .storyContent,
body[data-theme="normal"] .storyContainer {
  line-height: 1.6;
  font-size: var(--font-size);
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-color);
  text-align: justify;
}

body[data-theme="normal"] .story.title {
  font-size: var(--title-size);
  font-family: var(--heading-font);
}
body[data-theme="normal"] .story.author {
  font-size: var(--author-size);
  font-family: var(--heading-font);
}

body[data-theme="normal"] .story.convo {
  line-height: 1.2;
}


/* ================================
   THEME: EIGHTIES
=================================== */
body[data-theme="eighties"] {
  --bg-color: #000000;
  --text-color: #33ff33;
  --accent-color: #33ff33;
  --border-color: #33ff33;
  --input-bg: #111111;
  --font-family: 'Courier New', Courier, monospace;
  --cursor-color: limegreen;
  --scrollbar-color: #0ff;
  --scrollbar-width: 16px;
}

/* Eighties theme: animated video */
body[data-theme="eighties"] #logo-still {
  content: url("images/Feral_Neon.png");
  height: 42px;
  top: -2px;
  display: block;
}

body[data-theme="eighties"] *,
body[data-theme="eighties"] ::before,
body[data-theme="eighties"] ::after {
  color: var(--text-color) !important;
  font-family: var(--font-family) !important;
  box-sizing: border-box;
}

body[data-theme="eighties"] .block-cursor {
  background: var(--cursor-color);
  box-shadow: 0 0 6px var(--cursor-color);
  width: 10px;
  display: inline-block;
  position: absolute;
  z-index: 999;
  pointer-events: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

body[data-theme="eighties"] .contentBox,
body[data-theme="eighties"] .storyContainer,
body[data-theme="eighties"] .storyContent,
body[data-theme="eighties"] .modal,
body[data-theme="eighties"] .modal-content,
body[data-theme="eighties"] .popup {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}

body[data-theme="eighties"] .story,
body[data-theme="eighties"] .story p,
body[data-theme="eighties"] .storyContent,
body[data-theme="eighties"] .storyContent p,
body[data-theme="eighties"] .storyContainer {
  font-family: var(--font-family) !important;
  font-size: var(--font-size);
  line-height: 1.3;
}

body[data-theme="eighties"] .story.title {
  font-size: var(--title-size);
  font-family: var(--heading-font);
}

body[data-theme="eighties"] .story.author {
  font-size: var(--author-size);
  font-family: var(--heading-font);
}

body[data-theme="eighties"] .facebox,
body[data-theme="eighties"] .videobox {
  border: 2px solid var(--border-color);
  box-shadow: 0 0 6px var(--accent-color);
  background-color: #000;
}

body[data-theme="eighties"] .commandEntry {
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-family: var(--font-family);
}

body[data-theme="eighties"] .bottomPanel button,
body[data-theme="eighties"] .theme-button,
body[data-theme="eighties"] .mic-button,
body[data-theme="eighties"] .icon-button {
  color: var(--accent-color);
  background-color: #111;
  border: 1px solid var(--border-color);
  box-shadow: 0 0 4px var(--accent-color);
  font-family: var(--font-family);
}

body[data-theme="eighties"] .bottomPanel button:hover {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

body[data-theme="eighties"] #controlsBelow button {
  background-color: #000;
}

body[data-theme="eighties"] #squelchSlider {
  accent-color: var(--border-color);
}

body[data-theme="eighties"] #controlsBelow span,
body[data-theme="eighties"] #squelchLabel {
  color: var(--text-color);
  font-family: var(--font-family);
}

body[data-theme="eighties"] #imageDisplay,
body[data-theme="eighties"] #videoDisplay {
  border: 3px solid var(--border-color);
  box-shadow: 0 0 10px var(--border-color);
  background-color: #000;
  border-radius: 0;
}

body[data-theme="eighties"] #conversation {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  border: none !important;
  box-shadow: none !important;
  padding: 8px;
  margin: 0 !important;
}

body[data-theme="eighties"] ::-webkit-scrollbar {
  width: var(--scrollbar-width);
}

body[data-theme="eighties"] ::-webkit-scrollbar-track {
  background-color: #98ec98 !important;
}

body[data-theme="eighties"] ::-webkit-scrollbar-thumb {
  background-color: var(--accent-color) !important;
  border: 1px solid var(--bg-color);
  border-radius: 0;
}

body[data-theme="eighties"] ::-webkit-scrollbar-thumb:hover {
  box-shadow: 0 0 6px var(--accent-color);
}

body[data-theme="eighties"] #button-container button,
body[data-theme="eighties"] #button-container img {
  background-color: #0f0 !important;
  border: 1px solid #0a0;
  box-shadow: 0 0 6px #0f0;
  padding: 6px;
  border-radius: 0;
}

body[data-theme="eighties"] #button-container img {
  filter: brightness(120%) hue-rotate(90deg) saturate(200%);
  border: 1px solid #0f0;
  box-shadow: 0 0 3px #0f0;
}

@keyframes my-animation {
  from {
    transform: translateX(100%);
    color: var(--text-color);
  }
  to {
    transform: translateX(-100%);
    color: var(--text-color);
  }
}

/* ================================
   CONTINUE BUILDING...
=================================== */
/* Additional component styling and layout rules can go here,
   with shared styles pulling from :root and scoped theme
   overrides structured as shown above. */

/* Leave space for future: noir, zork, vaporwave, etc. */


#scroll-trap-blocker {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 48px;
  z-index: 5;
  pointer-events: auto;
  background: transparent;
}

dialog {
  margin-left: 40%;
  margin-top: 5%;
}

h1 {
  font-size: 35px;
  margin-bottom: 25px;
}

p {
  margin-bottom: 20px;
}

middiv {
  font-size: 2em;
  line-height: 0em;
  color: black;
}

.first {
  font-size: 25px;
}

.second {
  font-size: 18px;
}

.third {
  font-weight: bold;
  font-size: 24px;
  margin-bottom: 2px;
}

ul {
  font-size: 18px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-left: 0px;
  padding-left: 65px;
}

ol {
  font-size: 18px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-left: 0px;
  padding-left: 65px;
}

ol li {
  font-family: inherit;
  font-size: inherit;
}

hr {
  font-size: 18px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-left: 20%;
  margin-right: 20%;
}

img {
  margin: 5px;
  padding: 0;
  margin-top: 3px;
  margin-bottom: 0em;
  margin-left: 0%;
  margin-right: 0%;
}

.imageViewer img {
  display: block;
  margin: 0 auto;
  padding: 0;
  max-width: 100%;
  height: auto;
}

.imageViewer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
}

.story {
  font-size: 18px;
  text-indent: 30px;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-right: 10px;
  padding-left: 0px;
  text-align: justify;
}

.story.convo {
  width: 95%;
  padding-left: 15px;
}

.story.location {
  text-indent: 0px;
  padding-top: 10px;
  padding-bottom: 5px;
}

.story.init-player {
  font-weight: bold;
  text-indent: 0px;
  padding-top: 10px;
  padding-bottom: 5px;
}

.story.prompt {
  text-indent: 0;
  font-style: italic;
  margin-top: 10 px;
  padding-bottom: 10px;
}

.story.prompt-dialog {
  margin-top: 0;
  padding-bottom: 0;
}

.story.title {
  text-indent: 0px;
  text-align: left;
  font-weight: bold;
  padding-top: 15px;
}

.story.author {
  text-indent: 0px;
  text-align: left;
  font-weight: bold;
}

.story.copyright {
  text-indent: 0px;
  padding-bottom: 10px;
}

.story.first-paragraph {
  padding-top: 0px; /* try 6px, 8px, etc. */
  text-indent: 0px;
}

.thumbContainer {
  position:relative; float:none;
  padding:0px;
}

.spacer-box {
  float:right; clear:right;
  padding-top: 20px;
  width: 10px; height: 50px;
}

.spacer-box-left {
  float: left;
  clear: left;
  width: 25px;
  height: 2px;
}

.boxTop{
  float:right; clear:right;
  width: 0px; 
}

.video-spacer {
  float: right;
  clear: right;
  vertical-align: bottom;
  margin-left: 10px;
  margin-right: 10px;
}

.video-spacer-left {
  float: left;
  clear: left;
  margin-right: 10px;
  margin-left: 0;
}

#media-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.75s ease-in-out;
}

.thumb-left {
  float: left;
  margin: 0 16px 8px 0;
  text-align: left;
}

ul li {
  font-family: inherit;
  font-size: inherit;
}

.notepad {
  font-family: "Bradley Hand ITC", "Brush Script MT", serif;
  font-size: 18px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  padding-left: 3px;
}

.block {
  font-size: 18px;
  text-indent: 30px;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-left: 20%;
  margin-right: 20%;
  padding-left: 10px;
}

.story_first {
  font-size: 18px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  padding-left: 0px;
}

.story_first:first-letter {
  float: left;
  font-size: 60px;
  line-height: 1;
  font-weight: bold;
  margin-right: 9px;
  color: black;
  text-shadow: gray 0.05em 0.05em;
}

.story_first_medium {
  font-size: 22px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  padding-left: 0px;
}

.story_first_medium:first-letter {
  float: left;
  font-size: 73px;
  line-height: 1;
  font-weight: bold;
  margin-right: 9px;
  text-shadow: gray 0.05em 0.05em;
}

.story_first_large {
  font-size: 26px;
  text-indent: 0px;
  margin-top: 0em;
  margin-bottom: 0em;
  padding-left: 0px;
}

.story_first_large:first-letter {
  float: left;
  font-size: 85px;
  line-height: 1;
  font-weight: bold;
  margin-right: 9px;
  text-shadow: gray 0.05em 0.05em;
}

.slidecontainer {
  width: 60%; /* Width of the outside container */
  margin-left: 1%;
  margin-right: 1%;
  margin-top: 5px;
  margin-bottom: 10px;
}

/* The slider itself */
.slider {
  -webkit-appearance: none; /* Override default CSS styles */
  appearance: none;
  width: 100%; /* Full-width */
  height: 25px; /* Specified height */
  background: #d3d3d3; /* Grey background */
  outline: none; /* Remove outline */
  opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */
  -webkit-transition: 0.2s; /* 0.2 seconds transition on hover */
  transition: opacity 0.2s;
  margin-bottom: 10px;
}

/* Mouse-over effects */
.slider:hover {
  opacity: 1; /* Fully shown on mouse-over */
}

/* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; /* Override default look */
  appearance: none;
  width: 25px; /* Set a specific slider handle width */
  height: 25px; /* Slider handle height */
  background: #81380d; /* Green background */
  cursor: pointer; /* Cursor on hover */
}

.slider::-moz-range-thumb {
  width: 25px; /* Set a specific slider handle width */
  height: 25px; /* Slider handle height */
  background: #81380d; /* Green background */
  cursor: pointer; /* Cursor on hover */
}

/*this is the toggle switch control (for english-spanish)*/
.switch {
  position: relative;
  display: inline-block;
  width: 45px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

.toggle:before {
  position: absolute;
  content: "";
  height: 8px;
  width: 12px;
  left: 3px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

input:checked + .toggle {
  background-color: #81380d;
}

input:focus + .toggle {
  box-shadow: 0 0 1px #81380d;
}

input:checked + .toggle:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded toggles */
.toggle.round {
  border-radius: 10px;
}

.toggle.round:before {
  border-radius: 50%;
}

#about-button-box {
  background-color: rgb(222, 226, 245);
  border: 2px solid #5c5c5b;
  width: 50px;
  height: 60px;
  padding: 0px;
  margin-top: 1%;
  margin-left: 1%;
  margin-right: 1%;
}

#entry-box {
  float: left;
  display: block;
  position: relative;
  background-color: transparent;
  border-bottom: 0;
  width: 100%;
  height: 125px;
  padding: 0px;
  margin-top: 0%;
  margin-left: 0%;
  margin-right: 1%;
  margin-bottom: 0;
  align-self: first baseline;
}

table {
  width: 100%;
  display: block;
  float: left;
}

td {
  position: relative;
  border: 10px transparent;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  pointer-events: none;
}   

#storyModal {
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#imageModalContainer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  display: none;
  visibility: hidden;
  background: rgba(0, 0, 0, 0.3);
  justify-content: center;
  align-items: center;
  isolation: isolate;
  transform: translate3d(0, 0, 1px);
  opacity: 0.99;
}

#imgModal {
  position: relative;
  background: var(--bg-color);
  z-index: 10000;
  max-height: none;
  max-width: 60vw; /* was 72vw */
  margin: 4vh auto;
  border-radius: var(--border-radius);
  width: fit-content;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  justify-content: flex-start;
  align-items: stretch;
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 24px 36px 24px 24px; /* more right-side room */

}

#rightColumn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 45%;
  max-width: 520px; /* prevents overflow on big screens */
  margin-left: 12px; /* aligns with your earlier intent */
}

#mediaContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 60vh;
  overflow: hidden;
  padding: 0;
  margin-bottom: 8px;
  margin-right: 0px;
}

#imageDisplay,
#videoDisplay {
  width: 100%;
  max-width: 100%;
  object-fit: contain;
}

#image-label {
  width: 100%;
  max-width: 320px;
  font-size: 16px;
  text-align: left;
  margin: 0%;
  /*display: block;  TK release for v.17 */
  line-height: 1.4;
  padding: 0%;
}

.controlGroup {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;           /* kill spacing */
  padding: 0;
  line-height: 1.2;
  gap: 2px;            /* use controlled spacing */
}

#image-dialog {
  width: 100%;
  max-width: 100%;
  font-size: 18px;
  min-height: 80px;
  resize: none;
  margin: 0;          /* 🔪 kill all margins */
  padding: 8px;
  line-height: 1.2;
  border: 1px solid #aaa;
  border-radius: var(--border-radius-small);
  box-sizing: border-box;
  /*display: block;  TK release for v.17 */
}

#micModeSlider {
  width: 50px;
}

#squelchSlider {
  width: 125px;
}

#controlsBelow {
  margin-top: 6px;
  margin-bottom: 0%;
  padding: 0%;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}

#controlsBelow label,
#controlsBelow span {
  margin: 0;
  padding: 0;
  display: block;
  font-size: 12px;
  line-height: 0;
  text-align: center;
}

#controlsBelow input[type="range"] {
  margin: 0 0 0;             /* slight space above the slider */
  padding: 0%;
  vertical-align: middle;
  width: 100%;
  max-width: 200px;
}

#speakerPic {
  width: 40px;
  height: auto;
  background-color: none;
  cursor: pointer;
}

#muteTogglePic {
  width: 40px;
  height: auto;
  background-color: none;
  cursor: pointer;
}

#muteTogglePic,
#speakerPic {
  position: relative;
  display: inline-block;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#trafficLight {
  opacity: 1;
  position: absolute;
  top: -6px;
  left: -6px;
  width: 14px;
  height: 14px;
  background-color: transparent;
  border: none;
}

/* Prevent focus ring unless using keyboard navigation */
button:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Just in case browsers fall back to :focus */
#sound:focus,
#mute:focus {
  outline: none;
  box-shadow: none;
}

#mute {
  position: relative;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sound {
  position: relative;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
  
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider.round {
  background-color: #4CAF50;
}

input:checked + .slider.round:before {
  transform: translateX(18px);
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-thumb:focus {
  outline: none;
}

#conversation {
  max-height: 80vh;           /* Adjust based on visual balance */
  overflow-y: auto;
  overflow-x: hidden;         /* Prevent horizontal scroll */
  font-size: 18px;
  padding: 8px;
  margin: 0 8px 0 15px;
  box-shadow: 0 0 10px var(--scrollbar-color);
  box-sizing: border-box;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

#convoCell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  max-height: 80vh;
  overflow: hidden; /* Prevent external scroll interference */
  padding: 0;
  margin: 0;
  flex: 1.25; /* used to be 1 */
  min-width: 40%;
  max-width: 50%;
  margin-right: 16px; /* nice spacing to media */
}

#input-box {
  font-size: 22px;
  caret-color: transparent; /* ✅ Already there, just make sure */
  outline: none;            /* ✅ Prevent focus border on some browsers */  padding: 12px;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  box-sizing: border-box;
  height: 68px;
  overflow-y: auto;
  border-radius: 4px;
  white-space: pre-wrap;
  position: relative;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.block-cursor {
  position: absolute;
  height: 24px;
  line-height: 24px;
  animation: blink 1s steps(1) infinite;
  pointer-events: none;
  z-index: 10;
}

#select-box {
  float: left;
  display: block;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  width: 100%;
  height: 98%;
  padding: 3px;
  margin-top: 2.5%;
  margin-left: 0%;
  margin-right: 1%;
  margin-bottom: 0;
  margin-top: 10px;
  overflow-y: scroll;
  overflow-x: hidden;
  user-select: none;
}

#message-scroll {
  border-radius: var(--border-radius-small);
  border: 2px solid var(--border-color);
  overflow: hidden;
  resize: none;
  width: 1.5fr;
  grid-column: 2/2;
}

#messages {
  display: block;
  height: 100%;
  width: 98%;
  margin-left: 5px;
  padding-top: 3px;
  user-select: none;
  overflow: hidden;
  resize: none;
  text-wrap: nowrap;
  /* animation properties */
  -moz-transform: translateX(100%);
  -webkit-transform: translateX(100%);
  transform: translateX(100%);

  -moz-animation: my-animation 10s linear infinite, delay-animation 20s linear infinite;
  -webkit-animation: my-animation 10s linear infinite, delay-animation 20s linear infinite;
  animation: my-animation 10s linear infinite, delay-animation 20s linear infinite;
  animation-fill-mode: forwards;
}

/* for Firefox */
@-moz-keyframes my-animation {
  from {
    -moz-transform: translateX(100%);
  }
  to {
    -moz-transform: translateX(-100%);
  }
}

/* for Chrome */
@-webkit-keyframes my-animation {
  from {
    -webkit-transform: translateX(100%);
  }
  to {
    -webkit-transform: translateX(-100%);
  }
}

@keyframes my-animation {
  from {
    -moz-transform: translateX(100%);
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
    color: black
  }
  to {
    -moz-transform: translateX(-100%);
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
    color: whitesmoke
  }
}

/*creates a delay between playthroughs. works when the time is double that of the normal animation play*/
@keyframes delay-animation {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  50.01% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/*creates the ability to disable animation in javascript*/
.notransition {
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -o-transition: none !important;
  transition: none !important;
}

#message-box {
  float: left;
  display: block;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  text-align: left;
  p {
    text-indent: 0;
  }
  overflow-y: auto;
  overflow-x: hidden;
  height: 98%;
  width: 100%;
  padding: 5px;
  padding-top: 0px;
  margin-left: 0%;
  margin-right: 1%;
  margin-bottom: 0;
  margin-top: 10px;
  user-select: none;
}

.messageBox-image {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  cursor: pointer;
  display: block;
  border-radius: var(--border-radius-small);
  object-fit: contain;
  margin: 6px 6px 0 0; /* 👈 space to the right and bottom */
}

.messageBox-video {
  width: 100%;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  height: auto;
  max-height: 250px;
  object-fit: cover;
  display: block;
  margin: 5px 0;
}

.inventory-image {
  max-width: 100px;
  height: auto;
  margin: 4px;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  cursor: pointer;
}

#top_span {
  float: center;
  display: block;
  position: relative;
  height: 100%;
  width: 100%;
  grid-column: 2 / 2;
  grid-row: 1 / 1;
}

#bottom_span {
  float: center;
  vertical-align: text-top;
  position: relative;
  height: 100%;
  width: 100%;
  grid-column: 1 / -1;
  grid-row: 3 / 3;
}

#column1 {
  float: left;
  display: block;
  position: relative;
  height: 100%;
  width: 100%;
  grid-column: 1 / 1;
  grid-row: 2 / 2;
}

#column2 {
  float: left;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
  width: 100%;
  grid-column: 2 / 2;
  grid-row: 2 / 2;
}

#column3 {
  float: left;
  display: block;
  position: relative;
  height: 100%;
  width: 100%;
  grid-column: 3 / 3;
  grid-row: 2 / 2;
}

#palletes {
  float: right;
  display: block;
  position: relative;
  height: 100%;
  width: 90%;
}

.list-display {
  height: 100%;
  width:100%;
  border: 0;
  outline: none;
  position: relative;
  margin-left: 0%;
  padding-top: 0%;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  font-size: 22px;
}

.imageViewer {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  margin: 0 auto;
  background-color: transparent;
}

input,
button {
  padding: 0px;
  font-size: 20px;
  width: 40px;
  height: 50px;
  margin-top: 0%;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 1%;
  border: none;
  color: none;
  background-color: none;
}

#story-box {
  display: block;
  position: relative;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  height: 82%;
  width: 100%;
  padding: 5px;
  padding-left: 16px;
  padding-right: 12px;
  padding-bottom: 0%;
  margin-bottom: 0%;
  margin-top: 10px;
  margin-left: 0%;
  margin-right: 0%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  resize: none;
  flex: 3;
}

#story-box-help {
  padding: 20px;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  margin: 40px auto 60px auto;
  border-radius: var(--border-radius);
  max-width: 900px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  overflow-y: auto;
}

#story-box::after {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #666;
}

#notepad-box {
  height: 400px;
  width: 95%;
  padding: 5px;
  margin-top: 1%;
  margin-left: 1%;
  margin-right: 1%;
  overflow: scroll;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  resize: vertical;
}

#lf-logo-image {
  width: 95%;
  margin-left: 1%;
  margin-right: 1%;
}

#button-container {
  opacity: .8;
}

#help-button {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  object-fit: contain;
}

#back-button {
  display: inline;
  vertical-align: middle;
  width: 30px;
  height: 40px;
  text-decoration: none;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#forward-button {
  display: inline;
  vertical-align: middle;
  width: 30px;
  height: 40px;
  text-decoration: none;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#speak-button {
  display: inline;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#save-button {
  display: inline;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#font-button {
  display: flex;
  vertical-align: middle;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding: 0%;
}

#get-button {
  display: flex;
  vertical-align: middle;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#inventory-button {
  display: flex;
  justify-content: center;
  align-items: center;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  margin-top: 0px;
  padding-top: 0%;
}

#go-button {
  display: flex;
  justify-content: center;
  align-items: center;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#rew-button {
  display: flex;
  justify-content: center;
  align-items: center;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  text-decoration: none;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#ffw-button {
  display: flex;
  justify-content: center;
  align-items: center;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  text-decoration: none;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#play-button {
  display: flex;
  justify-content: center;
  align-items: center;
  vertical-align: middle;
  background-color: transparent;
  width: 40px;
  height: 40px;
  text-decoration: none;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
  padding-top: 0%;
}

#go {
  background-color: transparent;
}

#rew {
  background-color: transparent;
}

#ffw {
  background-color: transparent;
}

#play {
  background-color: transparent;
}

#inventory {
  background-color: transparent;
}

#get {
  background-color: transparent;
}

#font {
  background-color: transparent;
}

#speak {
  background-color: transparent;
}

#help {
  background-color: transparent;
}

#about-button {
  text-decoration: none;
  width: 40px;
  height: 50px;
  margin-top: 0%;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 20px;
}

#login-button {
  width: 40px;
  height: 50px;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
}

#uname {
  width: 100%;
  padding: 6px;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  font-size: 30px;
  margin-top: 0%;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
}

#psw {
  width: 100%;
  padding: 6px;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  font-size: 30px;
  margin-top: 0%;
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 0%;
}

.illustration {
  padding-left: 10px;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: block;
  width: 250px;
}

.illustration.left {
  padding-left: 0px;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: block;
  width: 250px;
}

.video-thumb {
  width: 180px;
  display: block; /* ensures the hover area is just the image */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
}

/* The side navigation menu */
.sidenav {
  height: 100%; /* 100% Full-height */
  width: 0; /* 0 width - change this with JavaScript */
  position: fixed; /* Stay in place */
  z-index: 1; /* Stay on top */
  top: 0; /* Stay at the top */
  left: 0;
  background-color: rgb(233, 221, 153);
  overflow-x: hidden; /* Disable horizontal scroll */
  padding-top: 60px; /* Place content 60px from the top */
  transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
}

/* The navigation menu links */
.sidenav a {
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 18px;
  color: #635f5f;
  display: block;
  transition: 0.3s;
}

/* When you mouse over the navigation links, change their color */
.sidenav a:hover {
  color: rgb(233, 221, 153);
}

/* Position and style the close button (top right corner) */
.sidenav .closebtn {
  position: absolute;
  color: #635f5f;
  top: 0;
  right: 25px;
  font-size: 16px;
  margin-top: 10px;
  margin-left: 10px;
}

/* Tooltip handling for any container */
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  text-align: center;
  border-radius: var(--border-radius-small);
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Style page content - use this if you want to push the page content to the right when you open the side navigation */
#main {
  transition: margin-left 0.5s;
  padding: 20px;
}

.help-viewport {
  min-height: 100vh;
  display: flex;
  align-items: center;
  vertical-align: top;
  justify-content: center;
  padding: 40px 0;
  box-sizing: border-box;
  border: none !important;
  box-shadow: none !important;
}

#help-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: calc(100vh - 60px);
  width: 95%;
  padding: 0;
  box-sizing: border-box;
  margin: 0;
  overflow-y: auto;
  border: 1px solid #000;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  background: white;
}

.help-heading {
  font-size: 26px;
  font-weight: bold;
  margin-bottom: 1em;
}

.help-subheading {
  font-size: 20px;
  font-weight: bold;
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

#help-sidenav {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 10px;
  left: 10px;
  border-radius: var(--border-radius);
  padding: 22px 16px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
  background-color: whitesmoke;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
  overflow-y: auto;
  max-height: 90vh;
}

#help-open-toggle {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

#help-sidenav a {
  font-size: 16px;
  padding: 6px 0;
  text-decoration: none;
  transition: color 0.2s ease;
}

#help-sidenav a:hover {
  color: #229c93;
  font-weight: bold;
}

#help-sidenav.collapsed {
  transform: translateX(-105%);
  transition: transform 0.3s ease-in-out;
  left: 5px;
}

.help-link {
  color: #0b4a4a;
  font-weight: bold;
  text-decoration: underline;
  margin-left: 1em;
}

#help-close-btn {
  font-size: 2rem;
  background-color: #eee;
  color: #333 !important;
  border: 1px solid #aaa;
  padding: 6px 10px;
  margin-bottom: 12px;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  align-self: flex-end;
}

/* Fix: Shrink close-help-modal button and right-align it */
#close-help-modal {
  font-size: 1.4rem;
  background-color: #eee;
  color: #333 !important;
  border: 1px solid #aaa;
  padding: 4px 10px;
  margin: 8px;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 100px;
  z-index: 1001;
}

.open-nav-btn {
  background-color: #eee;
  color: #222;
  font-family: Georgia, serif;
  font-size: 16px;
  padding: 6px 12px;
  margin: 10px;
  border: 1px solid #aaa;
  border-radius: var(--border-radius-small);
  cursor: pointer;
}

.open-nav-btn:hover {
  background-color: #ddd;
}

/* Help Modal Styling */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  position: relative;
  width: 90vw;
  height: 90vh;
  border: none !important;
  overflow: hidden;
  box-shadow: none !important;
  outline: none !important;
  background-color: transparent !important;
}

.modal-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  box-shadow: none;
  display: block;
  background-color: transparent;
}

.help-iframe {
  border:none;
  box-shadow: none;
}

.modal-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: #ccc;
  border: none;
  font-size: 24px;
  color: black;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 10;
}

/* Ensure buttons can host pseudo-elements */
#sound,
#mute {
  position: relative;
  z-index: 1;
}

#mute::after,
#sound::after {
  transition: box-shadow 0.25s ease-in-out;
}

/* 🔊 🎤 Waiting halo */
#mute.mic-waiting::after,
#sound.speaker-waiting::after {
  content: "";
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 55, 0.6) 0%,
    rgba(255, 0, 55, 0.2) 50%,
    rgba(255, 0, 55, 0.0) 100%
  );
  filter: blur(5px);
  z-index: 0;
  pointer-events: none;
}

/* Both halo */
#mute.mic-active::after,
#sound.speaker-active::after {
  content: "";
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(50, 255, 50, 0.9) 0%,
    rgba(50, 255, 50, 0.6) 30%,
    rgba(50, 255, 50, 0.3) 60%,
    rgba(50, 255, 50, 0.0) 100%
  );

  box-shadow:
    0 0 4px 2px rgba(0, 255, 0, 1),
    0 0 6px 3px rgba(50, 255, 50, 0.6),
    0 0 8px 4px rgba(50, 255, 50, 0.2);

  filter: blur(2px); /* softens gradient only */
  animation: pulseFillPower 1.2s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes pulseFillPower {
  0% {
    transform: scale(1);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 0.95;
  }
}

#muteTogglePic.glow-ring {
  animation: pulseRing 1.2s infinite ease-in-out;
  box-shadow: 0 0 12px 4px rgba(0, 191, 255, 0.9); /* tuned for blue */
}

#speakerPic.glow-ring {
  animation: pulseRing 1.2s infinite ease-in-out;
  box-shadow: 0 0 12px 4px rgba(0, 191, 255, 0.9); /* tuned for blue */
}

#media-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background-color: rgba(0, 0, 0, 0.25); /* transparent, not black */
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.75s ease-in-out;
  backdrop-filter: none;              /* ensure no blur */
  pointer-events: all;               /* allow clicks to pass if needed */
}

#overlay-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-height: 90vh;
}

#popup-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#popup-image {
  float: none !important;
  margin: 0 auto;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  cursor: pointer;
}

#media-overlay.small-modal #popup-image {
  max-width: 450px !important;
  max-height: 450px !important;
  width: auto !important;
  height: auto !important;
}

.assistant-command-box {
  font-family: monospace;
  font-size: 0.85em;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  padding: 6px;
  margin-top: 8px;
  border-radius: var(--border-radius-small);
  max-height: 120px;
  overflow-y: auto;
}

.assistant-command {
  margin: 4px 0;
  white-space: pre-wrap;
  border: 2px solid var(--border-color);
  box-shadow: 0 0 10px var(--scrollbar-color);
  padding: 4px 6px;
  border-radius: 4px;
}

#assistant-actions,
#commandBox {
  display: none;
}

/* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */
@media screen and (max-height: 700px) {
  .sidenav {
    padding-top: 15px;
  }
  .sidenav a {
    font-size: 18px;
  }
  #convoCell {
    display: none !important;
  }
  #mute.mic-waiting::after,
  #sound.speaker-waiting::after {
    bottom: 2px;
  }
}

@media (max-width: 768px) {
  #imageModalContainer {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    padding: 8px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.2); /* optional soft backdrop */
  }

  #imgModal {
    width: 100%;
    max-width: 95vw;
    max-height: 95vh;
    border-radius: var(--border-radius);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
  }

  #modalContentRow {
    flex-direction: column !important;
    gap: 12px;
    width: 100%;
  }

  #convoCell,
  #rightColumn {
    max-width: 100% !important;
    min-width: 100% !important;
    padding: 0;
    margin: 0;
  }

  #mediaContainer {
    max-height: 40vh;
    overflow: hidden;
  }

  #muteTogglePic,
  #speakerPic {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  #mute.mic-waiting::after,
  #sound.speaker-waiting::after {
    bottom: 2px;
  }

  #imageDisplay,
  #videoDisplay {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  #image-dialog {
    width: 100%;
    font-size: 16px;
    min-height: 80px;
    resize: vertical;
    margin-top: 8px;
    box-sizing: border-box;
  }

  #controlsBelow {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    min-height: 64px; /* force vertical breathing room */
  }

  #controlsBelow button {
    width: 48px;
    height: 48px;
    margin: 4px;
  }

  #controlsBelow button img {
    width: 48px;
    height: 48px;
  }

  /* ⛔ Override for #trafficLight — make it smaller again */
  #controlsBelow #trafficLight {
    width: 12px;
    height: 12px;
    margin-bottom: 6px;
  }

}

@media (max-width: 768px) {
  #media-overlay {
    flex-direction: column;
    padding: 8px;
  }

  #media-overlay.small-modal {
  max-width: 60vw;
  max-height: 60vh;
  }

  #popup-image {
    max-width: 100%;
    max-height: 80vh;
  }
}

@media (max-width: 768px) {
  html, body {
    padding: 0;
    margin: 0;
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 0;
  }

  #image-label {
    font-size: 16px;
    text-align: center;
    width: 100%;
  }

  #controlsBelow input[type="range"] {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  #controlsBelow span {
    font-size: 12px;
    margin-top: 4px;
    text-align: center;
  }

  #mic {
    order: -1;
    align-self: center;
  }

  #micPic {
    width: 100%;
    height: auto;
  }

}

@media (max-width: 768px) {
  body[data-theme="normal"] {
    --font-size: 15px;
    --scrollbar-width: 10px;
    --block-cursor-width: 0.375em;
  }

  body[data-theme="eighties"] {
    --font-size: 17px;
    --scrollbar-width: 12px;
    --block-cursor-width: 1ch;
  }

  body[data-theme="eighties"] .theme-button {
    background: #070;
  }

  body[data-theme="eighties"] .block-cursor {
    background: limegreen;
  }
}

@media (max-width: 768px) {
  .app {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: auto;
    overflow-x: hidden;
  }

  #app-box {
    max-height: none;
    border: 2px solid var(--border-color);
    box-shadow: 0 0 10px var(--scrollbar-color);
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  #column1,
  #column2,
  #column3 {
    width: 100% !important;
    float: none;
    display: block;
    padding: 0 10px;
    box-sizing: border-box;
  }

  #top_span {
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
  }

  #entry-box {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    box-shadow: 0 0 10px var(--scrollbar-color);
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 10px;
  }

  #input-box {
    width: 100%;
    font-size: 16px;
    min-height: 80px;
    max-height: 160px;
    line-height: 1.4;
    white-space: pre-wrap;
    border: 2px solid var(--border-color);
    box-shadow: 0 0 10px var(--scrollbar-color);
    padding: 8px;
    margin-top: 10px;
    resize: vertical;
    box-sizing: border-box;
    border-radius: var(--border-radius-small);
  }

  #buttonContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 0px;
    padding-top: 26px;
    width: 100%;
    margin-top: 12px;
  }

  #buttonContainer button {
    flex: 0 0 40px;
    max-height: 40px;
    width: 36px;
    padding: 0px 0;
    margin: 0px;
    background: transparent;
    border: none;
  }

  #buttonContainer button,
  #buttonContainer img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
  }

  #select-box {
    width: 100% !important;
    padding: 10px;
    border: 2px solid var(--border-color);
    box-shadow: 0 0 10px var(--scrollbar-color);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100px;
    max-height: 40vh;
    margin-top: 70px; /* keeps room for #entry-box below */
  }

  /* Optional: hide (no items) when empty */
  #select-box:empty::before {
    content: "(no items)";
    color: #888;
    display: block;
    text-align: center;
    padding: 8px;
  }

  #entry-box {
    position: relative;
    z-index: 10;
  }

  #story-box,
  #message-box {
    width: 100% !important;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  #message-box a {
    display: inline-block;
    margin: 6px;
    text-decoration: none;
  }

  #messages {
    font-size: 14px;
  }

  .messageBox-image {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    display: block;
    border-radius: var(--border-radius-small);
    object-fit: contain;
  }

  .messageBox-image:hover {
    box-shadow: 0 0 8px rgba(0, 150, 255, 0.4);
    transition: box-shadow 0.2s ease;
  }

}

@media screen and (max-width: 768px) {
  #help-sidenav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: auto;
    border-bottom: 1px solid #ccc;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 9999;
  }

  #help-sidenav a {
    display: block;
    padding: 10px 12px;
    margin: 4px 0;
    font-size: 18px;
    border-radius: var(--border-radius-small);
    text-align: left;
    border: 1px solid #ccc;
    text-decoration: none;
  }

  #help-sidenav a:hover {
    background-color: #e0f7f7;
    color: #007d7d;
  }

  #story-box-help {
    font-size: 16px;
    line-height: 1.5;
    padding: 10px;
  }

  .open-nav-btn {
    font-size: 14px;
    padding: 4px 8px;
  }
}

@media screen and (orientation: landscape) and (max-width: 900px) {
  #help-viewport {
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    box-sizing: border-box;
  }

  #help-wrapper {
    margin: 0 auto;
    height: 100vh;
    max-height: 100vh;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  #story-box-help {
    height: 100%;
    max-height: 100%;
    margin: 0 auto;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
  }

  #select-box {
    min-height: 800px; /* or however tall the inventory might become */
  }

  /* HIDE the side nav and toggle button */
  #help-sidenav,
  #help-close-btn,
  .open-nav-btn {
    display: none !important;
    visibility: hidden;
    height: 0;
    width: 0;
    overflow: hidden;
  }
}

/* ======== FONT SIZE CONTROL VIA DATA ATTRIBUTE ======== */

body[data-font="small"] {
  --font-size: 1rem;         /* 16px baseline */
  --title-size: 1.5rem;      /* 150% */
  --author-size: 1.25rem;    /* 125% */
}

body[data-font="medium"] {
  --font-size: 1.375rem;     /* 22px */
  --title-size: 1.75rem;
  --author-size: 1.5rem;
}

body[data-font="large"] {
  --font-size: 1.625rem;     /* 26px */
  --title-size: 2rem;
  --author-size: 1.75rem;
}
