* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  background: #0a0a14;
  position: fixed;
  top: var(--vv-top, 0px);
  left: var(--vv-left, 0px);
  width: var(--app-w, 100%);
  height: var(--app-h, 100dvh);
  max-height: var(--app-h, 100dvh);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  font-family: "Courier New", monospace;
  color: #eee;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.panel {
  background: #1a1a3a;
  border: 3px solid #4a4a8a;
  padding: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
}

.menu-panel {
  text-align: center;
}

.menu-logo {
  display: block;
  width: min(120px, 40vw);
  height: auto;
  margin: 0 auto 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.menu-panel h1 {
  font-size: 1.2rem;
  color: #ffd700;
  margin-bottom: 4px;
}

.menu-credit {
  font-size: 0.72rem;
  color: #aaa;
  margin-bottom: 12px;
}

.menu-credit a {
  color: #ffd700;
  text-decoration: none;
}

.menu-credit a:hover,
.menu-credit a:focus-visible {
  text-decoration: underline;
}

.menu-creator-hint {
  margin-top: 8px;
  font-size: 0.68rem;
  color: #888;
  line-height: 1.35;
}

.menu-creator-login {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-size: 0.72rem;
}

.supabase-key-error {
  margin-bottom: 10px;
  padding: 8px 10px;
  font-size: 0.65rem;
  line-height: 1.35;
  color: #ffb4b4;
  background: rgba(180, 40, 40, 0.2);
  border: 1px solid #c44;
  text-align: left;
}

#mainMenu.screen.active,
#customMapsScreen.screen.active {
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  height: 100%;
  max-height: 100%;
  padding:
    max(6px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
}

#mainMenu .menu-panel,
#customMapsScreen .custom-maps-panel {
  margin-top: 4px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

body.portrait-locked #app {
  visibility: hidden;
  pointer-events: none;
}

.landscape-gate {
  position: fixed;
  top: var(--vv-top, 0px);
  left: var(--vv-left, 0px);
  width: var(--app-w, 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0a0a14;
  text-align: center;
  height: var(--app-h, 100dvh);
}

.landscape-gate[hidden] {
  display: none !important;
}

.landscape-gate-panel {
  max-width: 320px;
}

.landscape-gate-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 16px;
  color: #ffd700;
  animation: landscape-wiggle 1.4s ease-in-out infinite;
}

.landscape-gate-panel h2 {
  color: #ffd700;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.landscape-gate-panel p {
  color: #aaa;
  font-size: 0.8rem;
  line-height: 1.45;
}

@keyframes landscape-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-90deg); }
  75% { transform: rotate(-90deg); }
}

.subtitle {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 0.7rem;
  color: #aaa;
  margin: 12px 0 4px;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 8px;
  background: #0d0d22;
  border: 2px solid #4a4a8a;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-row.vertical {
  flex-direction: column;
}

.btn {
  flex: 1;
  padding: 10px 12px;
  background: #2a2a6a;
  border: 2px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.btn:hover {
  background: #3a3a8a;
}

.btn.primary {
  background: #4a7020;
  border-color: #8bc34a;
}

.btn.full-width {
  width: 100%;
  margin-top: 12px;
}

.btn.full-width:first-of-type {
  margin-top: 0;
}

.btn.danger {
  background: #5a2020;
  border-color: #c44;
  margin-top: 12px;
  width: 100%;
}

/* ── Pantalla de juego ── */
.play-screen.active {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    max(4px, env(safe-area-inset-top, 0px))
    max(4px, env(safe-area-inset-right, 0px))
    max(4px, env(safe-area-inset-bottom, 0px))
    max(4px, env(safe-area-inset-left, 0px));
}

.play-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.play-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  gap: 6px;
  padding: 0 4px;
}

.play-rail {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  padding-top: 36px;
  padding-bottom: 4px;
  gap: 8px;
}

.play-rail-left {
  width: min(88px, 18vw);
}

.play-rail-right {
  width: min(88px, 18vw);
  justify-content: space-between;
}

.touch-move-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  flex: 1 1 auto;
  justify-content: center;
}

.touch-top-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  justify-content: center;
  align-self: flex-start;
  margin-top: 2px;
}

.touch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  flex: 1 1 auto;
  padding: 0;
  border: 3px solid #6a6aaa;
  border-radius: 10px;
  background: rgba(26, 26, 58, 0.94);
  color: #ffd700;
  font-family: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-btn-mini {
  min-height: 44px;
  flex: 1 1 0;
  font-size: 1.05rem;
}

.touch-jump {
  min-height: 72px;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.touch-btn.touch-active,
.touch-btn:active {
  background: rgba(74, 74, 138, 0.98);
  border-color: #ffd700;
}

.play-hint-side {
  margin: 0;
  font-size: 0.55rem;
  line-height: 1.35;
  color: #666;
  text-align: center;
  flex-shrink: 0;
}

.play-hint-desktop {
  display: block;
  margin-top: 6px;
  font-size: 0.65rem;
  color: #666;
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 900px), (pointer: coarse) {
  .play-rail {
    display: flex;
  }

  .play-hint-desktop {
    display: none;
  }

  .play-layout {
    gap: 4px;
    padding: 0 2px;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  .play-layout {
    flex-direction: column;
    align-items: center;
  }

  .game-mount {
    width: 100%;
  }
}

.play-hint {
  margin-top: 10px;
  font-size: 0.65rem;
  color: #666;
  text-align: center;
}

.overlay-btn {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: max(8px, env(safe-area-inset-left, 0px));
  z-index: 10;
  padding: 6px 10px;
  background: rgba(26, 26, 58, 0.92);
  border: 2px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.overlay-btn:hover {
  background: rgba(58, 58, 138, 0.95);
}

.overlay-btn-right {
  left: auto;
  right: max(8px, env(safe-area-inset-right, 0px));
}

.mobile-only {
  display: none;
}

@media (max-width: 900px), (pointer: coarse) {
  .mobile-only {
    display: block;
  }

  .icon-btn.mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.game-mount {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  width: auto;
}

.game-frame {
  position: relative;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid #2a2a4a;
  outline: 2px solid #0f0f22;
  box-shadow:
    0 0 0 2px #5a5a9a,
    0 8px 32px rgba(0, 0, 0, 0.55),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
  background: #0f0f22;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
}

.level-complete-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.72);
}

.level-complete-overlay[hidden] {
  display: none !important;
}

.level-complete-panel {
  background: #1a1a3a;
  border: 3px solid #6a6aaa;
  padding: 20px 18px;
  max-width: calc(100% - 24px);
  text-align: center;
}

.level-complete-panel h2 {
  color: #ffd700;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.level-complete-custom {
  color: #8bc34a;
  font-size: 0.78rem;
  margin-bottom: 14px;
  line-height: 1.4;
}

.level-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.level-complete-actions .btn {
  min-width: 88px;
  flex: 1 1 auto;
}

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

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

button,
.icon-btn,
.float-btn,
.dpad-btn,
.editor-tab {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.editor-screen canvas {
  cursor: crosshair;
}

.editor-screen.active {
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

/* ── Editor responsive workspace ── */
.editor-workspace {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0a0a14;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: #1a1a3a;
  border-bottom: 2px solid #4a4a8a;
  flex-shrink: 0;
}

.editor-title-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  background: #0d0d22;
  border: 2px solid #4a4a8a;
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
}

.icon-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #2a2a6a;
  border: 2px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.icon-btn.primary {
  background: #4a7020;
  border-color: #8bc34a;
}

.editor-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
}

.editor-float-bar {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 8;
}

.float-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(26, 26, 58, 0.94);
  border: 2px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.float-btn.active {
  background: rgba(90, 32, 32, 0.95);
  border-color: #f87171;
}

.float-zoom-label {
  align-self: center;
  min-width: 28px;
  text-align: center;
  font-size: 0.65rem;
  color: #ccc;
  user-select: none;
}

.editor-select,
.editor-textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: #1a1a3a;
  border: 1px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
}

.editor-textarea {
  resize: vertical;
  min-height: 64px;
}

.enemy-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #ccc;
}

.mini-input {
  width: 56px;
  padding: 4px 6px;
  background: #1a1a3a;
  border: 1px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
}

.slider-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.7rem;
  color: #ccc;
}

.slider-label input[type="range"] {
  width: 100%;
  accent-color: #fb923c;
}

.slider-label strong {
  color: #fb923c;
}

.editor-dpad {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 9;
  display: grid;
  grid-template-columns: 40px 40px 40px;
  grid-template-rows: 40px 40px 40px;
  gap: 4px;
  pointer-events: auto;
}

.dpad-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(26, 26, 58, 0.94);
  border: 2px solid #6a6aaa;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.dpad-btn:active {
  background: rgba(58, 58, 138, 0.95);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.editor-dpad.horizontal-only {
  grid-template-columns: 40px 40px;
  grid-template-rows: 40px;
}

.editor-dpad.horizontal-only .dpad-left {
  grid-column: 1;
  grid-row: 1;
}

.editor-dpad.horizontal-only .dpad-right {
  grid-column: 2;
  grid-row: 1;
}

#gameCanvas.pan-mode {
  cursor: grab;
}

#gameCanvas.pan-mode:active {
  cursor: grabbing;
}

.float-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.editor-tabs {
  display: flex;
  flex-shrink: 0;
  border-top: 2px solid #4a4a8a;
  background: #141430;
}

.editor-tab {
  flex: 1;
  min-height: 32px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #888;
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.editor-tab.active {
  color: #8bc34a;
  border-bottom-color: #8bc34a;
  background: #1a1a3a;
}

.editor-dock {
  flex-shrink: 0;
  max-height: 30vh;
  overflow-y: auto;
  background: #1a1a3a;
  border-top: 1px solid #2a2a4a;
  padding: 6px 8px 8px;
  -webkit-overflow-scrolling: touch;
}

.editor-panel[hidden] {
  display: none;
}

.tool-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tool-strip::-webkit-scrollbar {
  display: none;
}

.tool-strip .tool-btn {
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 40px;
  padding: 3px 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
}

.tool-icon-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.tool-label {
  font-size: 0.52rem;
  line-height: 1;
}

.tool-strip .tool-key {
  position: static;
  transform: none;
  font-size: 0.55rem;
  color: #666;
}

.stamp-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.stamp-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 6px;
  background: #0d0d22;
  border: 2px solid #4a4a8a;
  color: #ccc;
  font-family: inherit;
  font-size: 0.58rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stamp-icon-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

.stamp-label {
  line-height: 1;
}

.chip-btn.chip-sprite {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  min-width: 32px;
}

.float-erase {
  color: #f87171;
  font-weight: bold;
}

.icon-sprite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.header-icon-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.stamp-btn.active {
  background: #2a4a2a;
  border-color: #8bc34a;
  color: #fff;
}

.editor-hint-mobile {
  display: block;
}

.editor-hint-desktop {
  display: none;
}

.map-manager {
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2a2a4a;
}

.option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.option-chips.scroll {
  max-height: 96px;
  overflow-y: auto;
  flex-wrap: wrap;
}

.chip-btn {
  flex: 1 1 auto;
  min-width: 32px;
  min-height: 32px;
  padding: 4px 6px;
  background: #0d0d22;
  border: 2px solid #4a4a8a;
  color: #bbb;
  font-family: inherit;
  font-size: 0.6rem;
  cursor: pointer;
  text-align: center;
  user-select: none;
}

.option-chips.compact {
  gap: 4px;
}

.chip-btn.active {
  background: #2a4a2a;
  border-color: #8bc34a;
  color: #fff;
}

.tool-btn {
  position: relative;
  background: #0d0d22;
  border: 2px solid #4a4a8a;
  color: #ccc;
  font-family: inherit;
  cursor: pointer;
}

.tool-btn.active {
  background: #2a4a2a;
  border-color: #8bc34a;
  color: #fff;
}

.tool-panel {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2a4a;
}

.tool-panel[hidden] {
  display: none;
}

.json-panel {
  margin-top: 10px;
  border: 1px solid #4a4a8a;
  background: #0d0d22;
  padding: 8px;
}

.json-panel summary {
  font-size: 0.68rem;
  color: #aaa;
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.json-textarea {
  width: 100%;
  min-height: 100px;
  max-height: 180px;
  padding: 8px;
  background: #050510;
  border: 1px solid #4a4a8a;
  color: #cde;
  font-family: inherit;
  font-size: 0.62rem;
  line-height: 1.35;
  resize: vertical;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 0.75rem;
  color: #8bc34a;
  background: rgba(74, 222, 128, 0.08);
  border: 2px dashed #8bc34a;
  z-index: 5;
}

.game-mount.drop-active .game-frame {
  outline: 2px solid #8bc34a;
}

.editor-status {
  font-size: 0.58rem;
  color: #8bc34a;
  background: #0d0d22;
  border: 1px solid #4a4a8a;
  padding: 4px 6px;
  margin: 4px 0 0;
  min-height: 22px;
  line-height: 1.25;
}

.btn.mini {
  padding: 6px 6px;
  font-size: 0.62rem;
  margin-top: 4px;
  min-height: 32px;
  width: 100%;
}

.hint.inline {
  margin-top: 2px;
}

.editor-dock .hint {
  font-size: 0.58rem;
  margin-top: 4px;
  line-height: 1.3;
}

/* Desktop: canvas + dock side by side */
@media (min-width: 781px) {
  .editor-workspace {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
  }

  .editor-header {
    width: 100%;
  }

  .editor-tabs {
    display: none;
  }

  .editor-stage {
    flex: 1;
    min-width: 400px;
    order: 1;
  }

  .editor-dock {
    width: 220px;
    max-height: calc(var(--app-h, 100dvh) - 44px);
    order: 2;
    border-top: none;
    border-left: 2px solid #4a4a8a;
    padding-top: 12px;
  }

  .editor-panel {
    display: block !important;
  }

  .editor-panel[data-panel="map"] {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #2a2a4a;
  }

  .editor-panel[hidden] {
    display: block !important;
  }

  .tool-strip {
    flex-wrap: wrap;
    overflow: visible;
  }

  .tool-strip .tool-btn {
    flex: 1 1 calc(25% - 6px);
    min-width: 0;
  }

  .editor-hint-mobile {
    display: none;
  }

  .editor-hint-desktop {
    display: block;
  }
}

@media (max-width: 780px) {
  body.editor-open {
    overflow: hidden;
  }

  .menu-panel,
  .custom-maps-panel {
    padding: 12px 12px 10px;
    width: calc(100% - 12px);
  }

  .menu-logo {
    width: min(80px, 22vh);
    margin-bottom: 2px;
  }

  .menu-panel h1 {
    font-size: 0.95rem;
    margin-bottom: 2px;
  }

  .menu-credit {
    margin-bottom: 6px;
    font-size: 0.62rem;
  }

  .btn.full-width {
    margin-top: 6px;
    padding: 7px 8px;
    font-size: 0.72rem;
  }

  .btn-row {
    margin-top: 6px;
  }

  .menu-creator-hint {
    margin-top: 6px;
    font-size: 0.58rem;
  }

  .menu-creator-login {
    margin-top: 6px;
    font-size: 0.65rem;
  }

  .auth-bar {
    margin-bottom: 6px;
    padding: 6px;
  }

  .overlay-btn {
    font-size: 0.68rem;
    padding: 5px 8px;
  }

  .overlay-btn-right {
    min-width: 36px;
    text-align: center;
    font-size: 0.85rem;
    padding: 5px 10px;
  }
}

@media (max-height: 400px) {
  .menu-logo {
    width: min(64px, 18vh);
  }

  .menu-panel h1 {
    font-size: 0.85rem;
  }

  .menu-credit {
    margin-bottom: 4px;
  }

  .menu-panel,
  .custom-maps-panel {
    padding: 8px 10px;
  }

  .btn.full-width {
    margin-top: 4px;
    padding: 6px 8px;
  }

  .menu-creator-hint {
    display: none;
  }
}

.auth-bar {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: #12122a;
  border: 1px solid #3a3a6a;
  text-align: left;
}

.auth-status {
  font-size: 0.75rem;
  color: #bbb;
  margin-bottom: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.modal[hidden] {
  display: none !important;
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  background: #1a1a3a;
  border: 3px solid #4a4a8a;
  padding: 22px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: #ccc;
  font-size: 1.4rem;
  cursor: pointer;
}

.auth-form {
  margin-top: 12px;
}

.auth-input {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 2px solid #4a4a8a;
  background: #0f0f22;
  color: #eee;
  font-family: inherit;
}

.auth-error {
  color: #ff6b6b;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.auth-toggle {
  margin-top: 12px;
  text-align: center;
}

.link-btn {
  border: none;
  background: none;
  color: #ffd700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
}

.custom-maps-panel {
  max-width: 520px;
  width: calc(100% - 32px);
}

.custom-maps-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.custom-maps-header h2 {
  color: #ffd700;
  font-size: 1.1rem;
}

.custom-maps-list {
  list-style: none;
  margin-top: 12px;
  max-height: 55vh;
  overflow-y: auto;
}

.custom-map-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #3a3a6a;
}

.custom-map-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.custom-map-info strong {
  color: #fff;
  font-size: 0.9rem;
}

.custom-map-meta {
  font-size: 0.72rem;
  color: #aaa;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 14px 0;
}

.rating-star {
  border: none;
  background: transparent;
  color: #555;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.rating-star.active {
  color: #ffd700;
}

.rating-comment {
  resize: vertical;
  min-height: 72px;
}
