/* Yavar design tokens and base styles */
:root {
  --color-xlarthqll-gold: #c7a465;
  --color-hubland-stone: rgba(10, 8, 6, 0.92);
  --color-hubland-stone-bg: #2a1f15;
  --color-parchment: #d8c8a0;
  --color-border-dark: #3a1d0d;
  --color-border-darker: #5c2018;
  --color-accent-blood: #aa0000;
  --color-shadow-glow: rgba(170, 0, 0, 0.5);
  --font-serif: 'IM Fell English', serif;
  --font-display: 'Sevesbrg', 'UnifrakturMaguntia', cursive;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-serif);
  background: #000;
  color: var(--color-parchment);
  margin: 0;
  min-height: 100vh;
  padding-bottom: 70px;
  cursor: auto;
}

@media (min-width: 768px) {
  body {
    cursor: url('/cursor (1).cur') 0 0, url('/cursor (1).png') 0 0, auto;
  }
}

a, button, [href], [onclick] {
  cursor: auto;
}

@media (min-width: 768px) {
  a, button, [href], [onclick] {
    cursor: url('/cursor1.cur') 0 0, url('/cursor1.png') 0 0, pointer !important;
  }
}

#main-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 15px 25px;
  border-bottom: 1px solid var(--color-border-darker);
  margin: 0 0 30px;
  flex-wrap: wrap;
  background: var(--color-hubland-stone);
}

#main-nav a {
  color: var(--color-parchment);
  text-decoration: none;
  transition: color 0.4s ease, text-shadow 0.4s ease;
  font-size: 1.1rem;
}

#main-nav a:hover {
  color: var(--color-xlarthqll-gold);
  text-shadow: 0 0 8px var(--color-xlarthqll-gold);
}

header {
  padding: 0;
}

header video {
  width: 100%;
  height: auto;
  display: block;
}

#spa-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
  background: transparent;
}

/* Background video mirrors legacy site */
#bgVideo {
  position: fixed;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  top: 0;
  left: 0;
  transform: translateZ(0);
}

/* Ensure internal semantic padding mirrors the legacy site */
main article, .wax-seal-container, .omni-console, .portal-links {
  padding: 0 25px;
}

header, main { padding: 0; }

/* media and content helpers */
.animated-media { width: 100%; height: auto; display: block; transform: translateZ(0); image-rendering: crisp-edges; will-change: contents; }
@media (max-width: 600px) { .animated-media { image-rendering: auto; } }

/* Home content flexbox for mobile reordering */
.home-content {
  display: flex;
  flex-direction: column;
}

.home-video-second {
  order: 1;
}

.home-article {
  order: 2;
}

.wax-seal-container {
  order: 3;
}

.portal-links {
  order: 5;
}

.omni-console {
  order: 4;
}

@media (max-width: 768px) {
  .home-article {
    order: 1;
  }
  
  .home-video-second {
    order: 2;
  }
  
  .wax-seal-container {
    display: none;
  }
  
  .portal-links {
    order: 5;
  }
  
  .omni-console {
    order: 4;
  }
}

.wax-seal { width: 80px; transition: filter 0.4s ease; }
.wax-seal:hover { filter: drop-shadow(0 0 12px var(--color-xlarthqll-gold)); }

.omni-console { text-align: center; padding-top: 40px; padding-bottom: 40px; border-top: 1px dashed var(--color-border-darker); border-bottom: 1px dashed var(--color-border-darker); margin-top: 30px; }

.omni-artifact {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--color-border-darker) 0%, #000 70%);
  border: 2px solid var(--color-border-dark);
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  transition: all 0.5s ease;
}

.omni-artifact:before, .omni-artifact:after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid transparent;
  top: 0;
  left: 0;
}

.omni-console.awakened .omni-artifact {
  border-color: var(--color-xlarthqll-gold);
  animation: pulse 2s infinite;
}

.omni-console.awakened .omni-artifact:before {
  animation: rotate-rune 20s linear infinite;
  border-top-color: var(--color-xlarthqll-gold);
}

.omni-console.awakened .omni-artifact:after {
  animation: rotate-rune-reverse 20s linear infinite;
  border-bottom-color: var(--color-xlarthqll-gold);
}

.omni-text {
  margin-top: 15px;
  font-style: italic;
  opacity: 0.7;
}

.omni-link {
  display: block;
  margin-top: 20px;
  font-size: 1.5rem;
  font-family: var(--font-display);
  letter-spacing: 2px;
  opacity: 0;
  transition: opacity 1s ease 0.5s;
  color: var(--color-xlarthqll-gold);
  text-decoration: none;
  font-weight: bold;
}

.omni-link:hover {
  color: var(--color-xlarthqll-gold);
  text-shadow: 0 0 12px var(--color-xlarthqll-gold);
}

.omni-console.awakened .omni-link {
  opacity: 1;
}

@keyframes pulse {
  0% { box-shadow: 0 0 5px var(--color-xlarthqll-gold); }
  50% { box-shadow: 0 0 25px var(--color-xlarthqll-gold); }
  100% { box-shadow: 0 0 5px var(--color-xlarthqll-gold); }
}

@keyframes rotate-rune {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotate-rune-reverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* Heading styles to match legacy site */
h2 {
  color: var(--color-accent-blood);
  border-bottom: 1px solid var(--color-border-dark);
  padding-bottom: 5px;
  margin: 40px 0 20px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: 0.5px;
  font-weight: normal;
}

#page-content {
  width: 90%;
  max-width: 700px;
  margin: 0 auto;
  background: var(--color-hubland-stone);
  border-left: 1px solid var(--color-border-dark);
  border-right: 1px solid var(--color-border-dark);
  box-shadow: 0 0 30px #000;
  min-height: 100vh;
}

header video { width: 100%; height: auto; display: block; }

.wax-seal { width: 80px; }

.omni-console { text-align: center; padding: 40px 0; border-top: 1px dashed var(--color-border-darker); border-bottom: 1px dashed var(--color-border-darker); }

.portal-links { text-align: center; margin: 40px 0; }

.portal-button { display:inline-block; background: var(--color-border-darker); border:1px solid var(--color-xlarthqll-gold); color: var(--color-parchment); padding:10px 20px; border-radius:3px; text-decoration:none; }

footer { text-align:center; padding:30px 0; color: rgba(216,200,160,0.7); }
#music-player-root {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #2a1f15;
  color: #d8c8a0;
  padding: 12px 24px;
  z-index: 1000;
  box-shadow: 0 -2px 12px #0005;
  display: flex;
  align-items: center;
  gap: 18px;
}
#music-player-root img {
  width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 2px solid #c7a465;
}
#music-player-root .info {
  flex: 1;
}
#music-player-root .controls button {
  background: #c7a465;
  color: #2a1f15;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  margin: 0 2px;
  font-size: 1.1rem;
  cursor: pointer;
}
#music-player-root .controls button:active {
  background: #aa0000;
  color: #fff;
}

/* Expanded Music Player Overlay */
#music-player-expanded {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}
#music-player-expanded.hidden {
  pointer-events: none;
  opacity: 0;
}
.expanded-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}
.expanded-container {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 80vh;
  background: #2a1f15;
  border: 3px solid #c7a465;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  overflow: hidden;
}
#music-player-expanded:not(.hidden) .expanded-container {
  transform: translateY(0);
}
.close-btn {
  position: absolute;
  top: 15px; right: 15px;
  background: transparent;
  color: #c7a465;
  border: 2px solid #c7a465;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}
.close-btn:hover {
  background: #c7a465;
  color: #2a1f15;
}
.expanded-content {
  display: flex;
  height: 100%;
  gap: 0;
}
.expanded-left {
  flex: 0 0 45%;
  background: #1a140f;
  padding: 50px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 25px;
  border-right: 2px solid #c7a465;
}
#expanded-art {
  width: 280px;
  height: 280px;
  object-fit: cover;
  border: 4px solid #c7a465;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.expanded-info {
  text-align: center;
  color: #d8c8a0;
}
#expanded-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 8px;
  font-family: 'IM Fell English', serif;
}
#expanded-artist {
  font-size: 1.3rem;
  font-style: italic;
  opacity: 0.8;
}
.expanded-controls {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}
.expanded-controls button {
  background: #c7a465;
  color: #2a1f15;
  border: none;
  border-radius: 8px;
  padding: 15px 25px;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.expanded-controls button:hover {
  background: #d8b575;
  transform: scale(1.05);
}
.expanded-controls button:active {
  background: #aa0000;
  color: #fff;
}
#expanded-volume-slider {
  width: 200px;
  margin-top: 10px;
}
.expanded-right {
  flex: 1;
  background: #2a1f15;
  padding: 50px 30px;
  overflow-y: auto;
  color: #d8c8a0;
}
.expanded-right h3 {
  font-family: 'IM Fell English', serif;
  font-size: 1.8rem;
  color: #c7a465;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 2px solid #c7a465;
  padding-bottom: 15px;
}
#playlist-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.playlist-item {
  background: #1a140f;
  padding: 15px 20px;
  border: 2px solid #5c2018;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 15px;
}
.playlist-item:hover {
  border-color: #c7a465;
  background: #241a11;
}
.playlist-item.active {
  border-color: #c7a465;
  background: #c7a465;
  color: #2a1f15;
}
.playlist-item-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #c7a465;
}
.playlist-item-info {
  flex: 1;
}
.playlist-item-title {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.playlist-item-artist {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Responsive Design for Expanded Player */
@media (max-width: 768px) {
  .expanded-content {
    flex-direction: column;
  }
  .expanded-left {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 2px solid #c7a465;
    padding: 30px 20px;
  }
  #expanded-art {
    width: 200px;
    height: 200px;
  }
  #expanded-title {
    font-size: 1.5rem;
  }
  #expanded-artist {
    font-size: 1rem;
  }
  .expanded-right {
    padding: 20px;
  }
}

/* === CHAT PAGE STYLES (90s Retro Aesthetic) === */
.chat-shell {
  background-color: transparent;
  min-height: 100vh;
  position: relative;
  cursor: url('/chatcursor.cur') 0 0, url('/chatcursor.png') 0 0, auto;
  z-index: 2;
}

/* Background video styles for both home and chat */
.bg-video {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: 1;
  pointer-events: none;
}

/* Chat video uses contain to show full video */
#chatBgVideo {
  object-fit: contain;
  z-index: 1;
}

/* Home video uses cover to fill screen */
#bgVideo {
  object-fit: cover;
}

.chat-shell a,
.chat-shell button,
.chat-shell [href],
.chat-shell [onclick] {
  cursor: url('/chatcursor2.cur') 0 0, url('/chatcursor2.png') 0 0, pointer !important;
}

/* Chat retro scrollbar styling */
.chat-shell ::-webkit-scrollbar {
  width: 12px;
}
.chat-shell ::-webkit-scrollbar-track {
  background: #c0c0c0;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
}
.chat-shell ::-webkit-scrollbar-thumb {
  background: #000080;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
}

.chat-page {
  background-color: transparent;
  color: #000;
  font-family: 'Courier New', Courier, monospace;
  position: relative;
}

.panel {
  background-color: #c0c0c0;
  border: 2px solid #000;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF, 4px 4px 0px #000;
  padding: 2px;
  margin: 20px auto;
  width: 90%;
  max-width: 800px;
  position: relative;
  z-index: 10;
}

.chat-header {
  background: #000080 url('/byrd_chat_logo.png') no-repeat center center;
  color: white;
  padding: 50px 25px;
  text-align: center;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
  position: relative;
  border: 2px solid #000;
  margin-bottom: 4px;
  font-family: 'Times New Roman', Times, serif;
  background-size: contain;
}

.chat-nav {
  background-color: #c0c0c0;
  padding: 4px;
  margin: 8px 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  border: 2px solid #000;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF;
}

.chat-nav a {
  color: #000;
  text-decoration: none;
  padding: 6px 12px;
  background-color: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  font-size: 0.9rem;
  font-weight: bold;
  font-family: 'Tahoma', sans-serif;
}

.chat-nav a:hover {
  background-color: #000080;
  color: #fff;
}

.chat-nav a:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.chat-content {
  background-color: #fff;
  padding: 15px;
  margin: 8px 0;
  border: 2px solid #000;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF;
}

.active-users {
  background-color: #000;
  color: #0f0;
  padding: 8px;
  margin: 15px 0;
  font-family: 'Lucida Console', Monaco, monospace;
  border: 2px solid #808080;
  text-shadow: 0 0 5px #0f0;
}

.active-users marquee {
  font-weight: bold;
  font-size: 1.1rem;
}

.cbox-container {
  max-width: 100%;
  height: 400px;
  margin: 20px 0;
  border: 2px solid #000;
  background: white;
  overflow: hidden;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF;
}

.cbox-container iframe {
  border: none;
  width: 100%;
  height: 100%;
}

/* === On-site chat layout === */
.onsite-chat {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  margin: 12px 0;
}

.chat-sidebar {
  background: #d4d0c8;
  border: 2px solid #000;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF;
  padding: 8px;
}

.chat-section-title {
  font-weight: bold;
  margin: 8px 0 6px;
}

.chat-user {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #999;
}

.chat-user-meta { 
  font-family: 'Tahoma', sans-serif;
  flex: 1;
}

.chat-user-name { 
  font-weight: bold;
  font-size: 0.95rem;
}

.chat-user-sub { 
  font-size: 0.75rem; 
  color: #555;
  line-height: 1.3;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #0a0;
  font-weight: bold;
  margin-bottom: 12px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: #0f0;
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 4px #0f0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.chat-user-alert { 
  font-size: 0.9rem; 
  background:#fff; 
  padding:8px; 
  border:1px solid #000;
}

/* Room list */
.chat-rooms {
  margin-bottom: 15px;
}

.chat-room-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.chat-room-item {
  padding: 8px 10px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  cursor: pointer;
  transition: all 0.1s;
  font-family: 'Tahoma', sans-serif;
}

.chat-room-item:hover {
  background: #d4d0c8;
  border-color: #ffffff #404040 #404040 #ffffff;
}

.chat-room-item.active {
  background: #000080;
  color: #ffffff;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}

.chat-room-name {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 2px;
}

.chat-room-desc {
  font-size: 11px;
  opacity: 0.8;
}

.chat-room-item.active .chat-room-desc {
  opacity: 0.9;
}

.chat-online-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.chat-online-item { display: flex; align-items: center; gap: 6px; font-family: 'Tahoma', sans-serif; }

.chat-main {
  background: #ffffff;
  border: 2px solid #000;
  box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #FFFFFF;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  max-height: 50vh;
  scroll-behavior: smooth;
}

.chat-scroll-bottom {
  position: absolute;
  bottom: 60px;
  right: 12px;
  background: #000080;
  color: #fff;
  border: 2px solid #000;
  padding: 8px 16px;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  z-index: 10;
  animation: bounce 2s infinite;
}

.chat-scroll-bottom.hidden {
  display: none;
}

.chat-scroll-bottom:hover {
  background: #0000a0;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.chat-form {
  display: grid;
  grid-template-columns: auto 1fr auto; /* attach, input, send */
  gap: 8px;
  padding: 8px;
  background: #d4d0c8;
  border-top: 2px solid #000;
}

.chat-input {
  border: 2px solid #000;
  padding: 6px;
  font-family: 'Tahoma', sans-serif;
}

.chat-send-btn {
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  background: #c0c0c0;
  padding: 6px 12px;
  font-weight: bold;
}

.chat-send-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-attach-btn {
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  background: #c0c0c0;
  padding: 6px 10px;
  font-weight: bold;
  line-height: 1;
}
.chat-attach-btn:hover { background: #b0b0b0; }
.chat-attach-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.chat-hint { font-size: 0.75rem; color: #333; padding: 0 8px 8px; }

.chat-load-older-wrap {
  display: flex;
  justify-content: center;
  margin: 6px 0 10px;
}
.chat-load-older {
  background: #e8e8e8;
  border: 1px solid #000;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
}
.chat-load-older:hover {
  background: #dcdcdc;
}

.chat-message { 
  display: grid; 
  grid-template-columns: 40px 1fr; 
  gap: 10px; 
  margin-bottom: 14px;
  align-items: start;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-avatar { 
  width: 40px; 
  height: 40px; 
  object-fit: cover; 
  border: 2px solid #000; 
  image-rendering: pixelated;
  cursor: help;
  display: block;
}

/* Frame for main user card avatar to reveal background even if portrait opaque */
.chat-avatar-frame {
  width: 44px; /* slightly larger to show border ring */
  height: 44px;
  padding: 2px; /* inner padding so background peeks around image */
  box-sizing: border-box;
  border: 2px solid #000;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.chat-avatar-frame .chat-avatar {
  width: 100%;
  height: 100%;
  border: 0; /* frame supplies border */
}

/* Typing indicator UI */
.typing-indicator {
  font-size: 0.65rem;
  color: #aa0000;
  margin-left: 4px;
  opacity: 0.85;
}
.chat-typing-banner {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #000;
  padding: 4px 8px;
  font-size: 0.7rem;
  margin-top: 6px;
  border-radius: 4px;
  display: none;
  animation: fadeIn 0.2s ease-in;
}

/* Reactions display (stub) */
.chat-reactions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  align-items: center;
}
.chat-reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}
.chat-reaction {
  background: #fff;
  color: #222;
  border: 1px solid #000;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
  transition: background 0.2s ease;
}
.chat-reaction:hover { background: #f0f0f0; }
.chat-reaction.reacted {
  background: #c7a465;
  color: #fff;
  border-color: #c7a465;
}
.chat-reaction-count { font-weight: bold; margin-left: 2px; }
.chat-reply-btn {
  background: transparent;
  border: 1px solid #999;
  color: #666;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1.2;
  transition: all 0.2s ease;
}
.chat-reply-btn:hover {
  background: #f5f5f5;
  border-color: #000;
  color: #000;
}
.chat-delete-btn {
  background: transparent;
  border: 1px solid #c44;
  color: #c44;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1.2;
  transition: all 0.2s ease;
}
.chat-delete-btn:hover {
  background: #ffecec;
  border-color: #a00;
  color: #a00;
}
.chat-reply-ref { font-size: 0.6rem; color: #555; margin-top: 4px; font-style: italic; }

/* @mention styling */
.chat-mention {
  color: #c7a465;
  font-weight: bold;
  background: rgba(199, 164, 101, 0.1);
  padding: 0 2px;
  border-radius: 2px;
}

/* Reply target UI above input */
.chat-reply-target {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: #f0f0f0;
  border: 1px solid #000;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.chat-reply-target-text { flex: 1; }
.chat-reply-cancel {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
  padding: 0 4px;
}
.chat-reply-cancel:hover { color: #000; }

/* Chat image attachment */
.chat-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  margin-top: 6px;
  display: block;
  border: 1px solid #ccc;
}

/* Attachment bar (selected image preview) */
.chat-attachment-bar {
  display: none;
  align-items: center;
  gap: 8px;
  background: #f0f0f0;
  border: 1px solid #000;
  padding: 6px 10px;
  margin: 6px 8px 0;
  border-radius: 4px;
  font-size: 0.75rem;
}
.chat-attachment-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid #aaa;
  border-radius: 3px;
}
.chat-attachment-name { flex: 1; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
  padding: 0 4px;
}
.chat-attachment-remove:hover { color: #000; }

/* Link previews */
.chat-link-preview {
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  background: #f9f9f9;
}
.chat-link-preview a {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}
.chat-link-preview a:hover { background: #f0f0f0; }
.chat-preview-thumb {
  width: 100%;
  display: block;
}
.chat-preview-label {
  display: block;
  padding: 6px 8px;
  font-size: 0.75rem;
  color: #333;
  font-weight: bold;
}

.chat-avatar.small { width: 20px; height: 20px; }

.chat-bubble { 
  background: #f5f5f5; 
  border: 1px solid #000; 
  padding: 8px;
  border-radius: 4px;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

.chat-meta { 
  display: flex; 
  gap: 8px;
  align-items: center;
  font-size: 0.75rem; 
  color: #333; 
  margin-bottom: 4px;
}

.chat-name { 
  font-weight: bold; 
  color: #000;
}

.chat-faction {
  font-size: 0.7rem;
  color: #666;
  font-style: italic;
}

.chat-time { 
  opacity: 0.6;
  margin-left: auto;
  font-family: 'Courier New', monospace;
}

.chat-text {
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-loading, .chat-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

.chat-empty {
  font-size: 1.1rem;
}

.chat-online-empty {
  color: #666;
  font-style: italic;
  font-size: 0.85rem;
  padding: 8px 0;
}

.chat-send-btn:hover {
  background: #b0b0b0;
}

.chat-send-btn:active {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}


.divider {
  height: 2px;
  background-color: #000;
  margin: 10px 0;
}

.divider-xp {
  height: 4px;
  background: linear-gradient(90deg, #c0c0c0 0%, #000080 50%, #c0c0c0 100%);
  margin: 15px 0;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

.chat-footer {
  text-align: center;
  margin-top: 20px;
  color: #000;
  font-size: 0.8rem;
  font-family: 'Tahoma', sans-serif;
}

.chat-footer a {
  color: #000080;
  text-decoration: none;
  font-weight: bold;
}

.chat-footer a:hover {
  text-decoration: underline;
}

/* === CHAT SHELL WRAPPER === */
.chat-shell {
  background-color: transparent;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* When chat shell is visible, apply chat-specific body styles */
body:has(.chat-shell[style*="display: block"]) {
  background: #008080;
  overflow-y: auto;
  overflow-x: hidden;
}

/* When console shell is visible, apply console-specific body styles */
body:has(.console-shell[style*="display: block"]) {
  background: #0d1117;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure chat page has proper cursor styles */
.chat-shell {
  cursor: url('/chatcursor.cur') 0 0, url('/chatcursor.png') 0 0, auto;
}

.chat-shell a,
.chat-shell button,
.chat-shell [href],
.chat-shell [onclick] {
  cursor: url('/chatcursor2.cur') 0 0, url('/chatcursor2.png') 0 0, pointer !important;
}

/* Chat h2 specific styling */
.chat-content h2 {
  color: #000;
  border-bottom: 2px solid #000;
  padding-bottom: 5px;
  margin-top: 25px;
  font-family: 'Arial Black', Gadget, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.2rem;
}

.chat-content p {
  margin: 8px 0;
  line-height: 1.4;
}

/* === CONSOLE PAGE STYLES (Sci-Fi Terminal Aesthetic) === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Share+Tech+Mono&display=swap');

.console-shell {
  background-color: transparent;
  color: #c9d1d9;
  font-family: 'Share Tech Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 1rem;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

#consoleBgVideo {
  z-index: 1;
}

/* Scanline effect overlay */
.console-shell::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(0deg, transparent, rgba(100, 150, 255, 0.05) 1px, transparent 2px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 3;
}

.console-frame {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: rgba(1, 4, 9, 0.9);
  padding: 25px 30px;
  border-radius: 6px;
  box-shadow: inset 0 0 25px #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  animation: boot-up 1.5s ease-out forwards;
  overflow: hidden;
  z-index: 10;
}

.console-frame::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  background: conic-gradient(
    transparent,
    transparent,
    transparent,
    #00aaff
  );
  animation: animated-border 4s linear infinite;
  transform: translate(-50%, -50%);
  z-index: -1;
}

@keyframes animated-border {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.console-frame-inner {
  background: radial-gradient(ellipse at center, rgba(26, 28, 29, 0.95) 0%, rgba(1, 4, 9, 0.95) 100%);
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 0;
  border-radius: 5px;
}

.hologram-container, .terminal-container {
  position: relative;
  z-index: 1;
}

@keyframes boot-up {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.hologram-container {
  width: 250px;
  height: 250px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hologram-head {
  width: 220px;
  height: 220px;
  background-image: url('/consoleidle.gif');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.3s ease-in-out;
  position: relative;
  z-index: 2;
}

.hologram-head::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: inherit;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  animation: pulse 4s infinite ease-in-out;
  z-index: 1;
  background-image: url('/consoleidle.gif');
}

.hologram-head.is-speaking {
  background-image: url('/consolespeech.gif');
}

.hologram-head.is-speaking::before {
  background-image: url('/consolespeech.gif');
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

.terminal-container {
  width: 100%;
}

.console-title {
  font-family: 'Cinzel Decorative', serif;
  color: #00aaff;
  margin: 0 0 15px 0;
  font-size: 1.8em;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 8px #00aaff, 0 0 12px #00aaff;
  letter-spacing: 2px;
  animation: glitch-effect 5s infinite step-end;
}

@keyframes glitch-effect {
  0%, 5%, 100% { transform: none; opacity: 1; }
  2% { transform: skew(5deg, -2deg) translateX(5px); }
  3% { transform: none; }
  4% { text-shadow: 0 0 8px #ff00ff, 0 0 15px #00ffff; transform: skew(-8deg, 3deg) translateX(-8px); }
}

.chat-window {
  height: 40vh;
  overflow-y: auto;
  margin-bottom: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 1em;
  background-color: rgba(0,0,0,0.7);
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 10px;
  text-shadow: 0 0 5px rgba(0, 170, 255, 0.7);
}

.chat-window::-webkit-scrollbar { width: 8px; }
.chat-window::-webkit-scrollbar-track { background: #0d1117; }
.chat-window::-webkit-scrollbar-thumb { background: #21262d; }
.chat-window::-webkit-scrollbar-thumb:hover { background: #30363d; }

.message.user { color: #79c0ff; text-align: right; }
.message.gem { color: #c9d1d9; }
.message.gem .typing-cursor {
  display: inline-block;
  background-color: #c9d1d9;
  width: 10px;
  height: 1.2em;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.chat-form {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.chat-form label {
  width: 100%;
  margin-bottom: 8px;
  font-family: 'Cinzel Decorative', serif;
  color: #00aaff;
  text-align: left;
  font-size: 0.9em;
  opacity: 0.8;
}

.input-group {
  display: flex;
  width: 100%;
}

#userInput {
  flex-grow: 1;
  background-color: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1em;
  border-radius: 6px 0 0 6px;
  text-shadow: 0 0 5px rgba(0, 170, 255, 0.7);
  height: 42px;
  padding: 0 15px;
  line-height: 42px;
}

#userInput:focus { outline: 1px solid #00aaff; }

.console-shell button {
  height: 42px;
  padding: 0 20px;
  border: 1px solid #30363d;
  background-color: #21262d;
  color: #c9d1d9;
  font-family: 'Cinzel Decorative', serif;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, text-shadow 0.2s;
}

.console-shell button:hover { 
  background-color: #30363d; 
  text-shadow: 0 0 5px #00aaff; 
}

#transmitButton {
  border-radius: 0 6px 6px 0;
}

#skipButton {
  border-radius: 6px;
  margin-left: 8px;
  border-color: #00aaff;
  background-color: #0d1117;
  color: #00aaff;
}

#skipButton:hover {
  background-color: #00aaff;
  color: #0d1117;
  text-shadow: none;
}

@media (max-width: 768px) {
  .console-shell {
    padding: 0.5rem;
    overflow-y: auto;
    min-height: -webkit-fill-available;
  }
  .console-frame { padding: 15px; }
  .hologram-container { width: 150px; height: 150px; margin-bottom: 1rem; }
  .hologram-head { width: 120px; height: 120px; }
  .console-title { font-size: 1.3em; margin-bottom: 10px; }
  .chat-window { height: 25vh; font-size: 0.9em; }
  
  .input-group { flex-wrap: wrap; }
  #userInput { border-radius: 6px; width: 100%; }
  #transmitButton { 
    border-radius: 6px; 
    flex-grow: 1; 
    margin-top: 8px;
  }
  #skipButton {
    flex-grow: 1;
    margin-top: 8px;
  }
}

/* === EPISODES PAGE STYLES (VHS Glitch Aesthetic) === */
@font-face {
  font-family: 'NEUROPOL';
  src: url('/Neuropol.ttf') format('truetype');
}

.episodes-shell {
  background-color: transparent;
  color: #F0F0F0;
  font-family: 'NEUROPOL', monospace;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

#episodesBgVideo {
  z-index: -100;
}

.episodes-header {
  background: url('/episode.gif') center/cover no-repeat;
  min-height: 400px;
  border-bottom: 3px solid #FFFFFF;
}

.episodes-nav {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  text-align: center;
}

.episodes-nav a {
  color: #F0F0F0;
  margin: 0 15px;
  text-decoration: none;
  font-weight: bold;
  text-shadow: 0 0 3px #FF0000;
  transition: color 0.3s, text-shadow 0.3s;
}

.episodes-nav a:hover {
  color: #FF0000;
  text-shadow: 0 0 8px #FF0000;
}

.episodes-content {
  background: rgba(0, 0, 0, 0.8);
  width: 90%;
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  box-shadow: 0 0 15px #000;
}

.episodes-footer {
  text-align: center;
  margin: 40px auto;
  padding: 20px;
  background: transparent;
}

.episodes-shell h2 {
  font-family: 'NEUROPOL', monospace;
  text-transform: uppercase;
  color: #F0F0F0;
  text-shadow: 0 0 5px #FF0000;
}

.episodes-shell h3,
.episodes-shell h4 {
  font-family: 'NEUROPOL', monospace;
  text-transform: uppercase;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.video-item {
  background: rgba(0, 0, 0, 0.7);
  padding: 15px;
  border-left: 5px solid #FFFFFF;
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.video-item:hover {
  transform: scale(1.02);
  box-shadow: 0 0 10px #FF0000;
  border-left-color: #FF0000;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin-bottom: 10px;
  border: 2px solid #000;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-info {
  padding: 10px 5px;
}

.download-links {
  background: #000;
  padding: 10px;
  margin-top: 10px;
  border-top: 1px dashed #FFFFFF;
  font-size: 0.9em;
}

.download-links a {
  color: #F0F0F0;
  text-decoration: none;
}

.download-links a:hover {
  color: #FF0000;
}

.vhs-glitch {
  position: relative;
}

.vhs-glitch:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(0deg, rgba(255,0,0,0.1) 0%, rgba(255,0,0,0.1) 100%);
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ============================================================================
   MAP PAGE STYLES - Interactive World Map
   ============================================================================ */

/* Map-specific fonts */
@font-face {
  font-family: 'Ringbearer';
  src: url('/fonts/ringbearer.ttf') format('truetype');
}
@font-face {
  font-family: 'ThreeClover';
  src: url('/fonts/ThreeClover.ttf') format('truetype');
}

.map-shell {
  background-color: transparent;
  color: #d8c8a0;
  font-family: 'IM Fell English', serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

#mapBgVideo {
  z-index: -100;
}

.map-header {
  border-bottom: 2px solid #8b5a2b;
  padding: 10px;
  text-align: center;
}

.map-header .header-image {
  max-width: 100%;
  height: auto;
}

.map-nav {
  padding: 10px;
  text-align: center;
  border-bottom: 1px dashed #5c2018;
}

.map-nav a {
  color: #d8c8a0;
  margin: 0 15px;
  text-decoration: none;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.map-nav a:hover {
  color: #c7a465;
  text-shadow: 0 0 8px rgba(199, 164, 101, 0.5);
}

/* Map container and hotspots */
.map-view {
  width: 100%;
  overflow: auto;
  padding: 20px 0;
  text-align: center;
}

.map-container {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  border: 3px solid #8b5a2b;
  max-width: 100%;
  background: rgba(0,0,0,0.2);
}

.world-map {
  display: block;
  width: 100%;
  max-width: 2080px;
  max-height: 80vh;
  height: auto;
}

.map-hotspot {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(199, 164, 101, 0.2);
  border: 2px solid #c7a465;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s;
  z-index: 2;
  cursor: url('/mapcursor.cur') 0 0, url('/mapcursor.png') 0 0, pointer !important;
}

.map-hotspot:hover,
.map-hotspot:focus {
  background: rgba(199, 164, 101, 0.5);
  transform: translate(-50%, -50%) scale(1.4);
  box-shadow: 0 0 10px #c7a465;
  outline: none;
}

/* Gallery in modals */
.map-shell .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.map-shell .gallery img {
  width: 100%;
  border: 1px solid #8b5a2b;
  transition: transform 0.3s, border-color 0.3s;
}

.map-shell .gallery img:hover {
  transform: scale(1.05);
  border-color: #c7a465;
}

/* Modal styles */
.modal-backdrop {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(18, 14, 10, 0.85);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: rgba(18, 14, 10, 0.98);
  width: 90%;
  max-width: 800px;
  margin: auto;
  padding: 30px;
  border: 1px solid #8b5a2b;
  box-shadow: 0 0 25px rgba(0,0,0,0.8);
  position: relative;
  color: #d8c8a0;
}

.modal-close-btn {
  color: #d8c8a0;
  position: absolute;
  top: 10px;
  right: 25px;
  font-size: 35px;
  font-weight: bold;
  transition: color 0.3s;
  cursor: pointer;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: #c7a465;
  text-decoration: none;
}

.modal-content h2 {
  font-family: 'ThreeClover', cursive;
  color: #c7a465;
  font-size: 2.5rem;
  font-weight: normal;
  border-bottom: 1px solid #5c2018;
  padding-bottom: 10px;
  margin-top: 0;
  text-shadow: 0 0 5px rgba(199, 164, 101, 0.5);
}

.modal-content p {
  font-size: 1.1em;
  text-align: justify;
}

.dossier-btn {
  display: block;
  background: transparent;
  color: #c7a465;
  padding: 12px 25px;
  margin: 30px auto 0 auto;
  border: 1px solid #8b5a2b;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 1.2em;
  text-align: center;
  transition: all 0.3s;
  text-decoration: none;
  width: fit-content;
}

.dossier-btn:hover {
  background: #c7a465;
  color: #120e0a;
  border-color: #c7a465;
}

.map-footer {
  text-align: center;
  margin-top: 50px;
  padding: 20px;
  font-size: 0.9rem;
  font-style: italic;
  color: #8b5a2b;
  border-top: 1px dashed #5c2018;
}

/* ============================================================================
   ART PAGE STYLES - Renaissance Gallery
   ============================================================================ */

/* Import Renaissance fonts */
@import url('https://fonts.googleapis.com/css2?family=Old+Standard+TT&family=Marcellus+SC&family=Italianno&display=swap');

/* === MUSIC PAGE - MEDIEVAL JAZZ BAR === */
/* Import fonts for music page */
@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Cinzel+Decorative&display=swap');

.music-shell {
  background: #000 url('/gip.gif') no-repeat center center fixed;
  background-size: cover;
  color: #E8D8B0;
  font-family: 'MedievalSharp', cursive;
  margin: 0;
  line-height: 1.6;
  letter-spacing: 0.5px;
  min-height: 100vh;
  overflow-y: auto;
  padding-bottom: 100px;
}

.music-header {
  background: rgba(20, 10, 5, 0.9);
  border-bottom: 3px solid #C0A060;
  padding: 30px 20px;
  text-align: center;
  text-shadow: 2px 2px 4px #000;
  font-family: 'Cinzel Decorative', cursive;
  position: relative;
}

.music-header::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #C0A060, transparent);
}

.music-header h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  color: #FFD700;
  letter-spacing: 2px;
}

.music-header p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.9;
}

.music-nav {
  background: rgba(40, 20, 10, 0.8);
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  border-bottom: 2px solid #5A4A30;
}

.music-nav a {
  color: #E8D8B0;
  margin: 0 15px;
  text-decoration: none;
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1em;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
}

.music-nav a:hover {
  color: #FFD700;
  text-shadow: 0 0 5px #FFD700;
}

.music-content {
  background: rgba(20, 10, 5, 0.8);
  width: 90%;
  max-width: 1000px;
  margin: 30px auto;
  padding: 40px;
  border: 2px solid #5A4A30;
  box-shadow: 0 0 30px rgba(0,0,0,0.9);
  border-radius: 8px;
}

.music-content h2 {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 2rem;
  color: #FFD700;
  text-align: center;
  margin: 0 0 15px 0;
  text-shadow: 2px 2px 4px #000;
  letter-spacing: 2px;
}

.music-content > p {
  text-align: center;
  font-style: italic;
  font-size: 1.1rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

.track-card {
  background: rgba(30, 15, 5, 0.7);
  padding: 25px;
  margin: 20px 0;
  border-left: 5px solid #C0A060;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.track-card:hover {
  background: rgba(40, 20, 5, 0.9);
  transform: translateX(5px);
}

.track-card h3 {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.5em;
  margin: 0 0 8px 0;
  color: #FFD700;
  letter-spacing: 1px;
}

.track-card > p {
  margin: 0 0 15px 0;
  opacity: 0.8;
}

.track-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.play-btn {
  background: linear-gradient(135deg, #C0A060, #8B7040);
  color: #1A0F07;
  border: 2px solid #FFD700;
  padding: 12px 30px;
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  letter-spacing: 1px;
}

.play-btn:hover {
  background: linear-gradient(135deg, #FFD700, #C0A060);
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.play-btn:active {
  transform: scale(0.98);
}

.platform-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.platform-link.soundcloud {
  color: #ff8800;
  border-color: #ff8800;
  background: rgba(255, 136, 0, 0.1);
}

.platform-link.soundcloud:hover {
  background: #ff8800;
  color: #1A0F07;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 136, 0, 0.4);
}

.platform-link.spotify {
  color: #1DB954;
  border-color: #1DB954;
  background: rgba(29, 185, 84, 0.1);
}

.platform-link.spotify:hover {
  background: #1DB954;
  color: #1A0F07;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(29, 185, 84, 0.4);
}

.music-divider {
  border: none;
  border-top: 2px solid #5A4A30;
  margin: 50px 0;
  box-shadow: 0 1px 0 rgba(192, 160, 96, 0.3);
}

.profile-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin: 30px 0;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 25px;
  background: rgba(30, 15, 5, 0.7);
  border: 2px solid;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.profile-card.soundcloud {
  border-color: #ff8800;
}

.profile-card.spotify {
  border-color: #1DB954;
}

.profile-card i {
  font-size: 3rem;
}

.profile-card.soundcloud i {
  color: #ff8800;
}

.profile-card.spotify i {
  color: #1DB954;
}

.profile-card h3 {
  margin: 0 0 5px 0;
  font-size: 1.3rem;
  color: #FFD700;
}

.profile-card p {
  margin: 0;
  opacity: 0.8;
  color: #E8D8B0;
}

.profile-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.profile-card.soundcloud:hover {
  background: rgba(255, 136, 0, 0.2);
  border-color: #FFD700;
}

.profile-card.spotify:hover {
  background: rgba(29, 185, 84, 0.2);
  border-color: #FFD700;
}

.music-footer {
  text-align: center;
  margin-top: 50px;
  padding-top: 30px;
  border-top: 2px solid #5A4A30;
  font-size: 0.9em;
  color: #8B7040;
  font-style: italic;
}

/* Responsive design for music page */
@media (max-width: 768px) {
  .music-header h1 {
    font-size: 1.8rem;
  }
  
  .music-content {
    width: 95%;
    padding: 20px;
  }
  
  .track-links {
    flex-direction: column;
    align-items: stretch;
  }
  
  .play-btn {
    width: 100%;
    text-align: center;
  }
  
  .platform-link {
    justify-content: center;
  }
  
  .profile-links {
    grid-template-columns: 1fr;
  }
}

/* === RACES PAGE - ENCYCLOPEDIA === */
.races-shell {
  font-family: 'Georgia', serif;
  margin: 0;
  padding: 0;
  color: #333;
  position: relative;
  background: #f5f3e7 url('/RaceBackground.png') center/cover no-repeat fixed;
  min-height: 100vh;
  overflow-y: auto;
  padding-bottom: 100px;
}

.races-nav {
  background-color: #2a5c8a;
  overflow: hidden;
  padding: 12px 0;
  text-align: center;
  border-bottom: 3px solid #d4a017;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.races-nav a {
  color: white;
  text-decoration: none;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
}

.races-nav a:hover {
  background-color: #3a6c9a;
  color: #ffd700;
}

.races-container {
  background-color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  padding: 20px;
  margin: 30px auto;
  max-width: 1200px;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.races-header {
  background-color: #d4a017;
  color: #2a5c8a;
  text-align: center;
  padding: 25px 0;
  margin-bottom: 30px;
  border-bottom: 5px solid #2a5c8a;
  border-radius: 8px;
}

.races-header h1 {
  margin: 0;
  font-size: 42px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  letter-spacing: 1px;
}

.races-header .subtitle {
  font-style: italic;
  margin-top: 10px;
  font-size: 18px;
  color: #2a5c8a;
}

.races-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.race-card {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: all 0.3s;
  border: 2px solid #d4a017;
  position: relative;
}

.race-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.race-image-container {
  position: relative;
  overflow: hidden;
  height: 200px;
  border-bottom: 2px solid #d4a017;
}

.race-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.race-card:hover .race-image {
  transform: scale(1.05);
}

.race-name {
  font-weight: bold;
  font-size: 22px;
  color: #2a5c8a;
  padding: 15px 15px 0;
  margin: 0;
  cursor: pointer;
  transition: color 0.3s;
  position: relative;
  display: inline-block;
}

.race-name:hover {
  color: #d4a017;
}

.race-name:after {
  content: "▼";
  font-size: 14px;
  margin-left: 8px;
  color: #d4a017;
  transition: transform 0.3s;
  display: inline-block;
}

.race-name.active:after {
  transform: rotate(180deg);
}

.race-location {
  font-style: italic;
  color: #666;
  padding: 0 15px 15px;
  font-size: 14px;
  border-bottom: 1px dashed #ddd;
}

.race-description {
  padding: 0 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, padding 0.5s ease;
  line-height: 1.6;
  color: #444;
  font-size: 15px;
}

.race-description.active {
  padding: 15px;
  max-height: 500px;
}

.fact-box {
  background-color: #e8f4fc;
  border-left: 4px solid #2a5c8a;
  padding: 10px;
  margin: 10px 0;
  font-size: 14px;
}

.stamp {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #d4a017;
  color: white;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
  transform: rotate(10deg);
  opacity: 0.9;
  z-index: 10;
}

/* Responsive design for races page */
@media (max-width: 768px) {
  .races-nav a {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .races-grid {
    grid-template-columns: 1fr;
  }
  
  .races-header h1 {
    font-size: 32px;
  }

  .races-container {
    margin-left: 15px;
    margin-right: 15px;
  }
}

.art-shell {
  background: #1A0F07 url('/fresco-texture.gif') no-repeat center center fixed;
  background-size: cover;
  color: #E8D8B0;
  font-family: 'Old Standard TT', serif;
  line-height: 1.6;
  letter-spacing: 0.5px;
  min-height: 100vh;
  position: relative;
}

.art-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 20, 10, 0.7);
  z-index: -1;
}

.art-header {
  background: url('/artheader.png') no-repeat center center;
  background-size: contain;
  height: 150px;
  padding: 20px;
  text-align: center;
  position: relative;
  margin-bottom: 20px;
}

.art-header::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 25%;
  right: 25%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #C0A060, transparent);
}

.art-nav {
  background: rgba(60, 40, 20, 0.8);
  padding: 15px;
  text-align: center;
  border-bottom: 1px solid #C0A060;
}

.art-nav a {
  color: #E8D8B0;
  margin: 0 15px;
  text-decoration: none;
  font-family: 'Marcellus SC', serif;
  font-size: 1.1em;
  letter-spacing: 1px;
}

.art-nav a:hover {
  color: #FFD700;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.art-content {
  background: rgba(40, 30, 15, 0.85);
  width: 90%;
  max-width: 800px;
  margin: 20px auto;
  padding: 30px;
  border: 1px solid #5A4A30;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  margin: 30px 0;
}

.art-item {
  background: rgba(50, 35, 20, 0.7);
  padding: 20px;
  border: 1px solid #5A4A30;
  transition: all 0.3s;
  position: relative;
}

.art-item:hover {
  background: rgba(70, 50, 30, 0.9);
  border-color: #C0A060;
}

.art-thumb {
  width: 100%;
  border: 2px solid #3A2A15;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transition: transform 0.3s;
}

.art-item:hover .art-thumb {
  transform: scale(1.03);
  box-shadow: 0 0 15px rgba(192, 160, 96, 0.5);
}

.art-item h3 {
  font-family: 'Marcellus SC', serif;
  color: #FFD700;
  margin-top: 15px;
  border-bottom: 1px dashed #5A4A30;
  padding-bottom: 5px;
}

.download-btn {
  display: block;
  background: rgba(80, 60, 30, 0.8);
  color: #E8D8B0;
  padding: 8px;
  text-align: center;
  margin-top: 15px;
  border: 1px solid #5A4A30;
  font-family: 'Marcellus SC', serif;
  transition: all 0.3s;
  text-decoration: none;
}

.download-btn:hover {
  background: rgba(100, 80, 40, 0.9);
  color: #FFD700;
  border-color: #C0A060;
}

.store-notice {
  background: rgba(50, 35, 20, 0.8);
  padding: 20px;
  margin: 40px 0;
  border-left: 5px solid #C0A060;
  position: relative;
}

.store-notice h2 {
  font-family: 'Marcellus SC', serif;
  color: #FFD700;
}

.art-footer {
  text-align: center;
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid #5A4A30;
}

.art-footer img {
  opacity: 0.8;
}

.art-footer p {
  font-family: 'Italianno', cursive;
  font-size: 1.2em;
  color: #C0A060;
}

/* ============================================================================
   FORUM PAGE STYLES - Windows 95/AOL Interface
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Verdana:wght@400;700&display=swap');

.forum-shell {
  background-color: #d4d4d4;
  font-family: 'Verdana', sans-serif;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 0;
}

.forum-container {
  width: 95%;
  max-width: 1000px;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 10px;
  background-color: #d4d4d4;
  border-style: solid;
  border-width: 2px;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
}

.forum-shell .nav-container {
  display: flex;
  justify-content: center;
  gap: 2px;
  width: 100%;
  flex-wrap: wrap;
}

.forum-shell .nav-item {
  display: block;
  background-color: #d4d4d4;
  padding: 6px 12px;
  text-decoration: none;
  color: #000000;
  font-size: 0.9em;
  font-weight: bold;
  border-style: solid;
  border-width: 2px;
  border-color: #ffffff #808080 #808080 #ffffff;
  position: relative;
  top: 2px;
  z-index: 1;
  flex-basis: 120px;
  text-align: center;
}

.forum-shell .nav-item:hover {
  text-decoration: underline;
}

.forum-shell .nav-item.active {
  background-color: #ececec;
  border-bottom: 1px solid #ececec;
  border-color: #808080 #ffffff #ffffff #808080;
  transform: translateY(2px);
  top: 0;
  z-index: 2;
}

.main-window {
  background-color: #ececec;
  border: 2px solid #808080;
  border-top: none;
  padding: 1px;
  position: relative;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.title-bar {
  background: linear-gradient(to right, #00008b, #1e90ff);
  color: #ffffff;
  padding: 5px 8px;
  font-weight: bold;
  font-size: 0.9em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #808080;
}

.content-wrapper {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  padding: 10px;
  gap: 15px;
}

.forum-shell .panel {
  background-color: #d4d4d4;
  border: 2px inset #808080;
  padding: 8px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.panel-title {
  background-color: #ececec;
  padding: 4px;
  margin-bottom: 8px;
  font-weight: bold;
  border-bottom: 1px solid #808080;
}

.panel-left {
  flex-shrink: 0;
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex-grow: 1;
}

.panel-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.forum-shell .panel-list li a {
  display: block;
  padding: 4px 6px;
  text-decoration: none;
  color: #0000ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forum-shell .panel-list li a:hover {
  background-color: #00008b;
  color: #ffffff;
}

.link-button {
  display: inline-block;
  padding: 6px 12px;
  font-size: 1em;
  text-decoration: none;
  color: #000000;
  background-color: #d4d4d4;
  border-style: solid;
  border-width: 2px;
  border-color: #ffffff #808080 #808080 #ffffff;
  text-align: center;
  margin-right: 5px;
}

.link-button:active {
  border-color: #808080 #ffffff #ffffff #808080;
  transform: translateY(1px) translateX(1px);
}

.discord-button {
  background-color: #5865f2;
  color: #ffffff;
  border-color: #7d8be0 #4a54a0 #4a54a0 #7d8be0;
}

.discord-button:active {
  border-color: #4a54a0 #7d8be0 #7d8be0 #4a54a0;
}

.portal-transmission-text {
  font-size: 0.9em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .forum-shell .content-wrapper {
    flex-direction: column;
  }
  .forum-shell .panel-left {
    width: 100%;
  }
  .forum-shell .panel-right {
    width: 100%;
  }
  .forum-shell .nav-item {
    flex-grow: 1;
    flex-basis: auto;
  }
  .forum-shell .link-button {
    display: block;
    margin: 10px auto;
  }
}

@media (min-width: 1024px) {
  .forum-shell {
    height: 100vh;
  }
  .forum-container {
    width: 98vw;
    max-width: none;
    margin: 5px auto;
    min-height: 98vh;
  }
  .forum-shell .nav-item {
    flex-basis: 110px;
  }
  .forum-shell .panel-left {
    flex-basis: 400px;
    flex-grow: 0;
  }
  .forum-shell .panel-right {
    flex-grow: 1;
  }
}

/* Active route highlighting across all shells */
#main-nav a.active-route {
  color: var(--color-xlarthqll-gold);
  text-shadow: 0 0 12px var(--color-xlarthqll-gold);
  font-weight: bold;
}

.chat-nav a.active-route {
  background-color: #000080;
  color: #fff;
  font-weight: bold;
}

.episodes-nav a.active-route {
  color: #FF0000;
  text-shadow: 0 0 12px #FF0000;
  text-decoration: underline;
}

.map-nav a.active-route {
  color: #c7a465;
  text-shadow: 0 0 12px rgba(199, 164, 101, 0.8);
  font-weight: bold;
}

.music-nav a.active-route {
  color: #FFD700;
  text-shadow: 0 0 8px #FFD700;
  font-weight: bold;
}

.races-nav a.active-route {
  background-color: #3a6c9a;
  color: #ffd700;
}

.art-nav a.active-route {
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
  font-weight: bold;
}

.forum-shell .nav-item.active-route {
  background-color: #000080;
  color: #fff;
}

/* Page transition animations */
.page-shell {
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.page-shell.page-fade-in {
  opacity: 1;
}

/* Mobile hamburger menu */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  background: var(--color-hubland-stone);
  border: 2px solid var(--color-xlarthqll-gold);
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-parchment);
  font-size: 24px;
  transition: all 0.3s ease;
}

.hamburger-btn:hover {
  background: var(--color-border-darker);
  color: var(--color-xlarthqll-gold);
  box-shadow: 0 0 12px rgba(199, 164, 101, 0.5);
}

.mobile-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-backdrop.active {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: block;
  }
  
  #main-nav {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    padding: 80px 0 20px 0;
    margin: 0;
    background: var(--color-hubland-stone);
    border-left: 2px solid var(--color-xlarthqll-gold);
    border-bottom: none;
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
  }
  
  #main-nav.mobile-open {
    right: 0;
  }
  
  #main-nav a {
    padding: 18px 25px;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--color-border-darker);
    text-align: left;
  }
  
  #main-nav a:hover {
    background: var(--color-border-darker);
  }
}

/* ========================================
   USER PROFILE SYSTEM
   ======================================== */

/* Profile Modal */
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

/* Profile Modal - Ragnarok Online Style - UPDATED */
.profile-modal-content {
  position: relative;
  /* RO-style beige parchment background */
  background-color: #f5f0e8 !important;
  background-image: url('/images/ui/textures/panel-texture.png');
  background-repeat: repeat;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  /* Classic Windows 98 beveled border */
  border: 3px solid #c0c0c0 !important;
  border-radius: 0;
  padding: 30px;
  padding-top: 40px; /* Space for title bar */
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 
    /* Outer highlight (top-left) */
    inset 3px 3px 0 0 #ffffff,
    inset 2px 2px 0 0 #dfdfdf,
    /* Outer shadow (bottom-right) */
    inset -3px -3px 0 0 #404040,
    inset -2px -2px 0 0 #808080,
    /* Outer drop shadow */
    0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 10001;
}

.profile-modal-content::before {
  /* Title bar */
  content: 'Character Creator';
  position: absolute;
  top: -2px; /* Account for border */
  left: -2px;
  right: -2px;
  height: 24px;
  background: linear-gradient(90deg, #0054a6 0%, #8bb4e0 50%, #0054a6 100%);
  border-bottom: 1px solid #808080;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55em;
  color: #ffffff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  padding-left: 8px;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 10;
  line-height: 24px;
}

.profile-modal-content::after {
  /* Remove old corner ornament */
  content: none;
}

.profile-modal-content h2 {
  font-family: 'Press Start 2P', monospace;
  color: #000000;
  font-size: 0.7em;
  margin: 35px 0 20px 0;
  text-align: left;
  text-shadow: none;
  letter-spacing: 1px;
  padding: 8px 12px;
  /* RO-style tab - active/raised */
  background: #efefef;
  border: none;
  box-shadow:
    /* Top-left highlight */
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    /* Bottom-right shadow */
    1px 0 0 0 #808080,
    0 1px 0 0 #808080;
  position: relative;
  display: inline-block;
  margin-bottom: -2px; /* Connect to content below */
  z-index: 2;
}

.profile-modal-content h2::after {
  /* Remove divider */
  content: none;
}

.profile-subtitle {
  text-align: center;
  color: #8a7050;
  margin-bottom: 25px;
  font-size: 0.9em;
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
}

.profile-close-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  /* Windows 98 style close button */
  background: #e0e0e0;
  border: none;
  width: 20px;
  height: 20px;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    1px 1px 0 0 #404040;
  color: #000000;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Arial', sans-serif;
  font-weight: bold;
  line-height: 1;
  padding: 0;
  z-index: 20;
}

.profile-close-btn:hover {
  background: #efefef;
}

.profile-close-btn:active {
  box-shadow:
    inset 1px 1px 0 0 #404040;
  transform: translate(1px, 1px);
}

.profile-field {
  margin-bottom: 15px;
  background: transparent;
  border: none;
  padding: 8px 0;
  position: relative;
}

.profile-field::before {
  /* Remove corner ornament */
  content: none;
}

.profile-field::after {
  /* Remove corner ornament */
  content: none;
}

.profile-field label {
  display: block;
  color: #000000;
  font-size: 0.65em;
  margin-bottom: 6px;
  font-weight: normal;
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 1px;
  text-shadow: none;
  text-transform: none;
}

#profile-name,
#profile-race,
#profile-affinity,
#profile-avatar-url,
#profile-bio {
  width: 100%;
  padding: 8px 10px;
  /* RO-style faded blue slot background */
  background: rgba(200, 220, 240, 0.3);
  border: 1px solid rgba(100, 140, 180, 0.4);
  border-radius: 4px;
  color: #000000;
  font-size: 0.9em;
  font-family: 'VT323', monospace;
  transition: all 0.2s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

#profile-race,
#profile-affinity {
  cursor: pointer;
  appearance: none;
  background-image: 
    linear-gradient(90deg, rgba(180, 210, 240, 0.4) 0%, rgba(160, 200, 230, 0.3) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  padding-right: 35px;
}

#profile-race option,
#profile-affinity option {
  background: #f0f0f0;
  color: #000;
  padding: 6px;
}

#profile-bio {
  resize: vertical;
  min-height: 60px;
  max-height: 200px;
  line-height: 1.6;
}

#profile-name:focus,
#profile-race:focus,
#profile-affinity:focus,
#profile-avatar-url:focus,
#profile-bio:focus {
  outline: none;
  border-color: rgba(0, 84, 166, 0.6);
  background: rgba(220, 235, 250, 0.4);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.1),
    0 0 0 2px rgba(0, 84, 166, 0.2);
}

.profile-hint {
  display: block;
  color: #888;
  font-size: 0.85em;
  margin-top: 5px;
  font-style: italic;
}

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

/* Background Selector */
.bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: #d4d0c8;
  border: 2px solid #808080;
  box-shadow: 
    inset 1px 1px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
}

.bg-card {
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  border: 3px solid transparent;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
}

.bg-card:hover {
  border-color: #0054a6;
  transform: scale(1.05);
  z-index: 2;
}

.bg-card.selected {
  border-color: #0054a6;
  box-shadow:
    0 0 0 3px #0054a6,
    inset 0 0 0 2px #ffffff;
  transform: scale(1.02);
  z-index: 3;
}

.bg-card.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 6px;
  background: #0054a6;
  color: #ffffff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  font-family: 'Press Start 2P', monospace;
}

/* Gender Selector */
.gender-selector {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.gender-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  /* RO-style button with bevel */
  background: #e0e0e0;
  border: none;
  box-shadow:
    /* Raised bevel */
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
  color: #000000;
  cursor: pointer;
  transition: all 0.15s;
}

.gender-btn:hover {
  background: #efefef;
  transform: translate(0, 0);
}

.gender-btn.selected {
  /* Inset/pressed appearance */
  background: #d0d0d0;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
  transform: translate(1px, 1px);
}

.gender-icon {
  font-size: 1.5em;
}

.gender-label {
  font-size: 0.65em;
  font-family: 'Press Start 2P', monospace;
}

/* Avatar Builder */
.avatar-builder-section {
  margin-top: 20px;
}

.avatar-builder {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  margin-top: 15px;
}

.avatar-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--color-xlarthqll-gold);
  border-radius: 12px;
  padding: 15px;
}

#avatar-canvas {
  border-radius: 8px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.avatar-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.avatar-control-group {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}

.avatar-control-group label {
  display: block;
  color: var(--color-xlarthqll-gold);
  font-size: 0.9em;
  margin-bottom: 10px;
  font-weight: 600;
}

.color-picker-row,
.style-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.color-btn[data-feature="skin"][data-value="#8d5524"] { background: #8d5524; }
.color-btn[data-feature="skin"][data-value="#c68642"] { background: #c68642; }
.color-btn[data-feature="skin"][data-value="#e0ac69"] { background: #e0ac69; }
.color-btn[data-feature="skin"][data-value="#f1c27d"] { background: #f1c27d; }
.color-btn[data-feature="skin"][data-value="#ffdbac"] { background: #ffdbac; }
.color-btn[data-feature="skin"][data-value="#4a5f3a"] { background: #4a5f3a; }
.color-btn[data-feature="skin"][data-value="#7a5c5c"] { background: #7a5c5c; }
.color-btn[data-feature="skin"][data-value="#9b59b6"] { background: #9b59b6; }

.color-btn[data-feature="hair"][data-value="#000000"] { background: #000000; }
.color-btn[data-feature="hair"][data-value="#2c1608"] { background: #2c1608; }
.color-btn[data-feature="hair"][data-value="#8b4513"] { background: #8b4513; }
.color-btn[data-feature="hair"][data-value="#daa520"] { background: #daa520; }
.color-btn[data-feature="hair"][data-value="#f0e68c"] { background: #f0e68c; }
.color-btn[data-feature="hair"][data-value="#ff6347"] { background: #ff6347; }
.color-btn[data-feature="hair"][data-value="#9370db"] { background: #9370db; }
.color-btn[data-feature="hair"][data-value="#00ced1"] { background: #00ced1; }

.color-btn[data-feature="eyes"][data-value="#8b4513"] { background: #8b4513; }
.color-btn[data-feature="eyes"][data-value="#2e8b57"] { background: #2e8b57; }
.color-btn[data-feature="eyes"][data-value="#4169e1"] { background: #4169e1; }
.color-btn[data-feature="eyes"][data-value="#9370db"] { background: #9370db; }
.color-btn[data-feature="eyes"][data-value="#00ced1"] { background: #00ced1; }
.color-btn[data-feature="eyes"][data-value="#ff6347"] { background: #ff6347; }
.color-btn[data-feature="eyes"][data-value="#ffd700"] { background: #ffd700; }

.color-btn:hover {
  transform: scale(1.1);
  border-color: var(--color-xlarthqll-gold);
}

.color-btn.selected {
  border-color: var(--color-xlarthqll-gold);
  border-width: 3px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.style-btn {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--color-border);
  border-radius: 6px;
  color: #fff;
  font-family: 'IM Fell English', serif;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}

.style-btn:hover {
  border-color: var(--color-xlarthqll-gold);
  transform: translateY(-2px);
}

.style-btn.selected {
  border-color: var(--color-xlarthqll-gold);
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Mobile responsive avatar builder */
@media (max-width: 768px) {
  .avatar-builder {
    grid-template-columns: 1fr;
  }
  
  .avatar-preview {
    max-width: 100%;
  }
  
  #avatar-canvas {
    width: 100%;
    height: auto;
  }
}

/* ============================================
   FINAL FANTASY STYLE CHARACTER SHEET
   ============================================ */

.ff-label {
  display: block;
  color: var(--color-xlarthqll-gold);
  font-size: 1.2em;
  margin-bottom: 15px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* FF Character Sheet - RO Style */
.ff-character-sheet {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  background-color: #f5f0e8 !important;
  background-image: url('/images/ui/textures/panel-texture.png');
  background-repeat: repeat;
  image-rendering: pixelated;
  /* RO-style beveled border */
  border: 3px solid #c0c0c0 !important;
  border-radius: 0;
  padding: 20px;
  box-shadow: 
    inset 2px 2px 0 0 #ffffff,
    inset 1px 1px 0 0 #dfdfdf,
    inset -2px -2px 0 0 #404040,
    inset -1px -1px 0 0 #808080;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.ff-character-sheet::before {
  /* Remove corner ornament for RO style */
  content: none;
}

.ff-character-sheet::after {
  /* Remove corner ornament for RO style */
  content: none;
}

/* Left Panel - Preview */
.ff-preview-panel {
  background-color: #d4d0c8;
  border: 2px solid #808080;
  box-shadow: 
    inset 1px 1px 0 0 #ffffff,
    inset -1px -1px 0 0 #404040;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
}

.ff-preview-panel::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 16px;
  height: 16px;
  background-image: url('/images/ui/borders/corner-tl.png');
  background-size: 16px 16px;
  image-rendering: pixelated;
  pointer-events: none;
}

.ff-preview-panel::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background-image: url('/images/ui/borders/corner-br.png');
  background-size: 16px 16px;
  image-rendering: pixelated;
  pointer-events: none;
}

.ff-portrait-frame {
  position: relative;
  background: #000;
  border: 3px solid #c0c0c0 !important;
  padding: 0;
  box-shadow: 
    inset 1px 1px 0 rgba(255,255,255,0.8),
    inset 2px 2px 0 rgba(255,255,255,0.4),
    inset -1px -1px 0 rgba(0,0,0,0.8),
    inset -2px -2px 0 rgba(0,0,0,0.4) !important;
  overflow: hidden;
}

.ff-background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

#avatar-canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  background: transparent !important;
  image-rendering: pixelated;
}

.ff-background-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  padding: 6px;
  background: #d4d0c8;
  border: 2px solid #c0c0c0;
  box-shadow: 
    inset 1px 1px 0 rgba(255,255,255,0.8),
    inset -1px -1px 0 rgba(0,0,0,0.4);
}

.ff-nav-btn {
  background: #e0e0e0;
  border: 2px solid #c0c0c0;
  padding: 4px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6em;
  cursor: pointer;
  box-shadow: 
    inset -1px -1px 0 rgba(0,0,0,0.8),
    inset 1px 1px 0 rgba(255,255,255,0.8),
    inset -2px -2px 0 rgba(0,0,0,0.4),
    inset 2px 2px 0 rgba(255,255,255,0.4);
}

.ff-nav-btn:active {
  box-shadow: 
    inset 1px 1px 0 rgba(0,0,0,0.8),
    inset 2px 2px 0 rgba(0,0,0,0.4),
    inset -1px -1px 0 rgba(255,255,255,0.8),
    inset -2px -2px 0 rgba(255,255,255,0.4);
  transform: translate(1px, 1px);
}

.ff-control-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6em;
  color: #000;
}

.ff-background-grid-container {
  margin-top: 12px;
}

.ff-faction-section {
  margin-top: 20px;
}

.ff-faction-section label {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--color-text);
}

.ff-grid-label {
  display: block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65em;
  color: #000;
  margin-bottom: 6px;
}

.bg-grid-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  max-height: none;
  overflow-y: auto;
  background: #d4d0c8;
  border: 2px solid #c0c0c0;
  padding: 6px;
  box-shadow: 
    inset 1px 1px 0 rgba(0,0,0,0.8),
    inset 2px 2px 0 rgba(0,0,0,0.4),
    inset -1px -1px 0 rgba(255,255,255,0.8);
}

.bg-grid-preview .bg-card {
  min-width: 80px;
  aspect-ratio: 16/9;
}

.ff-character-stats {
  background: url('/images/ui/textures/panel-bg-dark.png') repeat;
  image-rendering: pixelated;
  border: 2px solid #5a4028;
  padding: 12px;
  font-family: 'Press Start 2P', monospace;
}

.ff-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: none;
}

.ff-stat-row:last-child {
  border-bottom: none;
}

.ff-stat-label {
  color: #c7a465;
  font-size: 0.5em;
  font-weight: normal;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.ff-stat-value {
  color: #ffffff;
  font-size: 0.6em;
  font-weight: normal;
  text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.ff-stat-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ff-nav-btn-small {
  background: #e0e0e0;
  border: 1px solid #c0c0c0;
  padding: 2px 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45em;
  cursor: pointer;
  box-shadow: 
    inset -1px -1px 0 rgba(0,0,0,0.6),
    inset 1px 1px 0 rgba(255,255,255,0.8);
  min-width: 20px;
}

.ff-nav-btn-small:active {
  box-shadow: 
    inset 1px 1px 0 rgba(0,0,0,0.6),
    inset -1px -1px 0 rgba(255,255,255,0.8);
  transform: translate(1px, 1px);
}

/* Right Panel - Customization */
.ff-customization-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0; /* allow grid child to shrink without overflow */
}

.ff-tabs {
  display: flex;
  gap: 0;
  background: transparent;
  padding: 0;
  border: none;
  margin-bottom: -2px; /* Connect tabs to content */
}

.ff-tab {
  flex: 1;
  padding: 8px 16px;
  /* RO inactive tab style */
  background: #d0d0d0;
  border: none;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040;
  color: #000000;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5em;
  font-weight: normal;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-shadow: none;
  margin-right: 2px;
}

.ff-tab:hover {
  background: #d8d8d8;
}

.ff-tab.active {
  /* RO active tab style - raised */
  background: #efefef;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 0 0 0 #808080,
    0 1px 0 0 #808080;
  color: #000000;
  transform: translateY(2px);
  z-index: 2;
}

.ff-tab.active::after {
  /* Remove gold underline */
  content: none;
}

.ff-tab-content {
  background-color: #f5f0e8 !important;
  background-image: url('/images/ui/textures/panel-texture.png');
  background-repeat: repeat;
  image-rendering: pixelated;
  border: 3px solid #c0c0c0 !important;
  box-shadow: 
    inset 1px 1px 0 0 #ffffff,
    inset -1px -1px 0 0 #808080;
  padding: 20px;
  min-height: 350px;
}

.ff-tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.ff-tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ff-section {
  margin-bottom: 25px;
}

.ff-section:last-child {
  margin-bottom: 0;
}

.ff-section-title {
  color: #000000;
  font-size: 0.65em;
  font-weight: normal;
  font-family: 'Press Start 2P', monospace;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #808080;
  text-shadow: none;
  position: relative;
}

.ff-section-title::after {
  /* Remove decorative divider for RO style */
  content: none;
}

/* Color Swatches */
.ff-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ff-color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #3a2618;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.ff-color-swatch:hover {
  border-color: #7a6038;
  transform: scale(1.05);
  box-shadow: 
    0 0 10px rgba(199, 164, 101, 0.5),
    inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.ff-color-swatch.selected {
  border-color: #c7a465;
  border-width: 3px;
  box-shadow: 
    0 0 15px rgba(199, 164, 101, 0.8),
    inset 0 0 8px rgba(0, 0, 0, 0.5);
}

.ff-color-swatch.selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.2em;
  font-weight: bold;
  text-shadow: 
    0 0 3px #000,
    0 0 5px #000,
    1px 1px 2px #000;
}

/* Style Buttons */
.ff-style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ff-style-btn {
  /* RO-style button */
  background: #e0e0e0;
  border: none;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
  padding: 15px 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ff-style-icon {
  font-size: 1.8em;
  filter: grayscale(0);
}

.ff-style-name {
  color: #000000;
  font-size: 0.5em;
  font-weight: normal;
  letter-spacing: 1px;
  font-family: 'Press Start 2P', monospace;
  text-shadow: none;
}

.ff-style-btn:hover {
  background: #efefef;
  transform: translate(0, 0);
}

.ff-style-btn:hover .ff-style-name {
  color: #000000;
}

.ff-style-btn.selected {
  /* Inset/pressed appearance */
  background: #d0d0d0;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
  transform: translate(1px, 1px);
}

.ff-style-btn.selected .ff-style-name {
  color: #000000;
}

.ff-style-btn.selected .ff-style-icon {
  filter: grayscale(0);
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Action Buttons */
.ff-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.ff-action-btn {
  flex: 1;
  padding: 10px 16px;
  /* RO-style button */
  background: #e0e0e0;
  border: none;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
  color: #000000;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5em;
  font-weight: normal;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
  text-shadow: none;
}

/* Primary/large variant for top Apply button */
.ff-action-btn.primary {
  background: #c7a465; /* gold */
  color: #1a1209;
}
.ff-action-btn.primary:hover { background: #d5b37a; }
.ff-action-btn.primary:active {
  background: #b7914f;
  box-shadow:
    inset 1px 1px 0 0 #805f36,
    inset 2px 2px 0 0 #3a2618,
    inset -1px -1px 0 0 #efd7a7;
}
.ff-action-btn.large { padding: 14px 20px; font-size: 0.6em; }

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  font-family: 'VT323', monospace;
  font-size: 16px;
  min-width: 200px;
  text-align: center;
  pointer-events: auto;
}
.toast.success { background: rgba(0, 128, 64, 0.9); }
.toast.error { background: rgba(160, 32, 32, 0.9); }
.toast.info { background: rgba(32, 96, 160, 0.9); }

.ff-action-btn:hover {
  background: #efefef;
  transform: translate(0, 0);
  color: #000000;
}

.ff-action-btn:active {
  background: #d0d0d0;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
  transform: translate(1px, 1px);
}

.ff-randomize {
  background: #e0e0e0;
}

.ff-randomize:hover {
  background: #efefef;
}

/* Pixel Editor */
.pe-wrapper {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.pe-canvas-stack {
  position: relative;
  width: var(--pe-w, 200px);
  height: var(--pe-h, 200px);
  border: 3px solid #7a6038;
  box-shadow: 
    0 0 15px rgba(0, 0, 0, 0.8),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
  background: #000;
  overflow: hidden;
}

/* Remove browser blue focus outlines on canvases/frames */
canvas:focus, .pe-canvas-stack:focus, .ff-portrait-frame:focus { outline: none; }

.pe-canvas-stack::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 16px;
  height: 16px;
  background-image: url('/images/ui/borders/corner-tl.png');
  background-size: 16px 16px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 10;
}

.pe-canvas-stack::after {
  content: '';
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  background-image: url('/images/ui/borders/corner-br.png');
  background-size: 16px 16px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 10;
}

.pe-background-layer {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  z-index: 0;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

#pe-onion, #pe-canvas {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
}

#pe-onion { z-index: 1; }
#pe-canvas { z-index: 2; }
#pe-preview { position:absolute; left:0; top:0; width:100%; height:100%; z-index: 3; pointer-events: none; image-rendering: pixelated; }

.pe-tools { 
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 800px;
}

.pe-row { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  flex-wrap: wrap;
  padding: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}

.pe-row:has(#pe-color-wheel) {
  grid-column: 1 / -1;
  justify-content: center;
}
.pe-hint { color: #8a7050; display: block; margin-top: 8px; }
.pe-row #pe-color-wheel { border: 2px solid #3a2618; box-shadow: inset 0 0 8px rgba(0,0,0,0.6); image-rendering: pixelated; }
.pe-color-wheel-hint { color:#c7a465; font-size: 0.85em; max-width: 300px; }

/* Remove pe-wide - no longer needed with vertical layout */

/* Zoom scaling */
 .pe-canvas-stack.zoom-1 { --pe-w: 200px; --pe-h: 200px; }
.pe-canvas-stack.zoom-2 { --pe-w: 280px; --pe-h: 280px; }
.pe-canvas-stack.zoom-3 { --pe-w: 360px; --pe-h: 360px; }
.pe-canvas-stack.zoom-4 { --pe-w: 440px; --pe-h: 440px; }

.pe-canvas-stack.drag-over {
  border-color: #c7a465;
  box-shadow: 
    0 0 20px rgba(199, 164, 101, 0.8),
    inset 0 0 10px rgba(199, 164, 101, 0.3);
}
.pe-palette { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.pe-swatch { width: 18px; height: 18px; border: 2px solid #3a2618; box-shadow: inset 0 0 4px rgba(0,0,0,0.6); cursor: pointer; }
.pe-swatch:hover { border-color: #7a6038; }

/* CRT overlay */
.pe-crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.06) 0px,
      rgba(255,255,255,0.06) 1px,
      rgba(0,0,0,0.0) 2px,
      rgba(0,0,0,0.0) 4px
    ),
    radial-gradient(ellipse at center, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 40%, rgba(0,0,0,0.2) 100%);
  mix-blend-mode: overlay;
  opacity: 0.7;
}
.pe-crt-overlay.hidden { display: none; }

/* Alignment/Calibration Toolbar */
.ff-align-toolbar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c7a465;
  font-family: 'Courier New', monospace;
}

.ff-action-btn.small {
  padding: 8px 12px;
  font-size: 0.85em;
  flex: 0 0 auto;
}

.ff-align-hint {
  margin-left: auto;
  color: #8a7050;
  font-size: 0.75em;
}

/* Disable gender controls when race is gender-neutral */
.gender-selector.disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .ff-character-sheet {
    grid-template-columns: 1fr;
    padding: 15px;
  }
  
  .ff-preview-panel {
    max-width: 100%;
  }
  
  .ff-tabs {
    flex-wrap: wrap;
  }
  
  .ff-tab {
    flex: 1 1 calc(50% - 1px);
    font-size: 0.85em;
    padding: 10px 15px;
  }
  
  .ff-color-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .ff-style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ff-tab-content {
    min-height: 300px;
  }
}

/* Wider modal on desktop to fit the full designer comfortably */
@media (min-width: 1024px) {
  .profile-modal-content {
    max-width: 1100px;
  }
}

/* Collapse the designer earlier on medium viewports to avoid horizontal scroll */
@media (max-width: 1024px) and (min-width: 769px) {
  .ff-character-sheet {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   END FINAL FANTASY STYLE
   ============================================ */

.faction-card {
  /* RO-style button/card */
  background: #e0e0e0;
  border: none;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
  padding: 15px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.faction-card:hover {
  background: #efefef;
  transform: translate(0, 0);
}

.faction-card.selected {
  /* Inset/pressed appearance */
  background: #d0d0d0;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
  transform: translate(1px, 1px);
}

.faction-card.selected::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 12px;
  color: #000000;
  font-size: 1.5em;
  font-weight: bold;
}

.faction-name {
  color: #000000;
  font-weight: bold;
  font-size: 0.7em;
  margin-bottom: 8px;
  font-family: 'Press Start 2P', monospace;
  text-transform: uppercase;
}

.faction-region {
  color: #404040;
  font-size: 0.65em;
  margin-bottom: 8px;
  font-style: normal;
  font-family: 'VT323', monospace;
}

.faction-desc {
  color: #202020;
  font-size: 0.75em;
  line-height: 1.5;
  font-family: 'VT323', monospace;
}

.profile-submit-btn {
  width: 100%;
  padding: 12px;
  /* RO-style button */
  background: #e0e0e0;
  border: none;
  box-shadow:
    -1px -1px 0 0 #ffffff,
    -2px -2px 0 0 #dfdfdf,
    1px 1px 0 0 #808080,
    2px 2px 0 0 #404040;
  color: #000000;
  font-size: 0.7em;
  font-weight: normal;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-submit-btn:hover {
  background: #efefef;
  transform: translate(0, 0);
}

.profile-submit-btn:active {
  background: #d0d0d0;
  box-shadow:
    inset 1px 1px 0 0 #808080,
    inset 2px 2px 0 0 #404040,
    inset -1px -1px 0 0 #ffffff;
  transform: translate(1px, 1px);
}

/* Profile Display */
/* Profile Display - JRPG Window */
.profile-display {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999; /* ensure overlay above chat */
}

.profile-display.hidden {
  display: none;
}

/* JRPG window look */
.jrpg-window {
  background: url('/images/ui/textures/panel-bg-dark.png') repeat;
  image-rendering: pixelated;
  border: 3px solid #d2b46c;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6), inset 0 0 0 2px #7a6038;
  border-radius: 8px;
  min-width: 320px;
  max-width: 420px;
  color: #e8f0ff;
  font-family: 'Press Start 2P', monospace;
}

.jrpg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: url('/images/ui/textures/panel-bg-dark.png') repeat;
  image-rendering: pixelated;
  border-bottom: 2px solid #7a6038;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  filter: brightness(1.3);
  cursor: move; /* Show draggable cursor on header */
  user-select: none; /* Prevent text selection while dragging */
}

.jrpg-header:active {
  cursor: grabbing;
}

#draggable-status {
  position: relative;
  cursor: default;
}

.jrpg-title {
  letter-spacing: 1px;
  color: #f4d794;
}

.jrpg-actions { display: flex; gap: 6px; }

.jrpg-body {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
}

.jrpg-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
}

.jrpg-portrait-frame {
  width: 80px;
  height: 80px;
  background: #000;
  border: 3px solid #7a6038;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

.jrpg-stats { display: flex; flex-direction: column; gap: 6px; }
.jrpg-row { display: flex; justify-content: space-between; align-items: center; font-size: 10px; }
.jrpg-label { color: #9fc2ff; }
.jrpg-value { color: #ffffff; }

.jrpg-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.jrpg-bar { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 6px; font-size: 10px; }
.jrpg-bar .bar { height: 10px; background: #0b1a2f; border: 2px solid #7a6038; border-radius: 3px; overflow: hidden; }
.jrpg-bar.hp .fill { background: linear-gradient(90deg, #ff4d4d, #ff9494); height: 100%; }
.jrpg-bar.mp .fill { background: linear-gradient(90deg, #3a9bff, #7dc3ff); height: 100%; }
.bar-label { color: #f4d794; }

/* Avatar tile inside JRPG frame */
.profile-avatar {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #f4d794;
  overflow: hidden;
}

.profile-background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.profile-character-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 2;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name-display {
  color: var(--color-xlarthqll-gold);
  font-weight: bold;
  font-size: 1em;
}

.profile-faction-display {
  color: #aaa;
  font-size: 0.85em;
}

.profile-edit-btn {
  background: none;
  border: none;
  color: var(--color-xlarthqll-gold);
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.3s;
  padding: 5px;
}

.profile-edit-btn:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.profile-inventory-btn {
  background: none;
  border: none;
  color: var(--color-xlarthqll-gold);
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.3s;
  padding: 5px;
  text-decoration: none;
  display: inline-block;
}

.profile-inventory-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

.profile-signout-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.3s;
  padding: 5px;
  margin-left: 5px;
}

.profile-signout-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .profile-modal-content {
    padding: 25px;
    max-width: 95%;
  }

  .profile-modal-content h2 {
    font-size: 2em;
  }

  .faction-grid {
    grid-template-columns: 1fr;
  }

  .profile-display { top: auto; bottom: 16px; right: 16px; left: 16px; }
  .jrpg-window { min-width: auto; max-width: 100%; }
  .jrpg-body { grid-template-columns: 72px 1fr; }
  .jrpg-portrait-frame, .profile-avatar { width: 64px; height: 64px; }
}

/* ========================================
   AUTHENTICATION SYSTEM
   ======================================== */

.auth-section {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 999; /* Below profile display which is 1000 */
}

.auth-section.hidden {
  display: none;
}

.auth-btn {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #d4af37;
  border: 1px solid #d4af37;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  transition: all 0.3s ease;
}

.auth-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.auth-btn-primary {
  background: #d4af37;
  color: #000;
}

.auth-btn-primary:hover {
  background: #f0c75e;
}

/* Auth Modals */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
}

.auth-modal-content {
  position: relative;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 2px solid #d4af37;
  border-radius: 12px;
  padding: 40px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(212, 175, 55, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: #d4af37;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s ease;
}

.auth-modal-close:hover {
  transform: rotate(90deg);
  color: #f0c75e;
}

.auth-modal-title {
  font-family: 'UnifrakturMaguntia', cursive;
  color: #d4af37;
  text-align: center;
  margin: 0 0 30px 0;
  font-size: 28px;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form-group label {
  color: #d4af37;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  font-weight: 600;
}

.auth-form-group input {
  padding: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #d4af37;
  border-radius: 6px;
  color: #fff;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  transition: all 0.3s ease;
}

.auth-form-group input:focus {
  outline: none;
  border-color: #f0c75e;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.7);
}

.auth-error {
  color: #ff6b6b;
  font-family: 'IM Fell English', serif;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.auth-submit-btn {
  padding: 14px;
  background: #d4af37;
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'IM Fell English', serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.auth-submit-btn:hover {
  background: #f0c75e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.auth-divider {
  text-align: center;
  color: #888;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  position: relative;
  margin: 10px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #444;
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.auth-google-btn {
  padding: 12px;
  background: #fff;
  color: #444;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.auth-google-btn img {
  width: 20px;
  height: 20px;
}

.auth-google-btn:hover {
  background: #f8f8f8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-switch {
  text-align: center;
  color: #888;
  font-family: 'IM Fell English', serif;
  font-size: 13px;
  margin-top: 20px;
}

.auth-switch a {
  color: #d4af37;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-switch a:hover {
  color: #f0c75e;
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .auth-section {
    top: 60px; /* Below hamburger menu */
    right: 10px;
    gap: 8px;
    flex-direction: column;
    align-items: flex-end;
  }
  
  .auth-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .auth-modal-content {
    padding: 30px 20px;
    max-width: 90%;
  }
  
  .auth-modal-title {
    font-size: 22px;
  }
}

/* ===== INVENTORY PAGE ===== */
.inventory-shell {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
  font-family: 'Tahoma', sans-serif;
}

.inventory-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 2px solid #d4af37;
  margin-bottom: 30px;
}

.inventory-title {
  font-family: 'IM Fell English', serif;
  font-size: 32px;
  color: #d4af37;
  margin: 0;
}

.inventory-nav {
  display: flex;
  gap: 15px;
}

.inventory-nav a {
  color: #fff;
  text-decoration: none;
  padding: 8px 15px;
  border: 2px solid #d4af37;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.inventory-nav a:hover {
  background: #d4af37;
  color: #1a1a2e;
}

.inventory-main {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
}

.inventory-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.inventory-char-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 20px;
}

.inv-char-portrait img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 2px solid #d4af37;
  margin-bottom: 15px;
}

.inv-char-info h2 {
  margin: 0 0 5px;
  color: #d4af37;
  font-family: 'IM Fell English', serif;
}

.inv-char-race,
.inv-char-level,
.inv-char-gold {
  margin: 5px 0;
  font-size: 14px;
  color: #ccc;
}

.inv-char-stats {
  margin-top: 15px;
}

.stat-bar {
  display: grid;
  grid-template-columns: 30px 1fr 70px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  font-weight: bold;
  color: #d4af37;
}

.stat-bar-fill {
  height: 18px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.stat-bar-value {
  height: 100%;
  transition: width 0.3s ease;
}

.hp-bar .stat-bar-value {
  background: linear-gradient(90deg, #ff4444, #cc0000);
}

.mp-bar .stat-bar-value {
  background: linear-gradient(90deg, #4444ff, #0000cc);
}

.xp-bar .stat-bar-value {
  background: linear-gradient(90deg, #44ff44, #00cc00);
}

.stat-text {
  font-size: 11px;
  color: #ccc;
  text-align: right;
}

.inv-char-combat-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #444;
}

.inv-char-combat-stats span {
  font-size: 13px;
  color: #d4af37;
  font-weight: bold;
}

.inventory-equipped {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 20px;
}

.inventory-equipped h3 {
  margin: 0 0 15px;
  color: #d4af37;
  font-family: 'IM Fell English', serif;
  font-size: 20px;
}

.equipped-slot {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  border-radius: 4px;
}

.slot-label {
  font-size: 12px;
  color: #999;
  margin-bottom: 5px;
}

.slot-item {
  font-size: 14px;
  color: #fff;
  font-weight: bold;
}

.inventory-items-panel {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 20px;
  min-height: 500px;
}

.inventory-grid {
  min-height: 200px;
}

.inventory-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-style: italic;
}

.inventory-group {
  margin-bottom: 30px;
}

.inventory-group-title {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  color: #d4af37;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #444;
}

.inventory-group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.inventory-item {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #666;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.inventory-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
  border-color: #d4af37;
}

.inventory-item.rarity-common {
  border-color: #999;
}

.inventory-item.rarity-uncommon {
  border-color: #44ff44;
}

.inventory-item.rarity-rare {
  border-color: #4444ff;
}

.inventory-item.rarity-epic {
  border-color: #aa00ff;
}

.inventory-item.rarity-legendary {
  border-color: #ff8800;
}

.inventory-item.equipped {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
}

.item-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 8px;
}

.item-name {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  margin-bottom: 5px;
}

.item-stats {
  font-size: 11px;
  color: #44ff44;
  text-align: center;
}

.item-equipped-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #d4af37;
  color: #000;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
}

.inventory-message {
  text-align: center;
  padding: 80px 20px;
}

.inventory-message h2 {
  color: #d4af37;
  font-family: 'IM Fell English', serif;
  margin-bottom: 15px;
}

.inventory-message p {
  color: #ccc;
  margin-bottom: 20px;
}

.inventory-message .btn {
  display: inline-block;
  padding: 10px 20px;
  background: #d4af37;
  color: #1a1a2e;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.inventory-message .btn:hover {
  background: #fff;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .inventory-main {
    grid-template-columns: 1fr;
  }
  
  .inventory-group-items {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* ===== INVENTORY SYSTEM ===== */
.inventory-shell {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #eee;
}

.inventory-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(0,0,0,0.3);
  border: 2px solid #d4af37;
  margin-bottom: 20px;
}

.inventory-title {
  font-family: 'IM Fell English', serif;
  color: #d4af37;
  margin: 0;
  font-size: 2rem;
}

.inventory-nav {
  display: flex;
  gap: 15px;
}

.inventory-nav a {
  color: #d4af37;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid #d4af37;
  transition: all 0.3s;
}

.inventory-nav a:hover {
  background: #d4af37;
  color: #000;
}

.inventory-main {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
}

.inventory-stats-panel {
  background: rgba(0,0,0,0.5);
  border: 2px solid #d4af37;
  padding: 20px;
}

.inventory-char-card {
  margin-bottom: 20px;
}

.inv-char-portrait img {
  width: 120px;
  height: 120px;
  border: 2px solid #d4af37;
  border-radius: 8px;
  display: block;
  margin: 0 auto 15px;
  image-rendering: pixelated;
}

.inv-char-info {
  text-align: center;
  margin-bottom: 15px;
}

.inv-char-info h2 {
  color: #d4af37;
  margin: 0 0 5px;
  font-size: 1.5rem;
}

.inv-char-race, .inv-char-level {
  color: #aaa;
  margin: 3px 0;
  font-size: 0.9rem;
}

.inv-char-gold {
  color: #ffd700;
  font-weight: bold;
  margin-top: 10px;
}

.inv-char-stats {
  margin-bottom: 15px;
}

.stat-bar {
  margin-bottom: 10px;
}

.stat-label {
  font-size: 0.8rem;
  color: #aaa;
  display: inline-block;
  width: 30px;
}

.stat-bar-fill {
  display: inline-block;
  width: calc(100% - 90px);
  height: 18px;
  background: #222;
  border: 1px solid #555;
  position: relative;
  margin: 0 8px;
  vertical-align: middle;
}

.stat-bar-value {
  height: 100%;
  transition: width 0.5s ease;
}

.hp-bar .stat-bar-value {
  background: linear-gradient(90deg, #ff4444, #ff6666);
}

.mp-bar .stat-bar-value {
  background: linear-gradient(90deg, #4444ff, #6666ff);
}

.xp-bar .stat-bar-value {
  background: linear-gradient(90deg, #44ff44, #66ff66);
}

.stat-text {
  font-size: 0.75rem;
  color: #ddd;
  display: inline-block;
  width: 50px;
  text-align: right;
  vertical-align: middle;
}

.inv-char-combat-stats {
  display: flex;
  justify-content: space-around;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid #555;
}

.inv-char-combat-stats span {
  font-size: 0.9rem;
  color: #d4af37;
}

.inventory-equipped h3 {
  color: #d4af37;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.equipped-slot {
  background: rgba(0,0,0,0.3);
  border: 1px solid #555;
  padding: 10px;
  margin-bottom: 8px;
}

.slot-label {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 5px;
}

.slot-item {
  color: #fff;
  font-size: 0.9rem;
}

.inventory-items-panel {
  background: rgba(0,0,0,0.5);
  border: 2px solid #d4af37;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}

.inventory-grid {
  min-height: 200px;
}

.inventory-empty {
  text-align: center;
  padding: 40px;
  color: #888;
  font-size: 1.1rem;
}

.inventory-group {
  margin-bottom: 30px;
}

.inventory-group-title {
  color: #d4af37;
  font-size: 1.3rem;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d4af37;
}

.inventory-group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.inventory-item {
  background: rgba(0,0,0,0.6);
  border: 2px solid #555;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.inventory-item:hover {
  border-color: #d4af37;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.inventory-item.equipped {
  border-color: #4af;
  background: rgba(68, 170, 255, 0.1);
}

.inventory-item.rarity-common {
  border-color: #aaa;
}

.inventory-item.rarity-uncommon {
  border-color: #5f5;
}

.inventory-item.rarity-rare {
  border-color: #55f;
}

.inventory-item.rarity-epic {
  border-color: #a5f;
}

.inventory-item.rarity-legendary {
  border-color: #fa5;
}

.item-icon {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 8px;
}

.item-name {
  font-weight: bold;
  color: #fff;
  margin-bottom: 5px;
  text-align: center;
}

.item-stats {
  font-size: 0.8rem;
  color: #5f5;
  text-align: center;
}

.item-equipped-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #4af;
  color: #000;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 3px;
}

.inventory-message {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}

.inventory-message h2 {
  color: #d4af37;
  margin-bottom: 20px;
}

.inventory-message .btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  background: #d4af37;
  color: #000;
  text-decoration: none;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.inventory-message .btn:hover {
  background: #f0c040;
  transform: translateY(-2px);
}

/* ========================================
   ENCOUNTER SYSTEM STYLES
   ======================================== */

.encounter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.encounter-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.encounter-container {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a1a1a 100%);
  border: 3px solid #d4af37;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
  overflow: hidden;
}

.encounter-header {
  background: url('/images/ui/textures/panel-bg-dark.png') repeat;
  border-bottom: 2px solid #d4af37;
  padding: 15px;
  text-align: center;
}

.encounter-title {
  margin: 0;
  color: #d4af37;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.encounter-body {
  padding: 20px;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

.encounter-enemy {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #d4af37;
  border-radius: 8px;
}

.enemy-portrait {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.enemy-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #333, #222);
  border: 2px solid #d4af37;
  border-radius: 8px;
  font-size: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.enemy-info {
  flex: 1;
}

.enemy-name {
  margin: 0 0 5px 0;
  color: #d4af37;
  font-size: 1.3rem;
}

.enemy-level {
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.enemy-hp-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-label {
  color: #d4af37;
  font-weight: bold;
  min-width: 30px;
}

.enemy-hp-bar, .player-hp-bar, .player-mp-bar {
  position: relative;
  flex: 1;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #d4af37;
  border-radius: 4px;
  overflow: hidden;
}

.enemy-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #cc0000);
  transition: width 0.5s ease;
}

.player-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #44ff44, #00cc00);
  transition: width 0.5s ease;
}

.player-mp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4444ff, #0000cc);
  transition: width 0.5s ease;
}

.enemy-hp-text, .player-hp-text, .player-mp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-size: 0.85rem;
}

.encounter-log {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #d4af37;
  border-radius: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.log-content {
  color: #ddd;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.log-content div {
  margin-bottom: 5px;
}

.encounter-player {
  margin-bottom: 20px;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-stat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.encounter-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.encounter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  background: linear-gradient(135deg, #d4af37, #f4d03f);
  border: 2px solid #d4af37;
  border-radius: 8px;
  color: #1a1a1a;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.encounter-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

.encounter-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 1.5rem;
}

.btn-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
}

.attack-btn {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  border-color: #ff4444;
}

.defend-btn {
  background: linear-gradient(135deg, #4444ff, #0000cc);
  border-color: #4444ff;
}

.item-btn {
  background: linear-gradient(135deg, #44ff44, #00cc00);
  border-color: #44ff44;
}

.flee-btn {
  background: linear-gradient(135deg, #888, #555);
  border-color: #888;
}

.encounter-result {
  text-align: center;
  padding: 30px;
}

.result-title {
  color: #d4af37;
  font-size: 2rem;
  margin-bottom: 20px;
}

.result-content {
  color: #ddd;
  line-height: 1.8;
  margin-bottom: 30px;
}

.continue-btn {
  grid-column: 1 / -1;
}

/* ========================================
   CONSOLE QUICK ACTION BUTTONS
   ======================================== */

.quick-actions {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 100, 200, 0.1);
  border: 2px solid #00ffff;
  border-radius: 8px;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #00ffff; }
  50% { border-color: #0080ff; }
}

.quick-actions-label {
  color: #00ffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  margin-bottom: 12px;
  text-align: center;
  text-shadow: 0 0 10px #00ffff;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.quick-action-btn {
  padding: 12px 16px;
  background: linear-gradient(135deg, #003366, #004488);
  border: 2px solid #00ffff;
  border-radius: 6px;
  color: #00ffff;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.quick-action-btn::before {
  content: '▶';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.quick-action-btn:hover {
  background: linear-gradient(135deg, #004488, #0066aa);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  transform: translateX(5px);
  padding-left: 28px;
}

.quick-action-btn:hover::before {
  opacity: 1;
}

.quick-action-btn:active {
  transform: translateX(5px) scale(0.98);
}

.quick-action-number {
  display: inline-block;
  background: #00ffff;
  color: #000;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: bold;
  margin-right: 8px;
  font-size: 0.85rem;
}

.quick-action-text {
  color: #ffffff;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-action-btn {
    font-size: 0.9rem;
    padding: 10px 14px;
  }
}
