:root {
  --pixel-font: 'Press Start 2P', 'Courier New', monospace, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hidden {
  display: none !important;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--pixel-font);
  font-size: clamp(9px, 2vw, 11px);
  line-height: 1.8;
  background: radial-gradient(circle at 50% 20%, #2f1d13 0%, #1a0f09 50%, #0d0603 100%);
  background-attachment: fixed;
  color: #f7e7c4;
  image-rendering: pixelated;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--pixel-font);
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}

/* PWA Install Banner */
.pwa-banner {
  position: relative;
  width: 100%;
  background: linear-gradient(90deg, #0984e3, #00cec9);
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(8px, 1.8vw, 10px);
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.pwa-banner.hidden {
  display: none;
}

.btn-sm-primary {
  background: #fbc531;
  color: #2f3640;
  border: none;
  padding: 5px 14px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
}

.btn-sm-text {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

/* Portal Container (Main Hub) - MMO In-Game Gateway Floating Window */
.portal-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  padding: clamp(12px, 2.5vw, 24px) clamp(10px, 2vw, 20px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(circle at 50% 25%, rgba(47, 29, 19, 0.86) 0%, rgba(26, 15, 9, 0.93) 50%, rgba(13, 6, 3, 0.97) 100%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-area h1 {
  font-size: clamp(14px, 3.5vw, 22px);
  color: #fbc531;
  text-shadow: 2px 2px 0 #3a1d00, 0 0 12px rgba(251, 197, 49, 0.4);
  margin-bottom: 4px;
}

.tagline {
  font-size: clamp(8px, 1.8vw, 10px);
  color: #caa078;
}

.user-profile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #3a2215 0%, #1f110a 100%);
  padding: 6px 12px;
  border: 3px solid #6b3e21;
  box-shadow: inset 0 1px 0 #945a33, 0 4px 10px rgba(0,0,0,0.6);
  border-radius: 4px;
}

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

.user-avatar-badge {
  font-size: 1.4rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name-txt {
  font-weight: bold;
  font-size: clamp(8px, 1.8vw, 10px);
  color: #fff4d1;
}

.badges-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.badge {
  font-size: 7px;
  font-weight: bold;
  padding: 2px 6px;
  text-transform: uppercase;
  background: #5a361e;
  color: #fffaea;
  border: 1px solid #140b06;
  border-radius: 2px;
}

.badge-superadmin { background: #b83226; color: #fff; }
.badge-admin { background: #2980b9; color: #fff; }
.badge-user { background: #27ae60; color: #fff; }
.badge-tier-free { background: #718093; color: #fff; }
.badge-tier-premium { background: #d48b28; color: #fff; }

.btn-logout {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.1s;
}
.btn-logout:hover {
  transform: scale(1.15);
}

/* Retro RPGUI Navigation Tabs */
.portal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  justify-content: center;
  border-bottom: 4px solid #140b06;
  padding-bottom: 4px;
}

.nav-tab.nes-btn {
  font-size: clamp(8px, 1.8vw, 10px) !important;
  padding: 8px 14px !important;
  margin: 0 !important;
  flex: 1 1 auto;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(180deg, #4d2e19 0%, #2b170c 100%) !important;
  border: 3px solid #140a05 !important;
  border-bottom: none !important;
  box-shadow: inset 0 2px 0 #7e4d2a, inset 0 -2px 0 #180c06, 0 3px 0 #0d0603 !important;
  color: #cca984 !important;
  border-radius: 4px 4px 0 0 !important;
  cursor: pointer;
  transition: all 0.15s ease !important;
  text-shadow: 1px 1px 0 #000;
}

.nav-tab.nes-btn:hover {
  background: linear-gradient(180deg, #5e3921 0%, #381e10 100%) !important;
  color: #ffe6aa !important;
  transform: translateY(-1px);
}

.nav-tab.nes-btn.active {
  background: linear-gradient(180deg, #7c4823 0%, #4a2711 100%) !important;
  border: 3px solid #e5a93c !important;
  border-bottom: 3px solid #4a2711 !important;
  box-shadow: inset 0 2px 0 #ffd678, inset 0 -1px 0 #331908, 0 -3px 12px rgba(229, 169, 60, 0.4) !important;
  color: #fff4d1 !important;
  text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255, 214, 120, 0.7) !important;
  transform: translateY(-2px) !important;
}

.nav-tab.hidden {
  display: none !important;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* NES Container & Card Customizations (RPGUI Medieval Oak Frame) */
.nes-container.is-dark,
.rpgui-container,
.modal-card {
  background: linear-gradient(180deg, #25170f 0%, #150c07 100%) !important;
  border: 4px solid #0f0804 !important;
  outline: 3px solid #5a361e !important;
  outline-offset: -3px;
  color: #f7e7c4 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.85), inset 0 0 16px rgba(0,0,0,0.6), inset 0 2px 0 #84502d !important;
  margin-bottom: 20px;
  padding: clamp(16px, 3vw, 24px) clamp(12px, 2.5vw, 22px) !important;
  box-sizing: border-box;
  position: relative !important;
  border-radius: 4px !important;
}

/* Golden Corner Brackets for RPGUI Containers */
.nes-container.is-dark::before,
.modal-card::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-top: 3px solid #e5a93c;
  border-left: 3px solid #e5a93c;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(229, 169, 60, 0.6));
}

.nes-container.is-dark::after,
.modal-card::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-bottom: 3px solid #e5a93c;
  border-right: 3px solid #e5a93c;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(229, 169, 60, 0.6));
}

.nes-container.with-title > .title {
  background: linear-gradient(180deg, #5c3517 0%, #331c0c 100%) !important;
  border: 2px solid #e5a93c !important;
  box-shadow: inset 0 1px 0 #ffda79, 0 3px 0 #0e0703 !important;
  color: #fff4d1 !important;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(241, 196, 15, 0.5) !important;
  font-size: clamp(10px, 2.2vw, 13px) !important;
  margin-top: -1.9rem !important;
  margin-bottom: 0.8rem !important;
  padding: 3px 12px !important;
  border-radius: 2px !important;
}

.card h3 {
  color: #fbc531;
  font-size: clamp(11px, 2.5vw, 14px);
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 #000;
}

/* Form Groups */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: clamp(8px, 1.8vw, 10px);
  font-weight: bold;
  margin-bottom: 6px;
  color: #f5f6fa;
}

.form-group input, 
.input-with-list select,
.nes-input.is-dark,
.nes-textarea.is-dark {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pixel-font) !important;
  font-size: clamp(8px, 1.8vw, 10px) !important;
  background-color: #120a06 !important;
  border: 3px solid #3e2415 !important;
  box-shadow: inset 3px 3px 6px #000, inset -1px -1px 0 #5c371f !important;
  color: #ffda79 !important;
  outline: none;
  border-radius: 2px !important;
}

.form-group input:focus,
.nes-input.is-dark:focus,
.nes-textarea.is-dark:focus,
.nes-select.is-dark select:focus {
  border-color: #e5a93c !important;
  box-shadow: inset 2px 2px 5px #000, 0 0 10px rgba(229, 169, 60, 0.5) !important;
}

.input-with-list {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-list input {
  flex: 1.4;
}

.input-with-list .quick-select-wrapper {
  flex: 1;
}

.nes-select.is-dark select {
  font-family: var(--pixel-font) !important;
  font-size: clamp(8px, 1.8vw, 10px) !important;
  background-color: #120a06 !important;
  color: #ffda79 !important;
  border: 3px solid #3e2415 !important;
  box-shadow: inset 3px 3px 6px #000, inset -1px -1px 0 #5c371f !important;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-option {
  font-size: 1.4rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1b100a;
  border: 3px solid #4d2e19;
  box-shadow: inset 0 1px 0 #6d4226, 0 2px 5px rgba(0,0,0,0.5);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.1s ease;
}

.avatar-option.selected {
  border-color: #e5a93c;
  background: #3d2415;
  box-shadow: inset 0 1px 0 #ffd678, 0 0 8px rgba(229, 169, 60, 0.5);
  transform: scale(1.1);
}

.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  border: 3px solid transparent;
}

.color-option.selected {
  border-color: #e5a93c;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(229, 169, 60, 0.6);
}

/* RPGUI 3D Beveled Wooden Buttons */
.nes-btn,
.rpgui-btn {
  font-family: var(--pixel-font) !important;
  background: linear-gradient(180deg, #6c3f24 0%, #412412 100%) !important;
  border: 3px solid #160c06 !important;
  box-shadow: inset 0 2px 0 #9f633a, inset 0 -2px 0 #201007, 0 4px 0 #0d0603 !important;
  color: #fffaea !important;
  text-shadow: 1px 1px 0 #000 !important;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease !important;
  border-radius: 3px !important;
}

.nes-btn:hover,
.rpgui-btn:hover {
  filter: brightness(1.15) !important;
}

.nes-btn:active,
.rpgui-btn:active {
  box-shadow: inset 0 3px 0 #0e0703, 0 1px 0 #0e0703 !important;
  transform: translateY(3px) !important;
}

.nes-btn.is-primary {
  background: linear-gradient(180deg, #d88d29 0%, #8c510b 100%) !important;
  border: 3px solid #361902 !important;
  box-shadow: inset 0 2px 0 #ffda76, inset 0 -2px 0 #4d2703, 0 4px 0 #180900 !important;
  color: #ffffff !important;
  text-shadow: 1px 1px 0 #281300 !important;
}

.nes-btn.is-success {
  background: linear-gradient(180deg, #2b9c54 0%, #176031 100%) !important;
  border: 3px solid #092e15 !important;
  box-shadow: inset 0 2px 0 #63e394, inset 0 -2px 0 #0d3b1e, 0 4px 0 #05180b !important;
  color: #ffffff !important;
  text-shadow: 1px 1px 0 #051a0d !important;
}

.nes-btn.is-warning {
  background: linear-gradient(180deg, #e47919 0%, #924706 100%) !important;
  border: 3px solid #3f1a01 !important;
  box-shadow: inset 0 2px 0 #ffb467, inset 0 -2px 0 #522302, 0 4px 0 #1c0a00 !important;
  color: #ffffff !important;
  text-shadow: 1px 1px 0 #230d00 !important;
}

.nes-btn.is-error {
  background: linear-gradient(180deg, #b93327 0%, #721b13 100%) !important;
  border: 3px solid #360905 !important;
  box-shadow: inset 0 2px 0 #f37769, inset 0 -2px 0 #440e08, 0 4px 0 #190302 !important;
  color: #ffffff !important;
  text-shadow: 1px 1px 0 #210403 !important;
}

#btn-join-room {
  width: 100%;
  padding: 12px !important;
  margin-top: 10px;
  font-size: clamp(10px, 2.2vw, 13px) !important;
}

/* Admin Dashboard Specific */
.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.room-card {
  background: linear-gradient(180deg, #2b1b11 0%, #170d07 100%) !important;
  border: 3px solid #5b361e !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.7), inset 0 1px 0 #89512e !important;
  border-radius: 4px !important;
  padding: 14px 12px !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.room-card:hover {
  border-color: #e5a93c !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.85), inset 0 1px 0 #ffd678, 0 0 12px rgba(229, 169, 60, 0.3) !important;
  transform: translateY(-2px);
}

.room-card h4 {
  color: #fbc531;
  font-size: clamp(10px, 2.2vw, 13px);
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 #000;
}

.room-pin-display {
  background: #110905;
  border: 2px dashed #e5a93c;
  padding: 6px 10px;
  border-radius: 3px;
  display: inline-block;
}

.room-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.room-card-actions .nes-btn {
  flex: 1 1 calc(33% - 6px);
  font-size: clamp(7px, 1.6vw, 9px) !important;
  padding: 6px 4px !important;
  margin: 0 !important;
}

/* Superadmin Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  padding: 10px 8px !important;
  text-align: center;
  font-size: clamp(7px, 1.6vw, 9px) !important;
  margin: 0 !important;
}

.stat-num {
  display: block;
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: bold;
  color: #00a8ff;
  margin-bottom: 4px;
}

.settings-box {
  padding: 14px !important;
  margin-bottom: 20px;
}

.input-inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.input-inline input {
  flex: 1 1 200px;
}

.input-inline button {
  flex: 0 0 auto;
}

/* Data Table Responsive */
.nes-table-responsive {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nes-table {
  width: 100% !important;
  table-layout: auto !important;
  font-size: clamp(7px, 1.6vw, 9px) !important;
}

.nes-table th, .nes-table td {
  padding: 8px 6px !important;
  white-space: normal !important;
  word-break: break-word !important;
}

/* Auth Card */
.auth-section {
  padding: 14px !important;
  text-align: center;
  margin-bottom: 16px;
}

.auth-section h4 {
  margin-bottom: 10px;
  font-size: clamp(9px, 2vw, 11px);
}

.divider {
  text-align: center;
  margin: 18px 0;
  position: relative;
}

.divider span {
  background: #212529;
  padding: 0 10px;
  color: #718093;
  font-size: clamp(7px, 1.6vw, 9px);
  font-weight: bold;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #4b6584;
  z-index: -1;
}

.demo-login-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.demo-login-grid .nes-btn {
  font-size: clamp(8px, 1.8vw, 10px) !important;
  padding: 10px 8px !important;
  text-align: left;
  white-space: normal;
  line-height: 1.5;
}

.btn-demo:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* In-Game & Canvas Overlay Styles (RPG Maker Pixel Aesthetic) */
#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  touch-action: none;
  background-color: #111827;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

#game-ui {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  pointer-events: none;
}

#game-ui > * {
  pointer-events: auto;
}

.top-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

/* RPG Maker Classic Windowskin Pill */
.info-pill {
  background: linear-gradient(180deg, #102a54 0%, #06152d 100%);
  border: 2px double #e2e8f0;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.8), 0 2px 8px rgba(0,0,0,0.6);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

.score-pill { color: #fbc531; }

.btn-danger-pill {
  background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 100%) !important;
  border: 2px double #fca5a5 !important;
  color: white !important;
  border-radius: 6px !important;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 0 #000;
}

.top-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(47, 54, 64, 0.85);
  border: 1px solid #718093;
  color: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
}

/* Announcement Banner */
.announcement {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(46, 204, 113, 0.95);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  z-index: 15;
}

.announcement.hidden {
  display: none;
}

/* Prompt Interaksi (RPG Dialogue Window Style) */
.interact-prompt {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #102a54 0%, #06152d 100%);
  border: 2px double #fbc531;
  color: #fff;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  z-index: 15;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.8), 0 4px 12px rgba(0,0,0,0.6);
  text-shadow: 1px 1px 0 #000;
  animation: bounce 1s infinite alternate;
}

.interact-prompt.hidden { display: none; }

@keyframes bounce {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, -6px); }
}

/* Mobile Virtual Controls */
#mobile-controls {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  height: 140px;
  pointer-events: none;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  padding: 0 25px;
}

#joystick-zone {
  width: 120px;
  height: 120px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#joystick-base {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  position: relative;
  touch-action: none;
}

#joystick-stick {
  width: 44px;
  height: 44px;
  background: rgba(0, 168, 255, 0.85);
  border: 2px solid #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#action-zone {
  width: 120px;
  height: 120px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn {
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbc531, #e1b12c);
  border: 3px solid #fff;
  color: #2f3640;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.action-btn.active-glow {
  animation: pulse-glow 1s infinite alternate;
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 10px #fbc531; }
  to { box-shadow: 0 0 30px #fbc531; }
}

/* Chat Input Bar */
.chat-bar {
  position: absolute;
  bottom: 80px;
  left: 20px;
  right: 20px;
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid #00a8ff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  z-index: 950;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.chat-bar.hidden { display: none; }

.chat-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px 12px;
  font-size: 0.95rem;
  outline: none;
}

.btn-send {
  background: #00a8ff;
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
}

/* Modals - 100% Responsive NES Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 5, 3, 0.82) !important;
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 150;
  padding: clamp(8px, 2vw, 16px);
  box-sizing: border-box;
}

.modal-overlay.hidden { display: none !important; }

.modal-card {
  background: linear-gradient(180deg, #25170f 0%, #150c07 100%) !important;
  border: 4px solid #0f0804 !important;
  outline: 3px solid #5a361e !important;
  outline-offset: -3px;
  width: min(94vw, 560px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 35px rgba(0,0,0,0.85), inset 0 0 16px rgba(0,0,0,0.6), inset 0 2px 0 #84502d !important;
  box-sizing: border-box;
  padding: clamp(14px, 2.5vw, 22px) clamp(10px, 2vw, 18px) !important;
  margin: 0 auto;
  position: relative !important;
  border-radius: 4px !important;
}

.modal-card.modal-lg {
  width: min(95vw, 760px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 2px dashed #4b6584;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.btn-close {
  background: #e74c3c;
  color: #fff;
  border: 2px solid #fff;
  font-family: var(--pixel-font);
  font-size: clamp(9px, 2vw, 11px);
  padding: 3px 8px;
  cursor: pointer;
  line-height: 1.2;
}

.btn-close:hover {
  background: #c0392b;
}

.modal-body {
  padding: 8px 4px !important;
  overflow-y: auto;
  font-size: clamp(8px, 1.8vw, 10px);
  line-height: 1.8;
  color: #f5f6fa;
  flex: 1;
}

.modal-footer {
  padding-top: 12px;
  border-top: 2px dashed #4b6584;
  margin-top: 10px;
}

.modal-subhead-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 6px 0;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quiz Specific */
.quiz-question {
  font-size: clamp(9px, 2vw, 11px);
  font-weight: 600;
  margin-bottom: 14px;
  color: #fbc531;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-btn.nes-btn {
  width: 100%;
  font-size: clamp(8px, 1.8vw, 10px) !important;
  text-align: left;
  padding: 10px 8px !important;
  margin: 2px 0 !important;
  white-space: normal;
  line-height: 1.5;
}

.quiz-feedback {
  margin-top: 14px;
  padding: 10px;
  font-weight: bold;
  font-size: clamp(8px, 1.8vw, 10px);
  text-align: center;
  border: 2px solid;
}

.quiz-feedback.success {
  background: rgba(46, 204, 113, 0.2);
  border-color: #2ecc71;
  color: #2ecc71;
}

.quiz-feedback.error {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  color: #e74c3c;
}

/* Leaderboard */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leader-item {
  display: flex;
  align-items: center;
  padding: 8px !important;
  margin: 0 !important;
  font-size: clamp(8px, 1.8vw, 10px) !important;
}

.leader-rank {
  font-weight: bold;
  width: 32px;
  color: #fbc531;
}

.leader-avatar { font-size: 1.2rem; margin-right: 8px; }
.leader-name { flex: 1; font-weight: 600; }
.leader-score { font-weight: bold; color: #fbc531; }

/* Guest Badge Notice */
.guest-badge-notice {
  background: rgba(46, 204, 113, 0.15);
  border: 2px dashed #2ecc71;
  color: #2ecc71;
  padding: 10px 12px;
  font-size: clamp(8px, 1.8vw, 9.5px);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.6;
}

/* Admin Sub Navigation */
.subnav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 2px dashed #4b6584;
  padding-bottom: 8px;
  flex-wrap: wrap;
}

.subnav-btn.nes-btn {
  font-size: clamp(8px, 1.8vw, 10px) !important;
  padding: 8px 12px !important;
  margin: 2px !important;
}

/* Bank Soal UI */
.bank-packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin: 10px 0 16px 0;
}

.bank-package-card {
  background: linear-gradient(180deg, #2b1b11 0%, #170d07 100%) !important;
  border: 3px solid #5b361e !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.7), inset 0 1px 0 #89512e !important;
  border-radius: 4px !important;
  padding: 14px 12px !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.bank-package-card:hover {
  border-color: #e5a93c !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.85), inset 0 1px 0 #ffd678, 0 0 12px rgba(229, 169, 60, 0.3) !important;
  transform: translateY(-2px);
}

.package-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.package-name {
  font-size: clamp(9px, 2vw, 11px);
  font-weight: bold;
  color: #fbc531;
}

.package-count-badge {
  font-size: 7.5px;
  background: #27ae60;
  color: #fff;
  padding: 2px 6px;
  border-radius: 2px;
}

.package-desc {
  font-size: 8px;
  color: #a4b0be;
  margin-bottom: 12px;
  line-height: 1.5;
}

.bank-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: clamp(8px, 1.8vw, 10px);
  flex-wrap: wrap;
}

.bank-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #3d2516 0%, #22130a 100%) !important;
  border: 3px solid #e5a93c !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.7), inset 0 1px 0 #ffd678 !important;
  padding: 10px 14px !important;
  border-radius: 4px;
}

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

#selected-questions-count {
  font-weight: bold;
  font-size: clamp(8.5px, 2vw, 11px);
  color: #fbc531;
}

.bank-select-wrapper {
  flex: 1 1 200px;
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.question-card {
  background: linear-gradient(180deg, #25170f 0%, #150c07 100%) !important;
  border: 3px solid #4a2c18 !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 1px 0 #734526 !important;
  border-radius: 4px !important;
  padding: 12px !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.question-card.is-selected-card {
  border-color: #e5a93c !important;
  background: linear-gradient(180deg, #3d2516 0%, #25150c 100%) !important;
  box-shadow: 0 0 14px rgba(229, 169, 60, 0.5), inset 0 1px 0 #ffd678 !important;
}

.q-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 6px;
  flex-wrap: wrap;
}

.q-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.q-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.q-checkbox-tag {
  font-size: 7.5px;
  font-weight: bold;
  padding: 2px 6px;
  background: #353b48;
  border: 1px solid #718093;
  color: #dcdde1;
  display: inline-block;
  letter-spacing: 0.5px;
}

.q-checkbox-tag.is-checked {
  background: #27ae60;
  border-color: #2ecc71;
  color: #fff;
}

.q-category-tag {
  align-self: flex-start;
  background: #00a8ff;
  color: #fff;
  font-size: 7px;
  font-weight: bold;
  padding: 2px 6px;
}

.room-pin-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111;
  border: 2px solid #fbc531;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.quiz-previews-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-preview-item {
  background: #1e272e !important;
  border: 2px solid #485460 !important;
  margin: 4px 0 !important;
  padding: 8px !important;
}

.q-text {
  font-weight: 600;
  font-size: clamp(8px, 1.8vw, 10px);
  margin-bottom: 8px;
  color: #fbc531;
  line-height: 1.6;
}

.q-options-list {
  font-size: clamp(7.5px, 1.6vw, 9px);
  color: #dcdde1;
  margin-bottom: 8px;
  line-height: 1.6;
}

.q-options-list .correct-ans {
  color: #2ecc71;
  font-weight: bold;
}

.q-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: clamp(7.5px, 1.6vw, 9px);
  color: #a4b0be;
  border-top: 1px dashed #4b6584;
  padding-top: 6px;
}

/* ==========================================
   MOB BATTLE & SPEED MATH STYLES (NES Pixel)
   ========================================== */
.modal-battle {
  border-color: #e74c3c !important;
  box-shadow: 0 0 30px rgba(231, 76, 60, 0.4) !important;
}

/* Numeric Mob (Side Mob) Theme: Ungu Neon / Cyan Matematika */
.modal-battle.is-math-mob {
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.45) !important;
}

.modal-battle.is-math-mob .battle-header {
  border-bottom: 2px dashed #8b5cf6 !important;
  background: rgba(139, 92, 246, 0.15) !important;
}

.modal-battle.is-math-mob .mob-info-title h2 {
  color: #c4b5fd !important;
}

.modal-battle.is-math-mob .math-question-box {
  border-color: #06b6d4 !important;
  background: #0f172a !important;
}

.modal-battle.is-math-mob .math-q-equation {
  color: #38bdf8 !important;
  font-size: clamp(18px, 4.5vw, 26px);
}

/* Main Mob (Materi Bank Soal) Theme: Emas / Crimson Boss */
.modal-battle.is-main-mob {
  border-color: #f59e0b !important;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.4) !important;
}

.modal-battle.is-main-mob .battle-header {
  border-bottom: 2px dashed #f59e0b !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

.modal-battle.is-main-mob .mob-info-title h2 {
  color: #fde047 !important;
}

.modal-battle.is-main-mob .math-question-box {
  border-color: #f59e0b !important;
  background: #1e1b4b !important;
}

.modal-battle.is-main-mob .math-q-equation.is-text-question {
  color: #fef08a !important;
  text-align: left;
}

.battle-header {
  border-bottom: 2px dashed #e74c3c !important;
  background: rgba(231, 76, 60, 0.1);
  padding: 8px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mob-info-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mob-info-title h2 {
  font-size: clamp(10px, 2.2vw, 13px);
  color: #ff7675;
}

.mob-avatar-large {
  font-size: 2rem;
  animation: float-mob 2s ease-in-out infinite alternate;
}

@keyframes float-mob {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

.boss-hp-section {
  margin-bottom: 12px;
}

.hp-label-row {
  display: flex;
  justify-content: space-between;
  font-size: clamp(7.5px, 1.6vw, 9px);
  font-weight: bold;
  color: #ff7675;
  margin-bottom: 4px;
}

.hp-bar-track {
  width: 100%;
  height: 14px;
  background: #111;
  border: 2px solid #fff;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  background: #e74c3c;
  transition: width 0.3s ease;
}

.battle-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.streak-badge {
  background: #d63031;
  color: #fff;
  font-size: clamp(7px, 1.5vw, 8.5px);
  font-weight: bold;
  padding: 3px 8px;
  border: 2px solid #fff;
}

.difficulty-tag {
  background: #6c5ce7;
  color: #fff;
  font-size: clamp(7px, 1.5vw, 8.5px);
  font-weight: bold;
  padding: 3px 8px;
  border: 2px solid #fff;
}

.speed-timer-container {
  width: 100%;
  height: 6px;
  background: #111;
  border: 1px solid #fff;
  overflow: hidden;
  margin-bottom: 4px;
}

.speed-timer-fill {
  height: 100%;
  width: 100%;
  background: #f1c40f;
  transition: width 0.1s linear;
}

.speed-hint {
  font-size: clamp(7px, 1.5vw, 8.5px);
  color: #dfe6e9;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.5;
}

.math-question-box {
  background: #1e272e;
  border: 4px solid #fbc531;
  padding: clamp(10px, 2.5vw, 16px);
  text-align: center;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.math-q-symbol {
  font-size: 1.6rem;
}

.math-q-equation {
  font-size: clamp(16px, 4vw, 24px);
  font-weight: 900;
  color: #fbc531;
  letter-spacing: 2px;
}

.math-q-equation.is-text-question {
  font-size: clamp(8.5px, 2vw, 11px);
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: normal;
  text-align: left;
}

.battle-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.battle-opt-btn {
  background: #353b48;
  border: 3px solid #ffffff;
  color: #f5f6fa;
  min-height: 52px;
  font-size: clamp(14px, 3.5vw, 20px);
  font-family: var(--pixel-font);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  touch-action: manipulation;
}

.battle-opt-btn.is-text-opt {
  font-size: clamp(7.5px, 1.6vw, 9.5px);
  min-height: 48px;
  padding: 6px 10px;
  text-align: left;
  justify-content: flex-start;
  line-height: 1.4;
  word-break: break-word;
  font-weight: 600;
}

.battle-opt-btn:active {
  transform: scale(0.95);
  background: #485460;
  border-color: #fbc531;
}

.battle-feedback {
  text-align: center;
  padding: 8px;
  font-weight: bold;
  font-size: clamp(8px, 1.8vw, 10px);
}

.battle-feedback.crit {
  background: rgba(231, 76, 60, 0.25);
  border: 2px solid #e74c3c;
  color: #ff7675;
}

.battle-feedback.normal {
  background: rgba(46, 204, 113, 0.25);
  border: 2px solid #2ecc71;
  color: #2ecc71;
}

/* ========================================================
   COMPACT ULTRA-EFFICIENT ZERO-SCROLL BATTLE MODAL STYLES
   ======================================================== */
.modal-battle.compact-battle-card {
  width: min(94vw, 480px) !important;
  max-height: 88vh !important;
  padding: 8px 12px 10px 12px !important;
  overflow: hidden !important;
}

.compact-battle-header {
  padding: 4px 6px !important;
  margin-bottom: 6px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: rgba(15, 23, 42, 0.7) !important;
  border-radius: 4px;
}

.compact-mob-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mob-avatar-small {
  font-size: 22px;
  line-height: 1;
}

.compact-mob-name {
  font-size: 11px !important;
  font-weight: 800;
  margin: 0 !important;
  color: #fef08a;
}

.compact-hp-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.compact-hp-text {
  font-size: 8px;
  font-weight: bold;
  color: #f87171;
  font-family: monospace;
}

.compact-hp-track {
  width: 90px !important;
  height: 7px !important;
  background: #1e1115;
  border: 1px solid #ef4444;
  border-radius: 2px;
  overflow: hidden;
  margin: 0 !important;
}

.compact-btn-close {
  width: 22px !important;
  height: 22px !important;
  font-size: 14px !important;
  line-height: 20px !important;
  padding: 0 !important;
  margin-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-battle-body {
  padding: 2px 0 0 0 !important;
}

.compact-battle-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.compact-streak-badge {
  font-size: 8px !important;
  padding: 1px 5px !important;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid #f59e0b;
  color: #fef08a;
  font-weight: bold;
}

.compact-diff-tag {
  font-size: 7.5px !important;
  padding: 1px 5px !important;
  border-radius: 3px;
  border: 1px solid #60a5fa !important;
  background: rgba(59, 130, 246, 0.25) !important;
  color: #93c5fd !important;
}

.compact-timer-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-timer-label {
  font-size: 7.5px;
  color: #fde047;
  font-weight: bold;
}

.compact-timer-track {
  width: 80px !important;
  height: 6px !important;
  margin: 0 !important;
  border-radius: 2px;
}

.compact-question-box {
  padding: 6px 10px !important;
  margin-bottom: 8px !important;
  min-height: 48px;
  max-height: 90px;
  overflow-y: auto;
  border: 2px solid #f59e0b !important;
  border-radius: 4px;
  background: #0f172a !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.compact-q-symbol {
  font-size: 18px !important;
}

.compact-q-equation {
  font-size: 16px !important;
  font-weight: 800;
  color: #fef08a !important;
  letter-spacing: 1px;
}

.compact-q-equation.is-text-question {
  font-size: 9.5px !important;
  line-height: 1.4 !important;
  text-align: left !important;
  font-weight: 600;
  letter-spacing: normal;
}

.compact-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px !important;
  margin-bottom: 6px !important;
}

.compact-options-grid .battle-opt-btn {
  min-height: 38px !important;
  padding: 4px 8px !important;
  font-size: 14px !important;
  font-weight: 800;
  border: 2px solid #e2e8f0 !important;
  border-radius: 4px;
}

.compact-options-grid .battle-opt-btn.is-text-opt {
  font-size: 8.5px !important;
  line-height: 1.35 !important;
  min-height: 38px !important;
  padding: 4px 6px !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

.compact-feedback {
  margin-top: 4px !important;
  padding: 4px 8px !important;
  font-size: 8.5px !important;
}

.compact-flee-btn {
  width: 100% !important;
  margin-top: 6px !important;
  padding: 4px 8px !important;
  font-size: 8.5px !important;
}

.battle-feedback.miss {
  background: rgba(149, 165, 166, 0.25);
  border: 2px solid #95a5a6;
  color: #dcdde1;
}

/* ==========================================
   RESPONSIVE BREAKPOINTS (MOBILE / TABLET / PC)
   ========================================== */

/* Mobile Devices (<= 640px) */
@media (max-width: 640px) {
  .portal-container {
    padding: 10px 6px;
  }
  .portal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .user-profile-bar {
    width: 100%;
    justify-content: space-between;
  }
  .portal-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .nav-tab.nes-btn {
    font-size: 8px !important;
    padding: 8px 4px !important;
    margin: 0 !important;
  }
  .input-with-list {
    flex-direction: column;
  }
  .subnav-tabs {
    flex-direction: column;
    gap: 6px;
  }
  .subnav-btn.nes-btn {
    width: 100%;
    font-size: 8px !important;
  }
  .admin-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .admin-header-row button {
    width: 100%;
  }
  .bank-packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin: 10px 0 16px 0;
}

.bank-package-card {
  background: linear-gradient(180deg, #2b1b11 0%, #170d07 100%) !important;
  border: 3px solid #5b361e !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.7), inset 0 1px 0 #89512e !important;
  border-radius: 4px !important;
  padding: 14px 12px !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.bank-package-card:hover {
  border-color: #e5a93c !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.85), inset 0 1px 0 #ffd678, 0 0 12px rgba(229, 169, 60, 0.3) !important;
  transform: translateY(-2px);
}

.package-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.package-name {
  font-size: clamp(9px, 2vw, 11px);
  font-weight: bold;
  color: #fbc531;
}

.package-count-badge {
  font-size: 7.5px;
  background: #27ae60;
  color: #fff;
  padding: 2px 6px;
  border-radius: 2px;
}

.package-desc {
  font-size: 8px;
  color: #a4b0be;
  margin-bottom: 12px;
  line-height: 1.5;
}

.bank-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .bank-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .bank-action-bar button {
    width: 100%;
  }
  .rooms-grid, .bank-grid {
    grid-template-columns: 1fr;
  }
  .room-card-actions {
    flex-direction: column;
  }
  .room-card-actions .nes-btn {
    width: 100%;
  }
  .demo-login-grid {
    grid-template-columns: 1fr;
  }
  .demo-login-grid .nes-btn {
    font-size: 8px !important;
    padding: 10px 8px !important;
  }
  .modal-card {
    width: 96vw !important;
    padding: 12px 8px !important;
  }
  .modal-subhead-row {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-subhead-row button {
    width: 100%;
  }
  .battle-opt-btn {
    min-height: 48px;
    font-size: 16px !important;
  }
  .top-bar {
    top: 6px;
    left: 6px;
    right: 6px;
    gap: 4px;
  }
  .info-pill {
    padding: 4px 6px;
    font-size: 8px;
  }
}

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .portal-container {
    max-width: 90vw;
  }
  .rooms-grid, .bank-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .demo-login-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========================================================
   MMO TITLE SCREEN & DIRECT MMO GATEWAY
   ======================================================== */
.mmo-title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(16px, 3vw, 32px) clamp(12px, 2.5vw, 24px);
  box-sizing: border-box;
}

.mmo-header {
  text-align: center;
  margin-bottom: 24px;
}

.mmo-crest {
  font-size: clamp(20px, 4vw, 28px);
  margin-bottom: 6px;
  filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.7));
  animation: floatCrest 2.5s ease-in-out infinite alternate;
}

@keyframes floatCrest {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.mmo-title {
  font-size: clamp(18px, 4.5vw, 30px);
  color: #fbc531;
  text-shadow: 3px 3px 0 #281404, 0 0 16px rgba(251, 197, 49, 0.5);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.mmo-subtitle {
  font-size: clamp(8px, 1.8vw, 10px);
  color: #d4a373;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.mmo-gateway-view {
  width: 100%;
  max-width: 580px;
}

.gateway-box {
  width: 100%;
}

.mmo-welcome-desc {
  font-size: clamp(8px, 1.8vw, 9.5px);
  color: #f5eedb;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.6;
}

.mmo-gate-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mmo-gate-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 18px !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  border-radius: 4px !important;
  transition: all 0.12s ease !important;
}

.gate-btn-icon {
  font-size: clamp(20px, 4vw, 26px);
  margin-right: 14px;
  flex-shrink: 0;
}

.gate-btn-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gate-btn-title {
  font-size: clamp(10px, 2.2vw, 13px);
  font-weight: bold;
  letter-spacing: 1px;
}

.gate-btn-desc {
  font-size: clamp(7px, 1.5vw, 8.5px);
  color: #fffaea;
  opacity: 0.88;
  font-weight: normal;
  line-height: 1.4;
}

.gate-arrow {
  font-size: 16px;
  margin-left: 10px;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.mmo-gate-btn:hover .gate-arrow {
  transform: translateX(4px);
  opacity: 1;
}

.mmo-subpanel {
  width: 100%;
  max-width: 580px;
}

.panel-button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.mmo-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, #321c10 0%, #1a0e07 100%);
  border: 3px solid #6c3f21;
  box-shadow: inset 0 1px 0 #945931, 0 4px 12px rgba(0,0,0,0.6);
  padding: 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.mmo-user-avatar {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

.mmo-user-meta h3 {
  color: #fbc531;
  font-size: clamp(11px, 2.4vw, 14px);
  margin-bottom: 4px;
}

.mmo-full-btn {
  width: 100%;
  box-sizing: border-box;
}

/* ======================================================================
   RPG FANTASY PARCHMENT WORLD MAP MODAL & IN-GAME SYSTEM MENU
   ====================================================================== */
.world-map-container {
  max-width: 860px !important;
  width: 95vw !important;
  background: radial-gradient(circle at 50% 30%, #301f14 0%, #1c1109 70%, #0d0603 100%) !important;
  border: 4px solid #c89544 !important;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.9) !important;
}

.world-map-badge {
  background: #1e293b;
  border: 2px solid #f59e0b;
  color: #fef08a;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 8px;
  display: inline-block;
}

.world-map-body {
  padding: 12px !important;
}

.world-map-layout {
  display: flex;
  gap: 16px;
  flex-direction: row;
}

@media (max-width: 720px) {
  .world-map-layout {
    flex-direction: column;
    align-items: center;
  }
}

.world-map-canvas-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #150d08;
  border: 3px solid #6b4322;
  border-radius: 4px;
  padding: 8px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.8);
}

#world-map-canvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 320 / 460;
  display: block;
  border-radius: 3px;
  image-rendering: pixelated;
}

.world-map-legend {
  display: flex;
  gap: 10px;
  font-size: 7.5px;
  color: #f7e7c4;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.world-sectors-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 260px;
}

.world-sectors-list {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
}

.world-sector-card {
  transition: all 0.15s ease;
  background: linear-gradient(180deg, #24160e 0%, #150c07 100%) !important;
  border: 2px solid #54371f !important;
}

.world-sector-card:hover {
  transform: translateX(4px);
  filter: brightness(1.1);
}

.world-sector-card.active-sector {
  border-color: #f59e0b !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4), inset 0 0 8px rgba(245, 158, 11, 0.15) !important;
  background: linear-gradient(180deg, #321e12 0%, #1d1008 100%) !important;
}

/* In-Game System Menu Modal */
#ingame-system-modal .modal-card {
  background: radial-gradient(circle at 50% 30%, #2f1d13 0%, #1a0f09 100%) !important;
  border: 4px solid #a87938 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8) !important;
}

/* PC / Large Desktop (>= 1025px) */
@media (min-width: 1025px) {
  .portal-container {
    max-width: 920px;
  }
  .rooms-grid, .bank-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .demo-login-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========================================================
   MMO TITLE SCREEN & DIRECT MMO GATEWAY
   ======================================================== */
.mmo-title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(16px, 3vw, 32px) clamp(12px, 2.5vw, 24px);
  box-sizing: border-box;
}

.mmo-header {
  text-align: center;
  margin-bottom: 24px;
}

.mmo-crest {
  font-size: clamp(20px, 4vw, 28px);
  margin-bottom: 6px;
  filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.7));
  animation: floatCrest 2.5s ease-in-out infinite alternate;
}

@keyframes floatCrest {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.mmo-title {
  font-size: clamp(18px, 4.5vw, 30px);
  color: #fbc531;
  text-shadow: 3px 3px 0 #281404, 0 0 16px rgba(251, 197, 49, 0.5);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.mmo-subtitle {
  font-size: clamp(8px, 1.8vw, 10px);
  color: #d4a373;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.mmo-gateway-view {
  width: 100%;
  max-width: 580px;
}

.gateway-box {
  width: 100%;
}

.mmo-welcome-desc {
  font-size: clamp(8px, 1.8vw, 9.5px);
  color: #f5eedb;
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.6;
}

.mmo-gate-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mmo-gate-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 18px !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  border-radius: 4px !important;
  transition: all 0.12s ease !important;
}

.gate-btn-icon {
  font-size: clamp(20px, 4vw, 26px);
  margin-right: 14px;
  flex-shrink: 0;
}

.gate-btn-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gate-btn-title {
  font-size: clamp(10px, 2.2vw, 13px);
  font-weight: bold;
  letter-spacing: 1px;
}

.gate-btn-desc {
  font-size: clamp(7px, 1.5vw, 8.5px);
  color: #fffaea;
  opacity: 0.88;
  font-weight: normal;
  line-height: 1.4;
}

.gate-arrow {
  font-size: 16px;
  margin-left: 10px;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.mmo-gate-btn:hover .gate-arrow {
  transform: translateX(4px);
  opacity: 1;
}

.mmo-subpanel {
  width: 100%;
  max-width: 580px;
}

.panel-button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.mmo-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(180deg, #321c10 0%, #1a0e07 100%);
  border: 3px solid #6c3f21;
  box-shadow: inset 0 1px 0 #945931, 0 4px 12px rgba(0,0,0,0.6);
  padding: 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.mmo-user-avatar {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

.mmo-user-meta h3 {
  color: #fbc531;
  font-size: clamp(11px, 2.4vw, 14px);
  margin-bottom: 4px;
}

.mmo-full-btn {
  width: 100%;
  box-sizing: border-box;
}

/* ======================================================================
   RPG FANTASY PARCHMENT WORLD MAP MODAL & IN-GAME SYSTEM MENU
   ====================================================================== */
.world-map-container {
  max-width: 860px !important;
  width: 95vw !important;
  background: radial-gradient(circle at 50% 30%, #301f14 0%, #1c1109 70%, #0d0603 100%) !important;
  border: 4px solid #c89544 !important;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.9) !important;
}

.world-map-badge {
  background: #1e293b;
  border: 2px solid #f59e0b;
  color: #fef08a;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 8px;
  display: inline-block;
}

.world-map-body {
  padding: 12px !important;
}

.world-map-layout {
  display: flex;
  gap: 16px;
  flex-direction: row;
}

@media (max-width: 720px) {
  .world-map-layout {
    flex-direction: column;
    align-items: center;
  }
}

.world-map-canvas-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #150d08;
  border: 3px solid #6b4322;
  border-radius: 4px;
  padding: 8px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.8);
}

#world-map-canvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  aspect-ratio: 320 / 460;
  display: block;
  border-radius: 3px;
  image-rendering: pixelated;
}

.world-map-legend {
  display: flex;
  gap: 10px;
  font-size: 7.5px;
  color: #f7e7c4;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.world-sectors-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 260px;
}

.world-sectors-list {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
}

.world-sector-card {
  transition: all 0.15s ease;
  background: linear-gradient(180deg, #24160e 0%, #150c07 100%) !important;
  border: 2px solid #54371f !important;
}

.world-sector-card:hover {
  transform: translateX(4px);
  filter: brightness(1.1);
}

.world-sector-card.active-sector {
  border-color: #f59e0b !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4), inset 0 0 8px rgba(245, 158, 11, 0.15) !important;
  background: linear-gradient(180deg, #321e12 0%, #1d1008 100%) !important;
}

/* In-Game System Menu Modal */
#ingame-system-modal .modal-card {
  background: radial-gradient(circle at 50% 30%, #2f1d13 0%, #1a0f09 100%) !important;
  border: 4px solid #a87938 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8) !important;
}
