canvas{
    display:block;
    margin:0 auto;
    padding:0;
}
body{
    margin:0;
    padding:0;
    background-color:lightblue;
}




/* Hamburger menu button */
.hamburger-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9002;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: rgba(31, 36, 48, 0.85);
    border: 1px solid #394150;
    border-radius: 6px;
    transition: background 0.15s ease, left 0.3s ease;
}
.hamburger-btn:hover {
    background: rgba(42, 47, 58, 0.95);
}
.hamburger-btn.sidebar-open {
    left: 292px;
}
.hamburger-line {
    width: 20px;
    height: 2px;
    background: #bfc7d5;
    border-radius: 1px;
    transition: background 0.15s ease;
}
.hamburger-btn:hover .hamburger-line {
    background: #fff;
}

/* right click menu */

.custom-menu {
    padding:0;
    display: none;
    z-index:1000;
    position: absolute;
    background-color:#fff;
    border: 1px solid #ddd;
    overflow: hidden;
    min-width: 120px;
    
    font-family: sans-serif;
    
-webkit-box-shadow: 2px 2px 7px 0px rgba(50, 50, 50, 0.5);
-moz-box-shadow:    2px 2px 7px 0px rgba(50, 50, 50, 0.5);
box-shadow:         2px 2px 7px 0px rgba(50, 50, 50, 0.5);
}


    .custom-menu li {
        padding: 5px;
        list-style-type:  none; /* Add this line to remove the left dot */
    }


.custom-menu li:hover {
    background-color: #4679BD;
    color: #fff;
    cursor: pointer;
}

/* Modal styles for asset creation */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-window {
  background: #1f2430;
  color: #e6e6e6;
  min-width: 520px;
  max-width: 80vw;
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  border: 1px solid #394150;
}
.modal-window.modal-large {
  width: 50vw;
  height: 50vh;
  min-width: unset;
  max-width: unset;
  max-height: unset;
  display: flex;
  flex-direction: column;
}
@media (max-width: 999px), (max-height: 999px) {
  .modal-window.modal-large {
    width: 90vw;
    height: 90vh;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2a2f3a;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.modal-close {
  background: transparent;
  color: #bfc7d5;
  border: none;
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 16px; overflow: auto; }
.modal-large .modal-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.modal-section { margin-bottom: 16px; }
.modal-section h3 { margin: 0 0 8px 0; font-size: 14px; color: #bfc7d5; }
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.option-btn {
  background: #3a4253;
  color: #e6e6e6;
  border: 1px solid #4a5468;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
}
.option-btn:hover { background: #48526a; }
.custom-sprite-input { display: flex; gap: 8px; }
.custom-sprite-input input {
  flex: 1;
  background: #2a2f3a;
  color: #e6e6e6;
  border: 1px solid #394150;
  border-radius: 8px;
  padding: 8px 10px;
}
.custom-sprite-input button { padding: 8px 12px; }
.muted { color: #94a3b8; font-size: 12px; }

/* Asset editor textarea */
.asset-editor-textarea {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #181c24;
  color: #e6e6e6;
  border: 1px solid #394150;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 10px;
  resize: none;
  box-sizing: border-box;
  line-height: 1.5;
  tab-size: 2;
}
.asset-editor-textarea:focus {
  outline: none;
  border-color: #5a6a8a;
}
.asset-editor-textarea.invalid {
  border-color: #ff4444;
}

/* Sidebar - push content mode */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: #1f2430;
  color: #e6e6e6;
  z-index: 9001;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  border-right: 1px solid #394150;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-header {
  padding: 24px 20px 16px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  border-bottom: 1px solid #394150;
  font-family: 'Bree Serif', serif;
}
.sidebar-menu {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}
.sidebar-item {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 15px;
  color: #bfc7d5;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-item:hover {
  background: #2a2f3a;
  color: #fff;
}

.sidebar-section-header {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6b7a90;
  border-top: 1px solid #394150;
  margin-top: 4px;
}

.sidebar-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: default;
}

.sidebar-toggle-label {
  font-size: 14px;
  color: #bfc7d5;
}

.sidebar-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #3d4560;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle-track.on {
  background: #4679BD;
}

.sidebar-toggle-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e0e0e0;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sidebar-toggle-track.on .sidebar-toggle-knob {
  left: 20px;
}

/* Mobile Fullscreen Overlay */
.mc-fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-fs-btn {
  padding: 24px 48px;
  border-radius: 16px;
  background: rgba(40, 40, 50, 0.9);
  border: 3px solid #b8a882;
  color: #d4a850;
  font-family: 'Nunito', sans-serif;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 3px;
  text-align: center;
}

/* Mobile Controller */
.mc {
  position: fixed;
  z-index: 800;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* === DPAD === */
.mc-dpad {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: auto;
}
.mc-dpad-btn {
  position: absolute;
  background: rgba(40, 40, 50, 0.85);
  border: 2px solid #555;
  border-radius: 4px;
}
.mc-dpad-btn.pressed {
  background: rgba(80, 80, 100, 0.9);
  border-color: #999;
}
.mc-dpad-up {
  top: 0; left: 40px;
  width: 40px; height: 44px;
  border-radius: 6px 6px 0 0;
}
.mc-dpad-down {
  bottom: 0; left: 40px;
  width: 40px; height: 44px;
  border-radius: 0 0 6px 6px;
}
.mc-dpad-left {
  top: 40px; left: 0;
  width: 44px; height: 40px;
  border-radius: 6px 0 0 6px;
}
.mc-dpad-right {
  top: 40px; right: 0;
  width: 44px; height: 40px;
  border-radius: 0 6px 6px 0;
}
.mc-dpad-center {
  position: absolute;
  top: 40px; left: 40px;
  width: 40px; height: 40px;
  background: rgba(30, 30, 40, 0.9);
  border: 2px solid #555;
  border-radius: 2px;
}

/* === ACTION BUTTONS (A / B) === */
.mc-actions {
  position: absolute;
  pointer-events: auto;
}
.mc-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(40, 40, 50, 0.85);
  border: 2px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-weight: bold;
  font-size: 16px;
  color: #aaa;
  position: absolute;
  pointer-events: auto;
}
.mc-btn.pressed {
  background: rgba(80, 80, 100, 0.9);
  border-color: #999;
  color: #fff;
}
.mc-btn-a {
  color: #e06060;
  border-color: #a04040;
}
.mc-btn-a.pressed {
  background: rgba(160, 50, 50, 0.5);
  border-color: #e06060;
  color: #ff8888;
}
.mc-btn-b {
  color: #60a0e0;
  border-color: #4070a0;
}
.mc-btn-b.pressed {
  background: rgba(50, 80, 160, 0.5);
  border-color: #60a0e0;
  color: #88ccff;
}

/* === SELECT / START === */
.mc-meta {
  position: absolute;
  pointer-events: auto;
  display: flex;
  gap: 20px;
}
.mc-meta-btn {
  padding: 6px 16px;
  border-radius: 12px;
  background: rgba(40, 40, 50, 0.7);
  border: 1px solid #555;
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  color: #888;
  pointer-events: auto;
}
.mc-meta-btn.pressed {
  background: rgba(80, 80, 100, 0.8);
  border-color: #999;
  color: #ccc;
}

/* === PORTRAIT LAYOUT === */
.mc-portrait {
  inset: 0;
}
.mc-portrait .mc-dpad {
  bottom: 30px;
  left: 24px;
}
.mc-portrait .mc-actions {
  bottom: 30px;
  right: 24px;
  width: 120px;
  height: 100px;
}
.mc-portrait .mc-btn-b {
  top: 0; left: 0;
}
.mc-portrait .mc-btn-a {
  bottom: 0; right: 0;
}
.mc-portrait .mc-meta {
  bottom: 170px;
  left: 50%;
  transform: translateX(-50%);
}

/* === LANDSCAPE LAYOUT === */
.mc-landscape {
  inset: 0;
}
.mc-landscape .mc-dpad {
  bottom: 16px;
  left: 20px;
}
.mc-landscape .mc-actions {
  bottom: 16px;
  right: 20px;
  width: 120px;
  height: 100px;
}
.mc-landscape .mc-btn-b {
  top: 0; left: 0;
}
.mc-landscape .mc-btn-a {
  bottom: 0; right: 0;
}
.mc-landscape .mc-meta {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

/* Start Screen Overlay — universal play gate */
.start-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.5s ease;
}
.start-screen-overlay.start-screen-fade {
  opacity: 0 !important;
  pointer-events: none;
}
.start-screen-btn {
  padding: 24px 48px;
  border-radius: 16px;
  background: rgba(40, 40, 50, 0.9);
  border: 3px solid #b8a882;
  color: #d4a850;
  font-family: 'Nunito', sans-serif;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 3px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}
.start-screen-spinner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;
}
.start-screen-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0 6px;
  border-radius: 50%;
  background: #d4a850;
  animation: start-screen-bounce 0.6s ease-in-out infinite alternate;
}
.start-screen-spinner > .start-screen-dot:nth-child(1) { animation-delay: 0s; }
.start-screen-spinner > .start-screen-dot:nth-child(2) { animation-delay: 0.15s; }
.start-screen-spinner > .start-screen-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes start-screen-bounce {
  0%   { transform: translateY(0); opacity: 0.4; }
  100% { transform: translateY(-12px); opacity: 1; }
}
.start-screen-loading-text {
  width: 100%;
  text-align: center;
  color: #b8a882;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  letter-spacing: 2px;
  margin-top: 16px;
}
