/* z-index */
#gameOverMsg { z-index: 10; }
#boatGamePrompt { z-index: 12000; }
#browserBoatGame { z-index: 10000; }
#livesContainer { z-index: 15000; }
#crptdBoatGame { z-index: 15000; }
.popup { z-index: 21000; }
#libraryPopup { z-index: 19000; }
#untitledPopup { z-index: 22000; }
#signInPage { z-index: 20000; }
.fullScreenView { z-index: 20000; }

/* color palette */
:root {
  --bg-desktop: #55aaaa;
  --bg-desktop-hover: #289999;
  --bg-header: #2809bc;
  --bg-ribbon: #e0e0e0;
  --bg-hover: #b9b9b9;
  --text-muted: #888;
  --bg-text-light: #fff;
  --border-dark: #222;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'W95FA', monospace;
  caret-color: transparent;
  image-rendering: pixelated;
}

html, body {
  height: 100%;
  color: #000;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

.restartButton {
  max-width: fit-content;
  padding: 5px 10px;
  background-color: var(--bg-ribbon);
  border: 2px solid var(--border-dark);
  font-weight: bold;
}

.icons {
  display: flex;
  text-align: center;
  margin: 10px;
}

.icons:hover {
  background-color: var(--bg-hover);
}

.icons img {
  width: 100px;
  height: 100px;
}

.iconNames {
  margin-top: 5px;
  padding-bottom: 5px;
}

#desktopView {
  background-color: var(--bg-desktop);
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: start;
}

.desktopIcons:hover {
  background-color: var(--bg-desktop-hover);
}

#taskBar {
  background-color: var(--bg-ribbon);
  height: 5%;
  width: 100%;
  position: absolute;
  bottom: 0;
}

#startButton {
  height: 90%;
  cursor: pointer;
}

#startButton:hover,
.ribbonButtons:hover,
.ribbonIcons:hover {
  background-color: var(--bg-hover);
}

.popup {
  display: none;
  position: fixed;
  z-index: 20000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 10px 0;
}

.prompt {
  font-size: 35.84px;
  margin: 50px 10px 50px 250px;
}

#systemErrorPrompt {
  color: #f00;
  animation: glitch 0.8s ease-in-out 1;
}

@keyframes glitch {
  0% { text-shadow: 2px 0 red; }
  20% { text-shadow: -2px 0 blue; }
  40% { text-shadow: 2px 0 green; }
  60% { text-shadow: -2px 0 yellow; }
  80% { text-shadow: 2px 0 purple; }
  100% { text-shadow: -2px 0 orange; }
}

.popupContent,
.libraryContent {
  margin: 10% auto;
  padding: 21px;
  width: 630px;
  height: 370px;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#diaryPopup,
#retreatPictures {
  margin: 12%;
}

.popupContent {
  background-image: url("./icons/error.png");
}

.libraryContent {
  background-image: url("./icons/library menu.png");
  display: flex;
  flex-wrap: wrap;
  align-content: start;
}

.popupHeader {
  width: 100%;
  height: 30px;
  margin: 0 0 20px 15px;
  color: var(--bg-text-light);
  font-size: 22.4px;
}

.closeButton {
  position: absolute;
  font-size: 24px;
  cursor: pointer;
  color: var(--bg-text-light);
}

.popup .closeButton {
  top: 18px;
  right: 20px;
}

.webHeader .closeButton {
  right: 10px;
}

#retreatGallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  overflow-y: auto;
}

#retreatGallery img {
  width: 100px;
  height: 80px;
  border: 2px solid black;
  image-rendering: pixelated;
  cursor: pointer;
  box-shadow: 1px 1px 0px white inset;
}

#retreatGallery img:hover {
  outline: 2px solid #0000ff;
  outline-offset: -2px;
}

.fullScreenView {
  display: none;
  position: fixed;
  z-index: 21000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background-color: var(--bg-text-light);
}

.webHeader {
  background-color: var(--bg-header);
  color: var(--bg-text-light);
  padding: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#webRibbon,
#webRibbonIcons {
  width: 100%;
  height: 40px;
  display: flex;
  background-color: var(--bg-ribbon);
  border: 2px solid #000;
}

#webRibbonIcons {
  border-top: none;
}

#ribbonButtonsContainer,
#ribbonIconsContainer {
  display: flex;
  flex-direction: row;
}

.ribbonButtons,
.ribbonIcons {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-ribbon);
  border: 1px solid #545659;
  border-top-color: #f4f5f6;
  border-left-color: #f4f5f6;
  cursor: pointer;
}

.ribbonButtons {
  width: 100px;
  min-width: 70px;
}

.ribbonIcons {
  width: 50px;
}

.ribbonIconImg {
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}

.docGameArea {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  padding-top: 40px;
}

#docContainer {
  width: 1000px;
  height: 800px;
  padding: 15px;
  background-color: var(--bg-text-light);
  border: 2px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.typing-container {
  position: relative;
  width: 100%;
}

/* guide text */
.guideText {
  position: absolute;
  top: 0;
  left: 0;
  color: #048dcc;
  pointer-events: none;
  user-select: none;
  white-space: pre-wrap;
  width: 100%;
  z-index: 1;
}

/* Editable line */
.editableLine {
  position: relative;
  background: transparent;
  color: var(--border-dark);
  z-index: 2;
  width: 100%;
  border-bottom: 1px solid var(--text-muted);
  outline: none;
  caret-color: #f00;
}

.lockedLine {
  color: #000;
  pointer-events: none;
}

.hidden {
  display: none;
}

.finalMessage {
  margin-top: 20px;
  font-style: italic;
  color: #555;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.finalMessage.visible {
  opacity: 1;
}

.errorLine {
  color: #f00;
  animation: shake 0.3s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

#livesContainer {
  z-index: 15000;
  top: 200px;
  left: 5vw;
  width: 200px;
  height: 450px;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 8px;
}

.lives-sprite {
  width: 100px;
  height: auto;
  display: block;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#webSearchBar {
  padding: 10px;
  background: var(--bg-ribbon);
  display: flex;
  align-items: center;
  gap: 10px;
}

#searchInput {
  width: 100%;
  flex: 1;
  padding: 5px;
  font-size: 16px;
  border: 1px solid var(--text-muted);
  border-radius: 4px;
}

#searchLogo img {
  display: block;
  margin: 150px auto 0 auto;
  width: 500px;
  height: auto;
  border: 4px solid var(--border-dark);
}

/* BOAT GAME */
b {
  font-weight: bold;
  font-size: larger;
}

#browserBoatGame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: var(--bg-text-light);
}

#gameArea {
  position: relative;
  max-width: 1000px;
  height: 400px;
  margin: 150px auto 0 auto;
  background-image: url("./icons/boat game bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 4px solid #222;
  overflow: hidden;
}

#boatGamePrompt {
  position: absolute;
  top: 40%;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 1.5em;
  color: #222;
  z-index: 12000;
}

#boat {
  position: absolute;
  left: 40px;
  width: 200px;
  height: auto;
  z-index: 2;
}

#boat img {
  width: 100%;
  height: auto;
  display: block;
}

.obstacle {
  position: absolute;
  width: 100px;
  height: 100px;
  left: 600px;
  z-index: 1;
}

#gameOverMsg {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: var(--bg-text-light);
  font-size: 2em;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 10;
  flex-direction: column;
}

#gameOverMsg button {
  margin-top: 20px;
  font-size: 1em;
  padding: 10px 20px;
  border: none;
  background: var(--bg-text-light);
  color: var(--border-dark);
  cursor: pointer;
  border-radius: 6px;
}

#instructions {
  text-align: center;
  margin-top: 20px;
  color: var(--border-dark);
  font-size: 1.1em;
}

/* Main container */
#signInPage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  overflow-x: auto;
  background-image: url('./icons/bg.png');
  background-size: cover;
  background-position: center;
  z-index: 20000;
}

/* Left side with logo */
#signInLeft {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: url('./icons/logo.png');
  background-size: cover;
  background-position: center;
}

/* Right side with avatar and sign-in */
#signInRight {
  height: 200px;
  width: 600px;
  position: absolute;
  top: 40%;
  right: 0;
  background-image: url(./icons/user.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 21000;
}

#signInButton {
  height: 100px;
  width: 250px;
  position: relative;
  top: 75%;
  right: -46%;
  padding: 10px 20px;
  background-image: url('./icons/sign in btn.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  z-index: 21000;
}

#crptdBoatGame {
  z-index: 15000;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-text-light);
}

#crptdBoatGame #gameArea {
  pointer-events: none;
  filter: grayscale(100%) contrast(150%);
}

.final-message {
  opacity: 0;
  transition: opacity 1s;
}

.final-message.visible {
  opacity: 1;
}

#cutsceneVideo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 50000;
  background: black;
  display: none;
  cursor: none;
}