/* =========================================
   1. BASE & GLOBAL VARIABLES
   ========================================= */
body {
	margin: 0;
	padding: 0;
	background-color: transparent;
	cursor: url('assets/cursor.gif'), auto;
	overflow: hidden;
	height: 100vh;
	font-family: 'VT323', monospace;
	font-size: 22px;
	color: #333;
}

#minesweeper-bg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	background-color: #d3e3ba;
	background-image:
		linear-gradient(#6d8d39 1px, transparent 1px),
		linear-gradient(90deg, #6d8d39 1px, transparent 1px);
	background-size: 20px 20px;
}

h1 {
	font-family: 'Press Start 2P', cursive;
	font-size: 18px;
	color: #a14c00;
	border-bottom: 1px dashed #bb6a18;
	padding-bottom: 10px;
}

a {
	color: #a14c00;
	text-decoration: none;
}

/* =========================================
   2. ANIMATIONS & EFFECTS
   ========================================= */
@keyframes float {
	0% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-15px);
	}

	100% {
		transform: translateY(0);
	}
}

.banner,
#floatin {
	animation: float 5s ease-in-out infinite;
}

.banner {
	position: relative;
	font-family: 'Press Start 2P', cursive;
	font-size: 22px;
	color: #a14c00;
	text-shadow: 1px 1px 0px #fff, -1px -1px 0px #fff, 1px -1px 0px #fff, -1px 1px 0px #fff;
	text-align: center;
	user-select: none;
	top: 7px;
	cursor: url('assets/cursor.gif'), auto;
}

.overlap a img,
.whee {
	transition: transform 1s ease-in-out;
}

.overlap a img:hover,
.whee:hover {
	transform: rotate(360deg);
}

/* =========================================
   3. MAIN DESKTOP WINDOW LAYOUT
   ========================================= */
#myWindow {
	position: absolute;
	display: flex;
	z-index: 100;
	will-change: transform;
}

.overlap {
	display: flex;
	position: absolute;
	top: 30px;
	left: 30px;
	right: 440px;
	text-align: center;
	height: 50px;
	width: 300px;
	margin: auto;
	z-index: 11;
	pointer-events: none;
	transform: translateY(-30px);
}

.overlap a {
	pointer-events: auto;
}

.window {
	position: absolute;
	top: 60px;
	left: calc(50% - 410px);
	width: 830px;
	min-width: 360px;
	max-width: 95%;
	height: 630px;
	min-height: 480px;
	display: flex;
	flex-direction: column;
	border-radius: 15px;
	box-shadow: 5px 30px 20px rgba(0, 0, 0, 0.5);
	background-color: #fbf5df;
	z-index: 10;
}

header {
	background: linear-gradient(90deg, #ede0b2 0%, #e3d29a 100%);
	height: 70px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid #bb6a18;
	border-top-left-radius: 15px;
	border-top-right-radius: 15px;
	cursor: move;
	user-select: none;
}

header:active {
	cursor: grabbing;
}

footer {
	background: linear-gradient(90deg, #ede0b2 0%, #e3d29a 100%);
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-top: 1px solid #bb6a18;
	border-bottom-left-radius: 15px;
	border-bottom-right-radius: 15px;
	font-family: 'Press Start 2P', cursive;
	font-size: 10px;
	color: #a14c00;
}

.main {
	display: flex;
	flex: 1;
	overflow: hidden;
}

.content {
	flex: 1;
	height: 100%;
	width: 100%;
	display: flex;
	flex-direction: row;
	overflow: hidden;
}

.inner {
	width: 100%;
	height: 100%;
	padding: 20px;
	margin: 0;
	overflow-y: auto;
	background: transparent;
}

/* Scrollbars */
.inner::-webkit-scrollbar {
	width: 12px;
}

.inner::-webkit-scrollbar-track {
	background: #cd7c00;
}

.inner::-webkit-scrollbar-thumb {
	background-color: #a14c00;
	border-radius: 6px;
}

.inner::-webkit-scrollbar-thumb:hover {
	background-color: #8a3f00;
}

/* =========================================
   4. SIDEBAR & NAVIGATION (Desktop)
   ========================================= */
.sidebar {
	display: flex;
	flex-direction: column;
	width: 180px;
	height: 480px;
	margin-top: auto;
	margin-right: 15px;
	overflow: hidden;
}

.menu {
	width: 120px;
	height: 100%;
	flex-shrink: 0;
	background: linear-gradient(180deg, rgba(252, 221, 165, 1) 0%, rgba(251, 245, 223, 1) 40%, rgba(251, 245, 223, 1) 100%);
	border-right: 1px solid #bb6a18;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 5px;
	text-align: center;
	overflow: hidden;
}

.menu-item {
	height: 75px;
	width: 50px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 5px 0 0px 0;
	margin-bottom: 25px;
}

.menu-item a {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.menu-item a img {
	margin-bottom: 5px;
	height: 40px;
	width: 40px;
	transition: transform 1s ease-in-out;
}

.menu-item:hover img {
	transform: rotate(360deg);
}

.menu a {
	font-family: 'Press Start 2P', cursive;
	font-size: 12px;
	line-height: 20px;
	text-shadow: 0px 2px 2px rgba(161, 76, 0, 0.5);
	cursor: url('assets/hover.gif'), auto;
}

.menu a:hover,
.menu-item:hover a,
.inner a:hover {
	color: #ffda45;
	cursor: url('assets/hover.gif'), auto;
	text-shadow: 0 0 1px #ffbe41, 0 0 2px #ffb628, 0 0 4px #ffaf15, 0 0 8px #eb9b00, 0 0 24px #e38118;
}

/* =========================================
   5. DECORATIVE (Bio & Fireplace)
   ========================================= */
.about {
	background-color: #e3d29a;
	border: 2px solid #eb9b00;
	border-radius: 4px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 260px;
	overflow-y: auto;
	scrollbar-width: auto;
	scrollbar-color: #a14c00 #ede0b2;
}

.about::-webkit-scrollbar {
	width: 12px;
}

.about::-webkit-scrollbar-track {
	background: #ede0b2;
}

.about::-webkit-scrollbar-thumb {
	background-color: #a14c00;
	border: 2px solid #ede0b2;
}

.about h2 {
	margin: 0px;
}

.about p {
	margin: 2px;
}

.fireplace {
	margin-top: auto;
	margin-bottom: auto;
	margin-left: 0px;
	height: 160px;
	background-color: #cee0b3;
	border: 3px dashed #6d8d39;
	border-radius: 2px;
	display: flex;
	justify-content: center;
	cursor: url('assets/hover.gif'), auto;
}

.fireplace img {
	max-height: 90%;
	transition: filter 0.3s ease;
}

.fireplace:hover img {
	filter: drop-shadow(0 0 12px #ffda45) brightness(1.5);
}

/* =========================================
   6. CHAT COMPONENTS
   ========================================= */
.chat-container {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 350px;
	border: 2px solid #bb6a18;
	background-color: #fbf5df;
	box-sizing: border-box;
}

.chat-messages,
#chatMessages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	padding: 10px;
	font-family: 'VT323', monospace;
	font-size: 16px;
	line-height: 1.1;
	background-color: #fbf5df;
}

.message {
	display: flex !important;
	flex-direction: row !important;
	align-items: center;
	flex-wrap: wrap;
	width: 99%;
	padding: 2px 1px;
	margin-bottom: 2px;
	background-color: #cee0b3;
	border: 2px solid #6d8d39;
	font-family: 'VT323', monospace;
}

.message.sent {
	align-self: flex-end;
	background-color: #e3d29a;
	border: 1px solid #bb6a18;
}

.message.system-msg {
	background-color: rgba(0, 0, 0, 0.05) !important;
	border: 1px dashed #bb6a18 !important;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	font-style: italic;
}

.message.system-msg .chat-username,
.message.system-msg .chat-text {
	color: #555 !important;
}

.chat-timestamp {
	font-size: 14px;
	color: #bb6a18;
	margin-right: 8px;
	white-space: nowrap;
}

.chat-username {
	font-size: 16px;
	font-weight: bold;
	color: #8a3f00;
	margin-right: 5px;
}

.chat-text {
	font-size: 18px;
	display: inline;
	color: #526436;
	flex: 1;
	word-break: break-word;
}

/* Inputs & Buttons */
#authArea {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	padding: 5px;
}

#authArea input {
	flex: 1 1 40%;
	min-width: 100px;
}

#authArea button {
	flex: 1 1 20%;
	min-width: 60px;
	cursor: pointer;
}

.chat-input-area {
	display: flex;
	flex-direction: row;
	gap: 5px;
	padding: 5px;
	background-color: #ede0b2;
	border-top: 2px solid #bb6a18;
}

.chat-input-area input {
	flex: 1;
	padding: 5px;
	font-family: 'VT323', monospace;
	font-size: 18px;
	border: 2px inset #bb6a18;
	background-color: #fff;
	outline: none;
}

.chat-input-area button {
	margin-left: 5px;
	padding: 5px 20px;
	font-family: 'Press Start 2P', cursive;
	font-size: 10px;
	cursor: url('assets/hover.gif'), auto;
	border: 2px outset #bb6a18;
	background-color: #a14c00;
	font-family: 'VT323', monospace;
	font-size: 17px;
	color: #e3d29a;
}

.chat-input-area button:active {
	border-style: inset;
}

.delete-btn {
	margin-left: 8px;
	padding: 1px 4px;
	font-family: 'Press Start 2P', cursive;
	font-size: 8px;
	cursor: url('assets/hover.gif'), auto;
	border: 1px outset #bb6a18;
	background-color: #a14c00;
	color: #e3d29a;
	vertical-align: middle;
	line-height: 1;
}

.delete-btn:hover {
	background-color: #ff0000;
	color: #fff;
}

.delete-btn:active {
	border-style: inset;
}

/* =========================================
   7. MOBILE OVERRIDES (Max 768px)
   ========================================= */

@media (max-width: 768px) {
  /* 1. Nuke the decorative fluff */
  #minesweeper-bg, .fireplace, .about, .banner, .overlap {
    display: none !important;
  }

  body { 
    overflow: auto; 
    background-color: #fbf5df; 
  }

  /* 2. Main Window: Stack vertically (Header -> Content -> Footer) */
  .window, #myWindow {
    position: relative !important; 
    top: 0 !important; left: 0 !important;
    display: flex !important;
    flex-direction: column !important; /* Fixes the footer on the side issue */
    width: 100vw !important; 
    max-width: 100vw !important; 
    height: 100vh !important; 
    margin: 0 !important; padding: 0 !important;
    border: none !important; border-radius: 0 !important; box-shadow: none !important;
  }

  header { border-radius: 0 !important; cursor: default !important; height: 50px; flex-shrink: 0; }
  footer { border-radius: 0 !important; width: 100% !important; flex-shrink: 0; }

  /* 3. Content Area: Side-by-Side (Menu Left, Chat Right) */
  .main, .content {
    display: flex !important;
    flex-direction: row !important; 
    flex: 1 !important; /* Fill space between header and footer */
    width: 100vw !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* 4. Restore the 60px Icon Menu */
  .sidebar, .menu {
    width: 60px !important;
    min-width: 60px !important;
    height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .menu {
    border-right: 2px solid #bb6a18 !important;
    padding: 10px 0 !important;
    align-items: center;
    justify-content: flex-start;
  }

  .menu-item { margin-bottom: 25px !important; height: auto !important; width: 100% !important; padding: 0 !important; }
  .menu-item img { width: 32px !important; height: auto !important; margin: 0 auto !important; }
  .menu-item a span, .sidebar span { display: none !important; } /* Hide "HOME" text */

  /* 5. Chat Area (Fills the remaining width perfectly) */
  .inner { 
    flex: 1 !important; 
    width: calc(100vw - 60px) !important; 
    padding: 5px !important; 
    display: flex !important; 
    flex-direction: column !important; 
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  
  .chat-container { 
    width: 100% !important;
    flex: 1 !important; 
    height: auto !important; 
    min-height: 60vh !important; 
    border: 2px solid #bb6a18 !important; 
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .chat-messages, #chatMessages { width: 100% !important; box-sizing: border-box !important; flex: 1; }
  .message { width: 100% !important; box-sizing: border-box !important; }
  .chat-text { flex: 1 !important; word-break: break-word !important; }

  /* 6. Fix the 88x31 Retro Banners */
  .inner img, .content img {
    width: auto !important;
    max-width: 88px !important; 
    height: auto !important;
    display: inline-block !important;
    margin: 5px 0 !important;
  }

  /* 7. Tap-friendly Auth Areas & Chat Input */
  #authArea { 
    /* Let JavaScript handle the 'display' property! */
    flex-direction: row !important; 
    flex-wrap: wrap !important; 
    gap: 5px !important;
    padding: 5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  #authArea input { 
    flex: 1 1 100% !important; 
    box-sizing: border-box !important; 
    padding: 8px !important; 
    font-size: 16px !important; 
    margin: 0 !important;
  }
  
  #authArea button { 
    flex: 1 1 45% !important; 
    box-sizing: border-box !important; 
    padding: 10px !important; 
    font-size: 12px !important; 
    margin: 0 !important;
    display: block !important; 
  }

  .chat-input-area, #chatForm { 
    /* Let JavaScript handle the 'display' property! */
    flex-direction: row !important;
    width: 100% !important; 
    box-sizing: border-box !important; 
    padding: 5px !important;
  }
  
  .chat-input-area input { 
    flex: 1 !important; 
    font-size: 16px !important; 
    width: auto !important;
    box-sizing: border-box !important; 
  }
  
  .chat-input-area button {
    width: auto !important;
    padding: 5px 2px !important;
    margin-left: 0px !important;
	  font-family: 'VT323', monospace;
	  font-size: 14px;
  }
}