/* ============================================================
   FONTS
   ============================================================ */
@font-face {
  font-display: swap;
  font-family: "SeuratProDB";
  font-style: normal;
  font-weight: normal;
  src: url('/fonts/FOT-Seurat Pro DB.otf');
}

@font-face {
  font-display: swap;
  font-family: "SeuratProEB";
  font-style: normal;
  font-weight: normal;
  src: url('/fonts/FOT-Seurat Pro EB.otf');
}

@font-face {
  font-display: swap;
  font-family: "SeuratProUB";
  font-style: normal;
  font-weight: normal;
  src: url('/fonts/FOT-Seurat Pro UB.otf');
}

/* ============================================================
   RESET / BASE ELEMENTS
   ============================================================ */
* {
  box-sizing: border-box;
  font-family: "SeuratProDB", Arial, sans-serif;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow-x: hidden;
}

body {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  height: 100vh;
  position: relative;
  background-color: #333333; /* fallback while image loads / if it has transparency */
  background-repeat: repeat;
  background-size: 90px 90px; /* must match the tile distance in the animation below */
  animation: scroll-grid 24s linear infinite;
}

@keyframes scroll-grid {
  from { background-position: 0 0; }
  to   { background-position: 90px -90px; } /* same 64px used in background-size */
}

a {
  color: #ffd700;
  text-decoration: none;
}

b {
  font-family: "SeuratProEB";
  font-weight: normal;
}

i {
  color: #5a44e1;
  font-style: normal;
  font-weight: bold;
  text-decoration: none;
}

h1 {
  color: #79cfff;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

input {
  border: 1px solid #ddd;
  border-radius: 30px;
  margin: 0;
  outline: none;
  padding: 12px;
  width: 100%;
}

input:focus {
  border-color: #ffd700;
}

canvas {
  max-width: 100%;
}

/* ============================================================
   PAGE FRAME / LAYOUT
   ============================================================ */
.container {
  background: black;
  margin: auto;
  min-width: 450px;
  padding: 0;
  text-align: center;
  width: fit-content;
  max-width: 704px;
}

.mobile-frame {
  background-color: #000;
  border: 12px solid #111;
  border-radius: 40px;
  box-shadow: 0 0 0 2px #333, 0 20px 50px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  position: relative;
  padding: 20px;
  width: fit-content;
  max-width: 704px;
}

.mobile-screen {
  border-radius: 20px;
  width: fit-content;
  max-width: 704px;
}

.horizontal {
  width: fit-content;
  max-width: 704px;
}

.important {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 1rem;
  margin: 1.5rem 0;
  color: black !important;
  border-radius: 0 16px 16px 0;
}

/* ============================================================
   LOGIN BAR
   ============================================================ */
.login-bar {
  align-items: center;
  background: black;
  color: white;
  display: flex;
  flex-direction: row;
  font-size: 10px;
  justify-content: space-between;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding: 6px 6px;
}

/* ============================================================
   STATS GRID (the swipeable stat pages)
   ============================================================ */
.megu-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background-color: #c3a37e;
  padding: 1rem;
  border-top: 1px solid white;
}

.megu-stats-grid:not(.active) {
  display: none;
}

.stat-container {
  align-items: flex-start;
  background: #806f5a;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0px 8px;
  text-align: left;
}

.stat-container.hidden {
  display: none;
}

.stat-label {
  color: #FFD700;
  display: flex;
  font-family: 'SeuratProDB', sans-serif;
  font-size: 14px;
  justify-content: space-between;
  line-height: 14px;
  margin-right: 6px;
  margin-top: -3px;
  min-width: 20px;
  paint-order: stroke fill;
  text-align: right;
  text-stroke: 6px #806f5a;
  text-transform: uppercase;
  width: 100%;
  -webkit-text-stroke: 6px #806f5a;
}

.stat-value {
  color: white;
  font-size: 14px;
  font-weight: lighter;
  margin-bottom: 4px;
  width: 100%;
}

/* ============================================================
   STATUS BARS (health/satiety/etc bars over the house)
   ============================================================ */
.status-bar-container {
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  right: 2rem;
  top: 0.75rem;
  width: 50%;
}

.status-item {
  align-items: center;
  display: flex;
  gap: 6px;
}

.status-label {
  font-family: 'SeuratProDB', sans-serif;
  color: #ffffff;
  font-size: 20px;
  min-width: 20px;
  text-align: right;
  -webkit-text-stroke: 7px #323131;
  text-stroke: 7px #323131;
  paint-order: stroke fill;
  width: 100px;
  line-height: 36px;
  text-transform: uppercase;
  margin-right: 6px;
}

.status-bar-outline {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid white;
  border-radius: 4px;
  box-shadow: 0 0 0 4px #393838;
  flex-grow: 1;
  height: 18px;
  overflow: hidden;
  position: relative;
}

.status-bar-fill {
  border: none !important;
  border-radius: 2px;
  height: 100%;
}

.satiety.status-bar-fill {
  background: #ff9448;
}

.health.status-bar-fill {
  background: #f85653;
}

.level.status-bar-fill {
  background: #4cea7c;
}

#health,
#satiety,
#weight,
#reliability,
#honor,
#satisfaction,
#electricity,
#friendship,
#stress {
  display: inline-block;
}

/* ============================================================
   POTIONS DISPLAY (gold + elixir counters)
   ============================================================ */
.potion-display {
  margin: 0.5rem;
  padding: 0.25rem;
  position: absolute;
  text-align: left;
}

.potion-item {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  padding: 0;
  margin-right: 4rem;
}

.potion-icon {
  height: 48px;
  width: 48px;
}

.potion-count {
  color: #ffffff;
  font-family: 'SeuratProDB', sans-serif;
  font-size: 20px;
  line-height: 36px;
  margin-right: 6px;
  min-width: 20px;
  paint-order: stroke fill;
  text-align: right;
  text-stroke: 7px #323131;
  text-transform: uppercase;
  -webkit-text-stroke: 7px #323131;
}

/* ============================================================
   MEGU HOUSE / CANVAS / DECORATION LAYERS
   ============================================================ */
.megu-house {
  background-repeat: no-repeat;
  background-size: contain;
  margin: 0 auto 0.25rem auto;
  max-width: 640px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

#meguCanvas {
  display: block;
  position: relative;
  z-index: 8;
}

#meguCanvas.evolving-megu {
  position: relative;
  z-index: 99;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.034));
}

.watts {
  bottom: 6px;
  cursor: pointer;
  left: 6px;
  position: absolute;
  width: 12%;
  z-index: 9;
}

.watts:hover {
  opacity: 0.85;
}

.feed-toss-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

.feed-toss-food {
  position: absolute;
  left: 0;
  top: 0;
  object-fit: contain;
  opacity: 0;
  transform-origin: center center;
  will-change: transform, opacity;
}

.furniture-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.furniture-layer.is-editing {
  pointer-events: auto;
  z-index: 30;
}

.placed-furniture-item {
  position: absolute;
  touch-action: none;
  user-select: none;
  cursor: pointer;
}

.placed-furniture-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.placed-furniture-item.dragging {
  opacity: 0.88;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.28));
}

.redecorate-save-button {
  border: 3px solid #333;
  background: #fff;
  color: #222;
  border-radius: 10px;
  padding: 3px;
  font-family: "SeuratProDB", Arial, sans-serif;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px #fff,
    inset 4px 4px 8px rgba(255, 255, 255, 0.3),
    inset -2px -2px 4px rgba(0, 0, 0, 0.33);
}

.disabled-nav-button {
  filter: grayscale(1);
}

/* ============================================================
   POPUPS (message box, charge animation, evolve confirm, evolution fade)
   ============================================================ */
.simple-popup {
  position: fixed;
  max-width: min(624px, calc(100vw - 24px));
  width: calc(100vw - 24px);
  top: 35%;
  left: 50%;
  border-radius: 18px;
  border: 8px solid #50df0a;
  z-index: 3000;
  background-color: rgba(255, 255, 255, 0.95);
  text-align: center;
  padding: 0.75rem;
  font-size: 125%;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
  color: RGB(0,60,0);
  height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#chargeAnimationPopup {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 3200;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  width: fit-content;
  max-width: calc(100vw - 24px);
}

#chargeAnimationPopup img {
  width: min(600px, calc(100vw - 56px));
  max-width: 600px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.confirm-popup p {
  text-align: left;
  line-height: 2rem;
}

.confirm-buttons button {
  padding: 4px 16px;
  margin: 0 4px;
  border: 3px solid #5f5f5f;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: bold;
  font-size: 100%;
}

#evolveYesButton {
  border: 3px solid #333;
  color: #333;
}

#evolveNoButton {
  border: 3px solid #333;
  background: #969696 !important;
  color: white;
}

.btn-shadow {
  box-shadow: inset 0 0 0 2px #fff,
    inset 4px 4px 8px rgba(255, 255, 255, 0.3),
    inset -2px -2px 4px rgba(0, 0, 0, 0.33);
}

.megu-message-box {
  position: absolute;
  max-width: 624px;
  width: 96%;
  top: 200px;
  left: 50%;
  border-radius: 18px;
  border: 8px solid #50df0a;
  z-index: 11;
  background-color: white;
  text-align: left;
  padding: 0.75rem;
  font-size: 135%;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s;
}

.megu-message-box p {
  color: rgb(0, 60, 0);
  font-family: "SeuratProDB", Arial, sans-serif;
  line-height: 1.3;
  white-space: pre-line;
}

.megu-message-box.visible {
  display: block;
  opacity: 85%;
  visibility: visible;
  transition: opacity 0.3s ease-in-out, visibility 0s;
  pointer-events: auto;
}

.megu-message-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: center;
}

.megu-message-actions.hidden {
  display: none !important;
  margin-top: 0;
}

.megu-message-ok {
  border: 3px solid #333;
  background: #ffffff;
  color: #222;
  border-radius: 8px;
  padding: 0.3rem 0.9rem;
  font-family: "SeuratProDB", Arial, sans-serif;
  cursor: pointer;
  width: 120px;
  font-size: 96%;
  font-weight: bold;
  box-shadow: inset 0 0 0 2px #fff,
    inset 4px 4px 8px rgba(255, 255, 255, 0.3),
    inset -2px -2px 4px rgba(0, 0, 0, 0.33);
  margin-top: 4rem;
}

.evolution-fade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0);
  z-index: 10;
  opacity: 0;
  transition: background-color 0.5s ease-in-out, opacity 0.5s ease-in-out;
  pointer-events: none;
}

.evolution-fade-overlay.visible {
  background-color: rgba(0, 0, 0, 0.95);
  opacity: 1;
  pointer-events: auto;
}

/* ---- Friendship popup (XP / Gold float) ---- */
#reward-popup {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
  font-family: 'SeuratProDB', sans-serif;
  font-size: 32px;
  font-weight: bold;
  line-height: 1.2;
  opacity: 0;
  white-space: nowrap;
}

.reward-xp {
  color: #fa89a1;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
  display: flex;
  align-items: center;
  gap: 5px;
}

.reward-gold {
  display: none;
  color: #FFD700;
  -webkit-text-stroke: 4px #7a5500;
  paint-order: stroke fill;
}

.reward-level {
  display: block;
}

.reward-heart {
  width: auto;
  vertical-align: top;
}

@keyframes rewardFloat {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0px); }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-80px); }
}

#reward-popup.reward-animate {
  animation: rewardFloat 1.5s ease-out forwards;
}

/* ============================================================
   MODAL SHELL
   ============================================================ */
#modal-overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 9;
}

#modal {
  background: #fff;
  border: 3px solid #413f36;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-width: 90%;
  overflow: hidden;
  width: 418px;
}

.modal-header {
  align-items: center;
  background: lightblue;
  display: flex;
  gap: 8px;
  padding: 8px;
  position: relative;
}

.modal-title {
  color: white;
  flex-grow: 1;
  font-size: 22px;
  font-weight: bold;
  paint-order: stroke fill;
  text-align: center;
  text-stroke: 6px rgba(0, 0, 0, 0.25);
  -webkit-text-stroke: 6px rgba(0, 0, 0, 0.25);
}

.modal-gold {
  align-items: center;
  color: white;
  display: flex;
  font-size: 14px;
  white-space: nowrap;
}

.modal-content {
  align-items: center;
  background-color: #f3e2c3;
  background-image: radial-gradient(#e6d9c3 2px, transparent 2px);
  background-size: 6px 6px;
  border: 2px solid white;
  border-radius: 4px;
  display: flex;
  flex-grow: 1;
  flex-wrap: wrap;
  margin: 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .5rem;
}

.modal-footer {
  background: #eee;
  display: flex;
  justify-content: center;
  padding: 8px;
}

.modal-footer a {
  line-height: 0;
}

.modal-close-button {
  cursor: pointer;
  height: auto;
  width: 42px;
}

.modal-trigger {
  cursor: pointer;
}

.modal-menu {
  align-items: center;
  background: none;
  border: 0px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.25rem;
  padding: 0 0.33rem;
  cursor: pointer;
}

.modal-menu b {
  color: #303030;
  font-family: 'SeuratProDB';
  font-size: 16px;
}

.modal-menu img {
  height: 100px;
  width: 100px;
}

.modal-content.modal-content-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  justify-items: center;
  gap: 0.35rem 0.1rem;
  padding: 0.75rem 0.6rem;
}

.modal-content.modal-content-menu-grid .modal-menu {
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding: 0.1rem;
}

.modal-content.modal-content-menu-grid .modal-menu img {
  width: clamp(56px, 18vw, 100px);
  height: clamp(56px, 18vw, 100px);
}

.modal-content.modal-content-menu-grid .modal-menu b {
  text-align: center;
  font-size: clamp(12px, 2.1vw, 16px);
  line-height: 2;
}

/* Modal color themes, by data-type */
#modal-overlay[data-type="Care"] .modal-header,
#modal-overlay[data-type="Food"] .modal-header,
#modal-overlay[data-type="Furniture"] .modal-header,
#modal-overlay[data-type="FurnitureInventory"] .modal-header,
#modal-overlay[data-type="Elixir"] .modal-header,
#modal-overlay[data-type="Relocate"] .modal-header,
#modal-overlay[data-type="Care"] .modal-footer,
#modal-overlay[data-type="Food"] .modal-footer,
#modal-overlay[data-type="Furniture"] .modal-footer,
#modal-overlay[data-type="FurnitureInventory"] .modal-footer,
#modal-overlay[data-type="Elixir"] .modal-footer,
#modal-overlay[data-type="Relocate"] .modal-footer,
#modal-overlay[data-type="Care"] #modal,
#modal-overlay[data-type="Relocate"] #modal,
#modal-overlay[data-type="Furniture"] #modal,
#modal-overlay[data-type="FurnitureInventory"] #modal,
#modal-overlay[data-type="Food"] #modal {
  background: #ff7970;
}

#modal-overlay[data-type="Petpet"] .modal-header,
#modal-overlay[data-type="Petpet"] .modal-footer {
  background: #f992e3;
}

#modal-overlay[data-type="Outing"] .modal-header,
#modal-overlay[data-type="Adventure"] .modal-header,
#modal-overlay[data-type="EventPlaza"] .modal-header,
#modal-overlay[data-type="Outing"] .modal-footer,
#modal-overlay[data-type="Adventure"] .modal-footer,
#modal-overlay[data-type="EventPlaza"] .modal-footer,
#modal-overlay[data-type="Outing"] #modal {
  background: #ffa400;
}

#modal-overlay[data-type="Store"] .modal-header,
#modal-overlay[data-type="Shop-food"] .modal-header,
#modal-overlay[data-type="Shop-houses"] .modal-header,
#modal-overlay[data-type="Shop-furniture"] .modal-header,
#modal-overlay[data-type="Store"] .modal-footer,
#modal-overlay[data-type="Shop-food"] .modal-footer,
#modal-overlay[data-type="Shop-houses"] .modal-footer,
#modal-overlay[data-type="Shop-furniture"] .modal-footer,
#modal-overlay[data-type="Store"] #modal,
#modal-overlay[data-type="Shop-food"] #modal,
#modal-overlay[data-type="Shop-houses"] #modal,
#modal-overlay[data-type="Shop-furniture"] #modal {
  background: #53a1eb;
}

#modal-overlay[data-type="Megu"] .modal-header,
#modal-overlay[data-type="Megu"] #modal,
#modal-overlay[data-type="Megu"] .modal-footer,
#modal-overlay[data-type="MEGUPedia"] .modal-header,
#modal-overlay[data-type="MEGUPedia"] #modal,
#modal-overlay[data-type="MEGUPedia"] .modal-footer {
  background: #8f64b9;
}

#modal-overlay[data-type="Settings"] #modal,
#modal-overlay[data-type="Settings"] .modal-header,
#modal-overlay[data-type="Settings"] .modal-footer {
  background: #9a7f5f;
}

.img-shadow {
  object-fit: contain;
  border: 4px solid #5f5f5f;
  position: relative;
  overflow: hidden;
  background-color: white;
  align-content: center;
}

.img-shadow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fff, inset 4px 4px 8px rgba(255, 255, 255, 0.3), inset -2px -2px 4px rgba(0, 0, 0, 0.33);
  pointer-events: none;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-navi {
  align-items: center;
  background-color: #f3e2c3;
  background-image: radial-gradient(#d9cdb8 2px, transparent 2px);
  background-size: 6px 6px;
  border-top: 2px solid #83674b;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 0.5rem;
}

.bottom-navi img {
  height: auto;
  margin: 0 0.5rem;
  max-width: 85px;
  width: 100%;
}

.megu-navi,
.settings-btn {
  align-items: center;
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.divider {
  background: #b8ad8a;
  border: 1px solid white;
  height: 64px;
  margin: 0 0.25rem;
  width: 4px;
}

#soundImage {
  cursor: pointer;
}

.page-indicators {
  background-color: #c3a37e;
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 5px 0 10px 0;
}

.indicator {
  color: white;
  cursor: pointer;
  height: 8px;
  line-height: 0;
  opacity: 0.5;
  transition: all 0.3s ease;
  width: 8px;
}

.indicator.active {
  opacity: 1;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex-inline { display: inline-flex; }
.hide { display: none; }
.hidden { opacity: 0; pointer-events: none; }

.flex { display: flex; }
.flex-col, .col { flex-direction: column; }
.flex-row, .row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.align-start { align-content: flex-start; }
.align-center { align-items: center; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }

.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: .5rem; }
.m-3 { margin: .75rem; }
.m-4 { margin: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 800px) and (max-height: 980px) {
  .mobile-frame.horizontal {
    transform: scale(0.80);
  }
}

@media (max-width: 799px) {
  html, body {
    height: 100%;
    overflow: hidden; /* prevent scrollbars on mobile */
  }
  body {
    margin: 0;
  }

  /* Let JS compute the scale to fit both width and height */
  .mobile-frame.horizontal {
    transform-origin: center;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
  }

  /* Remove black container background on mobile to avoid borders */
  .container {
    background: transparent;
  }

  .page-indicators {
    padding: 5px 0 7px 0;
  }
}

@media (max-width: 640px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body {
    display: flex !important;
    width: 100% !important;
    max-width: 640px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    min-height: 0 !important;
  }

  .mobile-screen,
  .container,
  .horizontal,
  .mobile-frame {
    width: 100% !important;
    max-width: 640px !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .megu-house {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
  }

  .mobile-screen {
    overflow: visible !important;
  }

  .simple-popup {
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
    padding: 0.65rem;
    border-width: 6px;
    font-size: 100%;
  }

  #chargeAnimationPopup {
    max-width: calc(100vw - 16px);
    width: auto;
    padding: 0.35rem;
    border-width: 5px;
  }

  #chargeAnimationPopup img {
    width: min(560px, calc(100vw - 36px));
  }

  .login-bar {
    font-size: 10px;
    line-height: 2;
    flex-wrap: wrap;
    row-gap: 2px;
    justify-content: space-between;
    text-align: center;
    padding: 6px;
    margin-top: 0.2rem;
  }

  .status-label {
    font-size: 13px;
    line-height: 22px;
    width: 68px;
    margin-right: 2px;
    -webkit-text-stroke: 5px #323131;
  }

  .status-bar-container {
    right: 0.5rem;
    top: 0.5rem;
    width: 48%;
    gap: 3px;
  }

  .status-bar-outline {
    height: 14px;
    box-shadow: 0 0 0 3px #393838;
    border-width: 1px;
  }

  .potion-icon {
    width: 34px;
    height: 34px;
  }

  .potion-display {
    margin-left: 0.25rem;
    padding: 0.1rem;
  }

  .potion-item {
    gap: 4px;
  }

  .potion-count {
    font-size: 14px;
    line-height: 20px;
    -webkit-text-stroke: 5px #323131;
  }

  .megu-stats-grid {
    gap: 8px;
    margin-top: 7px;
    padding: 1rem 0.75rem .5rem;
  }

  .stat-label {
    font-size: 12px;
    line-height: 12px;
    margin-top: -4px;
  }

  .stat-value {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .bottom-navi {
    padding: 0.35rem 0.25rem;
    gap: 0.2rem;
    overflow-x: hidden;
  }

  .bottom-navi img {
    max-width: 64px !important;
  }

  .megu-navi {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.15rem;
  }

  .megu-navi img {
    max-width: 64px !important;
    margin: 0 0.1rem !important;
  }

  .divider {
    margin: 0 0.1rem;
    width: 4px;
    height: 56px;
  }

  .megu-message-box {
    top: 150px;
    width: 92%;
    max-width: 560px;
    padding: 0.5rem;
    border-width: 6px;
    font-size: 110%;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 0.4rem;
    justify-content: left;
  }

  .modal-content.modal-content-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: initial;
    padding: 0.4rem;
    gap: 0.3rem 0.05rem;
  }

  .megu-stats-container {
    margin-top: -.33rem;
  }

  .megu-stats-grid {
    grid-template-columns: 1fr;
  }

  .modal-menu img {
    width: 92px;
    height: 92px;
  }

  .megu-message-box {
    border-radius: 8px;
    top: 138px;
    font-size: 100%;
  }
}

@media (max-width: 450px) {
  .mobile-frame.horizontal {
    min-height: 100vh;
  }

  .mobile-screen {
    border-radius: 0;
    border: 0;
  }
}